MySQL 8.4.0
Source Code Documentation
dd::cache::Multi_map_base< T > Class Template Reference

Implementation of a set of maps for a given object type. More...

#include <multi_map_base.h>

Inheritance diagram for dd::cache::Multi_map_base< T >:
[legend]

Classes

struct  Type_selector
 

Public Types

typedef Element_map< constT *, Cache_element< T > >::Const_iterator Const_iterator
 
typedef Element_map< constT *, Cache_element< T > >::Iterator Iterator
 

Protected Member Functions

template<typename K >
Element_map< K, Cache_element< T > > * m_map ()
 Template function to get an element map. More...
 
template<typename K >
const Element_map< K, Cache_element< T > > * m_map () const
 
void remove_single_element (Cache_element< T > *element)
 Helper function to remove the mapping of a single element, without deleting the element itself. More...
 
void add_single_element (Cache_element< T > *element)
 Helper function to add a single element. More...
 
void dump () const
 Debug dump of the multi map base to stderr. More...
 

Private Member Functions

Element_map< const T *, Cache_element< T > > * m_map (Type_selector< const T * >)
 Overloaded functions to use for selecting an element list instance based on a key type. More...
 
const Element_map< const T *, Cache_element< T > > * m_map (Type_selector< const T * >) const
 
Element_map< typename T::Id_key, Cache_element< T > > * m_map (Type_selector< typename T::Id_key >)
 
const Element_map< typename T::Id_key, Cache_element< T > > * m_map (Type_selector< typename T::Id_key >) const
 
Element_map< typename T::Name_key, Cache_element< T > > * m_map (Type_selector< typename T::Name_key >)
 
const Element_map< typename T::Name_key, Cache_element< T > > * m_map (Type_selector< typename T::Name_key >) const
 
Element_map< typename T::Aux_key, Cache_element< T > > * m_map (Type_selector< typename T::Aux_key >)
 
const Element_map< typename T::Aux_key, Cache_element< T > > * m_map (Type_selector< typename T::Aux_key >) const
 

Private Attributes

Element_map< const T *, Cache_element< T > > m_rev_map
 
Element_map< typename T::Id_key, Cache_element< T > > m_id_map
 
Element_map< typename T::Name_key, Cache_element< T > > m_name_map
 
Element_map< typename T::Aux_key, Cache_element< T > > m_aux_map
 

Detailed Description

template<typename T>
class dd::cache::Multi_map_base< T >

Implementation of a set of maps for a given object type.

The class declares a set of maps, each of which maps from a key type to an element type. The element type wraps the template object type parameter into a wrapper instance.

The implementation is intended to be used as a base to be extended for usage in a specific context. There is support for adding and removing elements in all maps with one operation (but not necessarily atomically), and for retrieving a single map. There is no support for tracking object usage, free list management, thread synchronization, etc.

Template Parameters
TDictionary object type.

Member Typedef Documentation

◆ Const_iterator

template<typename T >
typedef Element_map<constT*,Cache_element<T>>::Const_iterator dd::cache::Multi_map_base< T >::Const_iterator

◆ Iterator

template<typename T >
typedef Element_map<constT*,Cache_element<T>>::Iterator dd::cache::Multi_map_base< T >::Iterator

Member Function Documentation

◆ add_single_element()

template<typename T >
void dd::cache::Multi_map_base< T >::add_single_element ( Cache_element< T > *  element)
protected

Helper function to add a single element.

This function assumes that checking for key and element presence has already been done, that the object has been assigned, and that the keys have been generated.

Parameters
elementElement to be added.

◆ dump()

template<typename T >
void dd::cache::Multi_map_base< T >::dump ( ) const
inlineprotected

Debug dump of the multi map base to stderr.

◆ m_map() [1/10]

template<typename T >
template<typename K >
Element_map< K, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( )
inlineprotected

Template function to get an element map.

To support generic code, the element map instances are available through template function instances. This allows looking up the appropriate instance based on the key type. We must use overloading to accomplish this (see above). Const and non-const variants.

Template Parameters
KKey type.
Returns
The element map handling keys of type K.

◆ m_map() [2/10]

template<typename T >
template<typename K >
const Element_map< K, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( ) const
inlineprotected

◆ m_map() [3/10]

template<typename T >
Element_map< const T *, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< const T * >  )
inlineprivate

Overloaded functions to use for selecting an element list instance based on a key type.

Const and non-const variants.

◆ m_map() [4/10]

template<typename T >
const Element_map< const T *, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< const T * >  ) const
inlineprivate

◆ m_map() [5/10]

template<typename T >
Element_map< typename T::Aux_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Aux_key >  )
inlineprivate

◆ m_map() [6/10]

template<typename T >
const Element_map< typename T::Aux_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Aux_key >  ) const
inlineprivate

◆ m_map() [7/10]

template<typename T >
Element_map< typename T::Id_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Id_key >  )
inlineprivate

◆ m_map() [8/10]

template<typename T >
const Element_map< typename T::Id_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Id_key >  ) const
inlineprivate

◆ m_map() [9/10]

template<typename T >
Element_map< typename T::Name_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Name_key >  )
inlineprivate

◆ m_map() [10/10]

template<typename T >
const Element_map< typename T::Name_key, Cache_element< T > > * dd::cache::Multi_map_base< T >::m_map ( Type_selector< typename T::Name_key >  ) const
inlineprivate

◆ remove_single_element()

template<typename T >
void dd::cache::Multi_map_base< T >::remove_single_element ( Cache_element< T > *  element)
protected

Helper function to remove the mapping of a single element, without deleting the element itself.

This function assumes that checking for key and element presence has already been done.

Parameters
elementElement to be removed and deleted.

Member Data Documentation

◆ m_aux_map

template<typename T >
Element_map<typename T::Aux_key, Cache_element<T> > dd::cache::Multi_map_base< T >::m_aux_map
private

◆ m_id_map

template<typename T >
Element_map<typename T::Id_key, Cache_element<T> > dd::cache::Multi_map_base< T >::m_id_map
private

◆ m_name_map

template<typename T >
Element_map<typename T::Name_key, Cache_element<T> > dd::cache::Multi_map_base< T >::m_name_map
private

◆ m_rev_map

template<typename T >
Element_map<const T *, Cache_element<T> > dd::cache::Multi_map_base< T >::m_rev_map
private

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