MIRA
|
A singleton template class that can be freely configured using policies that control the instantiation, creation, lifetime and thread-safety. More...
#include <utils/Singleton.h>
Public Types | |
typedef Base::Type | Type |
Static Public Member Functions | |
static Type & | instance () |
Returns a reference to the singleton instance. More... | |
static bool | isDestroyed () |
Returns true, if the singleton was already destroyed. More... | |
A singleton template class that can be freely configured using policies that control the instantiation, creation, lifetime and thread-safety.
Using this template class you can create singletons that meet all your needs by specifying different combination of policies as template parameters.
Instantiation Policies:
Creation Policies:
Lifetime Policies:
Lock Policies:
Example Usage:
For convenience some of commonly used policy combinations are provided by
typedef Base::Type Type |
|
inlinestatic |
Returns a reference to the singleton instance.
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
|
inlinestatic |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.