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 () |
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.
rtti | The enumeration type. |
integral | The integral value of the enum element. |
nullptr
if not found. Definition at line 71 of file records.cpp.
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.
std::unordered_map
.Definition at line 89 of file records.cpp.
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.
rtti | The enumeration type. |
integral | The integral value of the enum element. |
record | The record to associate. |
Definition at line 62 of file records.cpp.
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.