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.
Type Index: | |
class | Singleton |
Function Index: | |
ALIB_API HashMap< MonoAllocator, TypeFunctors::Key, void *, TypeFunctors::Hash, TypeFunctors::EqualTo, lang::Caching::Auto, Recycling::None > & | DbgGetSingletons () |
ALIB_API int | DbgGetSingletons (NAString &target) |
void | Shutdown () |
HashMap< MonoAllocator, TypeFunctors::Key, void *, TypeFunctors::Hash, TypeFunctors::EqualTo, lang::Caching::Auto, Recycling::None > & 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 179 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 187 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).
The standard bootstrap code of ALib, hence the (overloaded) functions alib::Shutdown will call this function.
Definition at line 149 of file singleton.cpp.