MySQL 8.0.40
Source Code Documentation
dd::Entity_registry< K, T, P, F, D > Class Template Reference

Class to represent collections of meta data for entities. More...

#include <system_registry.h>

Public Types

typedef Entity_list_type::const_iterator Const_iterator
 

Public Member Functions

 ~Entity_registry ()
 Delete the heap memory owned by the entity registry. More...
 
void add (const String_type &schema_name, const String_type &entity_name, P property, T *entity)
 Add a new entity to the registry. More...
 
const T * find_entity (const String_type &schema_name, const String_type &entity_name) const
 Find an element entity in the registry. More...
 
const Pfind_property (const String_type &schema_name, const String_type &entity_name) const
 Find the property of an element in the registry. More...
 
Const_iterator begin () const
 Get the beginning of the vector of ordered inserts. More...
 
Const_iterator begin (P property) const
 Get the first element with a certain property. More...
 
Const_iterator end () const
 Get the end of the vector of ordered inserts. More...
 
Const_iterator next (Const_iterator current) const
 Get the next element in the list of ordered inserts. More...
 
Const_iterator next (Const_iterator current, P property) const
 Get the next element in the list of ordered inserts. More...
 
void dump () const
 

Private Types

typedef Entity_element< K, T, P, F, D > Entity_element_type
 
typedef std::vector< Entity_element_type * > Entity_list_type
 
typedef std::map< K, Entity_element_type * > Entity_map_type
 

Private Attributes

Entity_list_type m_entity_list
 List for ordered access. More...
 
Entity_map_type m_entity_map
 Map for direct key based lookup. More...
 

Detailed Description

template<typename K, typename T, typename P, const char * F, bool D>
class dd::Entity_registry< K, T, P, F, D >

Class to represent collections of meta data for entities.

This class is used to represent relevant meta data and properties of system related entities, e.g. all the dictionary tables. The meta data is associated with a key instance, usually a std::pair containing the schema- and entity names.

The class supports adding and retrieving objects, as well as iteration based on the order of inserts.

Note
There is no support for concurrency. We assume that the registry is created and that the entities are inserted in a single threaded situation, e.g. while the server is being started. Read only access can happen from several threads simultaneously, though.
Template Parameters
KKey type.
TEntity type.
PProperty type.
FFunction to map from property to name.
DBoolean flag to decide whether the wrapped objects are owned by the registry.

Member Typedef Documentation

◆ Const_iterator

template<typename K , typename T , typename P , const char * F, bool D>
typedef Entity_list_type::const_iterator dd::Entity_registry< K, T, P, F, D >::Const_iterator

◆ Entity_element_type

template<typename K , typename T , typename P , const char * F, bool D>
typedef Entity_element<K, T, P, F, D> dd::Entity_registry< K, T, P, F, D >::Entity_element_type
private

◆ Entity_list_type

template<typename K , typename T , typename P , const char * F, bool D>
typedef std::vector<Entity_element_type *> dd::Entity_registry< K, T, P, F, D >::Entity_list_type
private

◆ Entity_map_type

template<typename K , typename T , typename P , const char * F, bool D>
typedef std::map<K, Entity_element_type *> dd::Entity_registry< K, T, P, F, D >::Entity_map_type
private

Constructor & Destructor Documentation

◆ ~Entity_registry()

template<typename K , typename T , typename P , const char * F, bool D>
dd::Entity_registry< K, T, P, F, D >::~Entity_registry ( )
inline

Delete the heap memory owned by the entity registry.

Only the wrapper elements are owned by the registry. The std::vector and std::map are not allocated dynamically, and their destructors are called implicitly when this destructor is called.

Member Function Documentation

◆ add()

template<typename K , typename T , typename P , const char * F, bool D>
void dd::Entity_registry< K, T, P, F, D >::add ( const String_type schema_name,
const String_type entity_name,
P  property,
T *  entity 
)
inline

Add a new entity to the registry.

