FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::DynamicSingleton< T > Class Template Reference

Another Singleton. More...

#include <singleton.h>

+ Inheritance diagram for FIFE::DynamicSingleton< T >:
+ Collaboration diagram for FIFE::DynamicSingleton< T >:

Public Member Functions

 DynamicSingleton ()
 
virtual ~DynamicSingleton ()
 

Static Public Member Functions

static T * instance ()
 

Private Member Functions

 DynamicSingleton (const DynamicSingleton< T > &)
 
DynamicSingleton< T & > operator= (const DynamicSingleton< T > &)
 

Static Private Attributes

static T * m_instance = 0
 

Detailed Description

template<typename T>
class FIFE::DynamicSingleton< T >

Another Singleton.

This implementations needs to be created and destroyed explicitly. That way the order of construction and destruction is well defined, so we don't get those nasty static initialization/destruction order problems.

Engine will create all standard FIFE Singletons when created (just call Engine::instance()) and destroy them on exit.

Maybe we'll change this one day to use one of those funny NiftyCounter implementations.

See also
StaticSingleton
Engine

Definition at line 82 of file singleton.h.

Constructor & Destructor Documentation

◆ DynamicSingleton() [1/2]

template<typename T>
FIFE::DynamicSingleton< T >::DynamicSingleton ( )
inline

Definition at line 89 of file singleton.h.

◆ ~DynamicSingleton()

template<typename T>
virtual FIFE::DynamicSingleton< T >::~DynamicSingleton ( )
inlinevirtual

Definition at line 94 of file singleton.h.

◆ DynamicSingleton() [2/2]

template<typename T>
FIFE::DynamicSingleton< T >::DynamicSingleton ( const DynamicSingleton< T > &  )
inlineprivate

Definition at line 101 of file singleton.h.

Member Function Documentation

◆ instance()

template<typename T>
static T* FIFE::DynamicSingleton< T >::instance ( )
inlinestatic

Definition at line 84 of file singleton.h.

◆ operator=()

template<typename T>
DynamicSingleton<T&> FIFE::DynamicSingleton< T >::operator= ( const DynamicSingleton< T > &  )
inlineprivate

Definition at line 102 of file singleton.h.

Member Data Documentation

◆ m_instance

template<typename T>
T * FIFE::DynamicSingleton< T >::m_instance = 0
staticprivate

Definition at line 99 of file singleton.h.


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