ODIN
|
#include <tjhandler.h>
Public Member Functions | |
void | init (const char *unique_label) |
void | destroy () |
void | copy (T &destination) const |
T * | unlocked_ptr () |
LockProxy< T > | operator-> () |
const T * | operator-> () const |
operator bool () const | |
Template class to manage singleton objects of type T, i.e. those objects which are exist only once in the program. The instantiation must be a static field of of a certain class. The init/destroy member functions are used to create/destroy the singleton. If 'thread_safe' is set to 'true', use a mutex to manage multi-threaded access to the singleton object.
Its main purpose is to share singletons across DLL boundaries on Windows and/or thread-safe access to global resources. This class has an pointer-to-T-like interface.
Definition at line 166 of file tjhandler.h.
void SingletonHandler< T, thread_safe >::copy | ( | T & | destination | ) | const |
Copies this to 'destination'
Definition at line 127 of file tjhandler_code.h.
void SingletonHandler< T, thread_safe >::destroy |
Deletes the singleton
Definition at line 120 of file tjhandler_code.h.
void SingletonHandler< T, thread_safe >::init | ( | const char * | unique_label | ) |
Initialize the singleton with the unique identifier 'unique_label'. The singleton object will be allocated if it does not already exist somewhere in the program.
Definition at line 104 of file tjhandler_code.h.
|
inline |
Returns whether singleton is already initialized
Definition at line 214 of file tjhandler.h.
|
inline |
Returns mutex-locked pointer to handled singleton
Definition at line 204 of file tjhandler.h.
|
inline |
Returns read-only pointer to handled singleton
Definition at line 209 of file tjhandler.h.
|
inline |
Returns unlocked ptr to object (know what you are doing)
Definition at line 196 of file tjhandler.h.