This method will create a new key and a new entity wrapper element. The wrapper will be added to the map, along with the key, and to the vector to keep track of the order of inserts.

Parameters
schema_nameSchema name used to construct the key.
entity_nameEntity name used to construct the key.
propertyProperty used to classify the entity.
entityEntity which is classified and registered.

◆ begin() [1/2]

template<typename K , typename T , typename P , const char * F, bool D>
Const_iterator dd::Entity_registry< K, T, P, F, D >::begin ( void  ) const
inline

Get the beginning of the vector of ordered inserts.

Return values
Iteratorreferring to the first element in the vector, or end() if the vector is empty.

◆ begin() [2/2]

template<typename K , typename T , typename P , const char * F, bool D>
Const_iterator dd::Entity_registry< K, T, P, F, D >::begin ( P  property) const
inline

Get the first element with a certain property.

This method retrieves the first element with a certain property, and is used for iterating only over elements having this property.

Parameters
propertyProperty that the element should have.
Return values
Iteratorreferring to the first element in the vector with the submitted property, or end().

◆ dump()

template<typename K , typename T , typename P , const char * F, bool D>
void dd::Entity_registry< K, T, P, F, D >::dump ( ) const
inline

◆ end()

template<typename K , typename T , typename P , const char * F, bool D>
Const_iterator dd::Entity_registry< K, T, P, F, D >::end ( void  ) const
inline

Get the end of the vector of ordered inserts.

Return values
Iteratorreferring to the special element after the last "real" element in the vector.

◆ find_entity()

template<typename K , typename T , typename P , const char * F, bool D>
const T * dd::Entity_registry< K, T, P, F, D >::find_entity ( const String_type schema_name,
const String_type entity_name 
) const
inline

Find an element entity in the registry.

This method creates a key based on the submitted parameters, and looks up in the member map. If the key is found, the object pointed to by the wrapper is returned, otherwise, nullptr is returned.

Parameters
schema_nameSchema containing the entity searched for.
entity_nameName of the entity searched for.
Return values
nullptrif not found, otherwise, the entity object pointed to by the wrapper element.

◆ find_property()

template<typename K , typename T , typename P , const char * F, bool D>
const P * dd::Entity_registry< K, T, P, F, D >::find_property ( const String_type schema_name,
const String_type entity_name 
) const
inline

Find the property of an element in the registry.

This method creates a key based on the submitted parameters, and looks up in the member map. If the key is found, the property associated with the key is returned, otherwise, nullptr is returned.

Parameters
schema_nameSchema containing the entity searched for.
entity_nameName of the entity searched for.
Return values
nullptrif not found, otherwise, the a pointer to the property associated with the key.

◆ next() [1/2]

template<typename K , typename T , typename P , const char * F, bool D>
Const_iterator dd::Entity_registry< K, T, P, F, D >::next ( Const_iterator  current) const
inline

Get the next element in the list of ordered inserts.

Parameters
currentThe current iterator.
Return values
Iteratorreferring to the next element in the vector.

◆ next() [2/2]

template<typename K , typename T , typename P , const char * F, bool D>
Const_iterator dd::Entity_registry< K, T, P, F, D >::next ( Const_iterator  current,
P  property 
) const
inline

Get the next element in the list of ordered inserts.

This method retrieves the next element with a certain property, and is used for iterating only over elements having this property.

Parameters
currentThe current iterator.
propertyProperty that the next element should have.
Return values
Iteratorreferring to the next element in the vector with the submitted property.

Member Data Documentation

◆ m_entity_list

template<typename K , typename T , typename P , const char * F, bool D>
Entity_list_type dd::Entity_registry< K, T, P, F, D >::m_entity_list
private

List for ordered access.

◆ m_entity_map

template<typename K , typename T , typename P , const char * F, bool D>
Entity_map_type dd::Entity_registry< K, T, P, F, D >::m_entity_map
private

Map for direct key based lookup.


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