MySQL 9.1.0
Source Code Documentation
Table_histograms Class Reference

The Table_histograms class represents a snapshot of the collection of histograms associated with a table. More...

#include <table_histograms.h>

Public Member Functions

 Table_histograms (Table_histograms &&)=delete
 
Table_histogramsoperator= (Table_histograms &&)=delete
 
 Table_histograms (const Table_histograms &)=delete
 
Table_histogramsoperator= (const Table_histograms &)=delete
 
 ~Table_histograms ()=delete
 
void destroy ()
 Destroys the object and frees memory. More...
 
const histograms::Histogramfind_histogram (unsigned int field_index) const
 Perform a lookup in the local collection of histograms for a histogram on a given field. More...
 
bool insert_histogram (unsigned int field_index, const histograms::Histogram *histogram)
 Copies the given histogram onto the local MEM_ROOT and inserts the copy into the local collection of histograms. More...
 

Static Public Member Functions

static Table_histogramscreate (PSI_memory_key psi_key) noexcept
 Factory method to create Table_histogram objects. More...
 

Private Member Functions

 Table_histograms ()=default
 
int reference_count () const
 The number of TABLE objects referencing this object. More...
 
void increment_reference_counter ()
 
void decrement_reference_counter ()
 
int get_index () const
 The index of this object in the Table_histograms_collection. More...
 
void set_index (int index)
 

Private Attributes

MEM_ROOT m_mem_root
 
mem_root_unordered_map< unsigned int, const histograms::Histogram * > * m_histograms {nullptr}
 
int m_reference_counter {0}
 
size_t m_index {0}
 

Friends

class Table_histograms_collection
 

Detailed Description

The Table_histograms class represents a snapshot of the collection of histograms associated with a table.

Table_histograms contains a reference counter to keep track of the number of TABLE objects that point to it.

Table_histogram objects are created using the static factory method create(). The object itself and everything it points to (including its MEM_ROOT) is allocated on its own MEM_ROOT. Table_histogram objects are destroyed/freed by calling destroy() that clears the MEM_ROOT.

Constructor & Destructor Documentation

◆ Table_histograms() [1/3]

Table_histograms::Table_histograms ( )
privatedefault

◆ Table_histograms() [2/3]

Table_histograms::Table_histograms ( Table_histograms &&  )
delete

◆ Table_histograms() [3/3]

Table_histograms::Table_histograms ( const Table_histograms )
delete

◆ ~Table_histograms()

Table_histograms::~Table_histograms ( )
delete

Member Function Documentation

◆ create()

Table_histograms * Table_histograms::create ( PSI_memory_key  psi_key)
staticnoexcept

Factory method to create Table_histogram objects.

Allocates a Table_histogram object on its own MEM_ROOT and returns a pointer. Should be matched by a call to destroy().

Parameters
psi_keyperformance schema instrumentation memory key to track all memory used by the object.
Returns
A pointer to a Table_histograms object if construction was successful, returns nullptr otherwise.

◆ decrement_reference_counter()

void Table_histograms::decrement_reference_counter ( )
inlineprivate

◆ destroy()

void Table_histograms::destroy ( )

Destroys the object and frees memory.

◆ find_histogram()

const histograms::Histogram * Table_histograms::find_histogram ( unsigned int  field_index) const

Perform a lookup in the local collection of histograms for a histogram on a given field.

Parameters
field_indexIndex of the field to find a histogram for.
Returns
Pointer to a histogram or nullptr if no histogram was found.

◆ get_index()

int Table_histograms::get_index ( void  ) const
inlineprivate

The index of this object in the Table_histograms_collection.

◆ increment_reference_counter()

void Table_histograms::increment_reference_counter ( )
inlineprivate

◆ insert_histogram()

bool Table_histograms::insert_histogram ( unsigned int  field_index,
const histograms::Histogram histogram 
)

Copies the given histogram onto the local MEM_ROOT and inserts the copy into the local collection of histograms.

Parameters
field_indexIndex of the field to insert a histogram for.
histogramPointer to the histogram to be copied and inserted.
Returns
False if success, true on error.

◆ operator=() [1/2]

Table_histograms & Table_histograms::operator= ( const Table_histograms )
delete

◆ operator=() [2/2]

Table_histograms & Table_histograms::operator= ( Table_histograms &&  )
delete

◆ reference_count()

int Table_histograms::reference_count ( ) const
inlineprivate

The number of TABLE objects referencing this object.

◆ set_index()

void Table_histograms::set_index ( int  index)
inlineprivate

Friends And Related Function Documentation

◆ Table_histograms_collection

friend class Table_histograms_collection
friend

Member Data Documentation

◆ m_histograms

mem_root_unordered_map<unsigned int, const histograms::Histogram *>* Table_histograms::m_histograms {nullptr}
private

◆ m_index

size_t Table_histograms::m_index {0}
private

◆ m_mem_root

MEM_ROOT Table_histograms::m_mem_root
private

◆ m_reference_counter

int Table_histograms::m_reference_counter {0}
private

The documentation for this class was generated from the following files: