ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::enumrecords::detail Namespace Reference

Description:

Details of namespace alib::enumrecords.

Type Index:

struct  EnumRecordHook
 
struct  EnumRecordKey
 

Function Index:

const void * getEnumRecord (const std::type_info &rtti, integer elementValue)
 
HashMap< MonoAllocator, EnumRecordKey, const void *, EnumRecordKey::Hash, EnumRecordKey::EqualTo > & getInternalRecordMap ()
 
void setEnumRecord (const std::type_info &rtti, integer elementValue, const void *record)
 
void shutdown ()
 

Function Details:

◆ getEnumRecord()

ALIB_DLL const void * alib::enumrecords::detail::getEnumRecord ( const std::type_info & rtti,
integer integral )

Retrieves the enum record stored for the enum element with integral value integral of enum type rtti.

Parameters
rttiThe enumeration type.
integralThe integral value of the enum element.
Returns
A pointer to the record, nullptr if not found.

Definition at line 71 of file records.cpp.

◆ getInternalRecordMap()

HashMap< MonoAllocator, EnumRecordKey, const void *, EnumRecordKey::Hash, EnumRecordKey::EqualTo > & alib::enumrecords::detail::getInternalRecordMap ( )

This detail function returns the central hash table that stores enum records of all types. A constant reference is returned, which is in alignment with the general contract of this concept that considers enum records as static data which must not be modified after bootstrapping a process.

Consequently, there are no mechanisms to protect parallel access, because after bootstrap only read operations are allowed.

Before bootstrapping, the returned map may be const_cast'ed to a mutable reference for the sake of modifying the base- and maximum load factors as well as for reserving a certain element capacity. The default values are already raised to 3.0 and 6.0, as the retrieval of enumeration records is not considered to be done in time-critical code units.

Direct access to this map is not recommended, and useful only in seldom cases.

A good sample for its use, is to provide debug-output of all defined records for a type in the case that a record for a certain enumeration element of that type was not found, and such output is required to be performed in a code unit that has lost (templated) compile-time type information.

Note
Run-time access to single records is provided with function alib::enumrecords::detail::getEnumRecord(const std::type_info& rtti " integer)" and encapsulated in type Enum of the module ALib Boxing.
Attention
In the absence of the module ALib Monomem in an ALib Build, the returned type changes to std::unordered_map.
Returns
A constant reference to the internal hash map storing all enum records.

Definition at line 89 of file records.cpp.

◆ setEnumRecord()

ALIB_DLL void alib::enumrecords::detail::setEnumRecord ( const std::type_info & rtti,
integer integral,
const void * record )

Stores the record for enum element of the given enum type rtti. If a value already exists, it is ignored. This allows having multiple records, while only the first is found.

Parameters
rttiThe enumeration type.
integralThe integral value of the enum element.
recordThe record to associate.

Definition at line 62 of file records.cpp.

◆ shutdown()

void alib::enumrecords::detail::shutdown ( )

Frees resources and shuts down module ALib EnumRecords. Multiple invocations of this method are forbidden. The standard bootstrap code of ALib, hence the (overloaded) functions alib::Shutdown will call this function.

Definition at line 237 of file recordparser.cpp.

Here is the call graph for this function: