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

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

#include <local_multi_map.h>

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

Public Member Functions

Multi_map_base< T >::Const_iterator begin () const
 Get an iterator to the beginning of the map. More...
 
Multi_map_base< T >::Iterator begin ()
 
Multi_map_base< T >::Const_iterator end () const
 Get an iterator to one past the end of the map. More...
 
Multi_map_base< T >::Iterator end ()
 
template<typename K >
void get (const K &key, Cache_element< T > **element) const
 Get an element from the map handling the given key type. More...
 
void put (Cache_element< T > *element)
 Put a new element into the map. More...
 
void remove (Cache_element< T > *element)
 Remove an element from the map. More...
 
void erase ()
 Remove and delete all objects from the map. More...
 
size_t size () const
 Get the number of elements in the map. More...
 
void dump () const
 Debug dump of the local multi map to stderr. More...
 

Private Member Functions

template<typename K >
Element_map< K, Cache_element< T > > * m_map ()
 Template helper function getting the element map. More...
 
template<typename K >
const Element_map< K, Cache_element< T > > * m_map () const
 

Additional Inherited Members

- Public Types inherited from dd::cache::Multi_map_base< T >
typedef Element_map< constT *, Cache_element< T > >::Const_iterator Const_iterator
 
typedef Element_map< constT *, Cache_element< T > >::Iterator Iterator
 
- Protected Member Functions inherited from dd::cache::Multi_map_base< T >
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...
 

Detailed Description

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

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

The implementation is an extension of the multi map base, adding support for iteration. It is intended to be used in a single threaded context, and there is no support for tracking object usage, free list management, thread synchronization, etc.

Template Parameters
TDictionary object type.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
Multi_map_base< T >::Iterator dd::cache::Local_multi_map< T >::begin ( void  )
inline

◆ begin() [2/2]

template<typename T >
Multi_map_base< T >::Const_iterator dd::cache::Local_multi_map< T >::begin ( void  ) const
inline

Get an iterator to the beginning of the map.

Const and non-const variants.

Returns
Iterator to the beginning of the map.

◆ dump()

template<typename T >
void dd::cache::Local_multi_map< T >::dump

Debug dump of the local multi map to stderr.

◆ end() [1/2]

template<typename T >
Multi_map_base< T >::Iterator dd::cache::Local_multi_map< T >::end ( void  )
inline

◆ end() [2/2]

template<typename T >
Multi_map_base< T >::Const_iterator dd::cache::Local_multi_map< T >::end ( void  ) const
inline

Get an iterator to one past the end of the map.

Const and non-const variants.

Returns
Iterator to one past the end of the map.

◆ erase()

template<typename T >
void dd::cache::Local_multi_map< T >::erase

Remove and delete all objects from the map.

This includes Cache_elements and the Dictionary objects themselves.

◆ get()

template<typename T >
template<typename K >
void dd::cache::Local_multi_map< T >::get ( const K &  key,
Cache_element< T > **  element 
) const
inline

Get an element from the map handling the given key type.

If the element is present, return a pointer to it. Otherwise, return NULL.

Template Parameters
KKey type.
Parameters
keyKey to use for looking up the element.
[out]elementElement pointer, if present, otherwise NULL.

◆ m_map() [1/2]

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

Template helper function getting the element map.

Const and non-const variants.

Note
Slightly weird syntax is needed to help the parser to resolve this correctly.
Template Parameters
KKey type.
Returns
The element map handling keys of type K.

◆ m_map() [2/2]

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

◆ put()

template<typename T >
void dd::cache::Local_multi_map< T >::put ( Cache_element< T > *  element)

Put a new element into the map.

None of the keys may exist in advance, and the wrapped object may not be present in this map already.

Parameters
elementNew element to be added.

◆ remove()

template<typename T >
void dd::cache::Local_multi_map< T >::remove ( Cache_element< T > *  element)

Remove an element from the map.

This function will remove the element from the multi map. This means that all keys associated with the element will be removed from the maps, and the cache element wrapper will be removed, but not deleted. The object itself is not deleted. It is up to the outer layer to decide what to do with the element and object.

Parameters
elementElement to be removed.

◆ size()

template<typename T >
size_t dd::cache::Local_multi_map< T >::size ( ) const
inline

Get the number of elements in the map.

Returns
Number of elements.

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