#include <Singleton.h>
Static Public Member Functions | |
static T & | instance () |
Provide access to the singleton instance. | |
Private Member Functions | |
Singleton & | operator= (const Singleton &) |
Forbid assignment. | |
Singleton () | |
Forbid creation. | |
Singleton (const Singleton &) | |
Forbid copy-construction. | |
~Singleton () | |
Forbid deletion. | |
Static Private Member Functions | |
static void | destroySingleton () |
Helper for destroying the instance. | |
Static Private Attributes | |
static bool | m_destroyed = false |
Indicates whether the instance has been destroyed. | |
static T * | m_instance = NULL |
The singleton instance. | |
static TThreadingModel< T >::Lock | m_lock |
The lock for synchronizing instantiation. Must be default-constructable. |
A generic, policy-based singleton.
T | The class for which to maintain a singleton instance. |
TCreationPolicy | A policy for creating the instance, to allow for different allocators. |
TLifetimePolicy | A policy for managing the instance's lifetime, to control whether, when and how to destroy the instance. |
TThreadingModel | A policy for managing thread safety. The standard model provided in icl_core is for single-threaded use only. Thread-safe implementations can be found in icl_core_logging and icl_core_thread. |
Definition at line 55 of file Singleton.h.
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::Singleton | ( | ) | [private] |
Forbid creation.
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::~Singleton | ( | ) | [private] |
Forbid deletion.
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::Singleton | ( | const Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel > & | ) | [private] |
Forbid copy-construction.
void icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::destroySingleton | ( | ) | [static, private] |
Helper for destroying the instance.
Definition at line 64 of file Singleton.hpp.
T & icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::instance | ( | ) | [static] |
Provide access to the singleton instance.
Definition at line 37 of file Singleton.hpp.
Singleton& icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::operator= | ( | const Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel > & | ) | [private] |
Forbid assignment.
bool icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::m_destroyed = false [static, private] |
Indicates whether the instance has been destroyed.
Definition at line 76 of file Singleton.h.
T * icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::m_instance = NULL [static, private] |
The singleton instance.
Definition at line 74 of file Singleton.h.
TThreadingModel< T >::Lock icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::m_lock [static, private] |
The lock for synchronizing instantiation. Must be default-constructable.
Definition at line 78 of file Singleton.h.