This is the namespace of ALib Module "Singletons". Please refer to the Programmer's Manual Of ALib Singletons for information about using this (single :-) Singleton class in this tiny namespace.
Classes | |
class | Singleton |
Functions | |
ALIB_API HashMap< TypeFunctors::Key, void *, TypeFunctors::Hash, TypeFunctors::EqualTo > & | DbgGetSingletons () |
ALIB_API int | DbgGetSingletons (NAString &target) |
void | Shutdown () |
HashMap< TypeFunctors::Key, void *, TypeFunctors::Hash, TypeFunctors::EqualTo > & DbgGetSingletons | ( | ) |
This debug helper function returns a type map with void pointers to all singletons.
The function may be used to investigate which singleton objects are created within a process and the point in (run-) time of creation.
std::unordered_map<TypeKey, void*>&
.Definition at line 187 of file singleton.cpp.
int DbgGetSingletons | ( | NAString & | target | ) |
This debug function writes all type names and addresses of each currently defined instance of class Singleton into the given AString.
true
.The method included with alib/singletons/dbgsingletons.hpp.
std::type_info
structs together with (void-) pointers to the singletons.target | The target string to write the list of singletons to. |
Definition at line 195 of file singleton.cpp.
ALIB_API void Shutdown | ( | ) |
Deletes the singletons. Upon exit of the process, programmers might want to explicitly free the hash table to avoid the detection of memory leaks by metrics tools like Valgrind . (Otherwise this can be omitted, as the memory is cleaned by the OS probably much faster when a process exits).
When using singletons with the full implementation of ALib (in contrast in using just the module ALib Singleton), then method Module::Shutdown invokes this method already.
Definition at line 168 of file singleton.cpp.