Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Singleton< T, INIT > Class Template Reference

#include <Singleton.h>

Static Public Member Functions

static T * getSingleton ()
 

Protected Member Functions

 ~Singleton ()
 
template<>
Audio::CodecRegistry_singletonInstance
 
template<>
Audio::SceneManager_singletonInstance
 
template<>
Audio::TemplateManager_singletonInstance
 

Static Protected Member Functions

static void initializeSingleton ()
 
static void deinitializeSingleton ()
 

Static Protected Attributes

static T * _singletonInstance
 

Detailed Description

template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
class Singleton< T, INIT >

Singleton template

Remarks
The default initialization functor can handle classes with a default constructor. If you require special initialization specify a different functor. The class is NOT threadsafe.
You must add an extern Singleton<T,INIT>::_singletonInstance in your class implementation or linking against derived classes will fail.

Definition at line 33 of file Singleton.h.

Constructor & Destructor Documentation

template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
Singleton< T, INIT >::~Singleton ( )
inlineprotected

Definition at line 52 of file Singleton.h.

53  {
54  if (_singletonInstance == this)
56  }

Member Function Documentation

template<>
Audio::SceneManager * Singleton< Audio::SceneManager >::_singletonInstance ( )
protected

Definition at line 24 of file SceneManager.cpp.

template<>
Audio::TemplateManager * Singleton< Audio::TemplateManager >::_singletonInstance ( )
protected

Definition at line 24 of file TemplateManager.cpp.

template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
static void Singleton< T, INIT >::deinitializeSingleton ( )
inlinestaticprotected

Definition at line 47 of file Singleton.h.

Referenced by Singleton< CodecRegistry >::~Singleton().

48  {
50  }
template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
static T* Singleton< T, INIT >::getSingleton ( )
inlinestatic

Definition at line 59 of file Singleton.h.

60  {
61  if (_singletonInstance == 0)
63  return _singletonInstance;
64  }
template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
static void Singleton< T, INIT >::initializeSingleton ( )
inlinestaticprotected

Definition at line 38 of file Singleton.h.

Referenced by Singleton< CodecRegistry >::getSingleton().

39  {
40  if (_singletonInstance != 0)
41  delete _singletonInstance;
42  //GCC 3.3 errors out if you do '(INIT())()'
43  INIT singletonConstructor;
44  _singletonInstance = singletonConstructor();
45  }

Member Data Documentation

template<typename T, typename INIT = InitializationFunctors::DefaultConstructor< T >>
T* Singleton< T, INIT >::_singletonInstance
staticprotected

Definition at line 36 of file Singleton.h.


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