Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel > Class Template Reference

#include <Singleton.h>

List of all members.

Static Public Member Functions

static T & instance ()
 Provide access to the singleton instance.

Private Member Functions

Singletonoperator= (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.

Detailed Description

template<class T, template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
class icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >

A generic, policy-based singleton.

Parameters:
TThe class for which to maintain a singleton instance.
TCreationPolicyA policy for creating the instance, to allow for different allocators.
See also:
SingletonCreationPolicies.h
Parameters:
TLifetimePolicyA policy for managing the instance's lifetime, to control whether, when and how to destroy the instance.
See also:
SingletonLifetimePolicies.h
Parameters:
TThreadingModelA 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.
See also:
SingletonThreadingModels.h

Definition at line 55 of file Singleton.h.


Constructor & Destructor Documentation

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::Singleton ( ) [private]

Forbid creation.

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::~Singleton ( ) [private]

Forbid deletion.

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::Singleton ( const Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel > &  ) [private]

Forbid copy-construction.


Member Function Documentation

template<class T , template< class > class TCreationPolicy, template< class > class TLifetimePolicy, template< class > class TThreadingModel>
void icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::destroySingleton ( ) [static, private]

Helper for destroying the instance.

Definition at line 64 of file Singleton.hpp.

template<class T , template< class > class TCreationPolicy, template< class > class TLifetimePolicy, template< class > class TThreadingModel>
T & icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::instance ( ) [static]

Provide access to the singleton instance.

Definition at line 37 of file Singleton.hpp.

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
Singleton& icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::operator= ( const Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel > &  ) [private]

Forbid assignment.


Member Data Documentation

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
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.

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
T * icl_core::Singleton< T, TCreationPolicy, TLifetimePolicy, TThreadingModel >::m_instance = NULL [static, private]

The singleton instance.

Definition at line 74 of file Singleton.h.

template<class T , template< class > class TCreationPolicy = SCPCreateUsingNew, template< class > class TLifetimePolicy = SLPDefaultLifetime, template< class > class TThreadingModel = STMSingleThreaded>
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.


The documentation for this class was generated from the following files:


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:26