TuttleOFX  1
Singleton< T > Class Template Reference

Singleton<ClassSingleton> Can transform a class into Singleton (by inheriting this class) More...

#include <Singleton.hpp>

Inheritance diagram for Singleton< T >:
Collaboration diagram for Singleton< T >:

Static Public Member Functions

static T & instance ()
 return the unique instance of Singleton<T> class
static void destroy ()
 destroy the unique instance of Singleton<T> class

Protected Member Functions

 Singleton ()
virtual ~Singleton ()=0

Private Member Functions

 Singleton (const Singleton &)
Singletonoperator= (const Singleton &)

Static Private Attributes

static T * inst = NULL

Detailed Description

template<class T>
class Singleton< T >

Singleton<ClassSingleton> Can transform a class into Singleton (by inheriting this class)

Purpose
Forcing (limit) the presence of a single instance of a class
Usage
The class T, to use as Singleton, must derive from this class (: public Singleton <T>). The macro MAKE_SINGLETON (T) create necessary elements (including constructors).

Definition at line 15 of file Singleton.hpp.


Constructor & Destructor Documentation

template<class T>
Singleton< T >::Singleton ( const Singleton< T > &  ) [inline, private]

Definition at line 20 of file Singleton.hpp.

template<class T>
Singleton< T >::Singleton ( ) [inline, protected]

Definition at line 24 of file Singleton.hpp.

template<class T >
Singleton< T >::~Singleton ( ) [protected, pure virtual]

Definition at line 54 of file Singleton.hpp.


Member Function Documentation

template<class T>
static void Singleton< T >::destroy ( ) [inline, static]

destroy the unique instance of Singleton<T> class

Definition at line 42 of file Singleton.hpp.

template<class T>
static T& Singleton< T >::instance ( ) [inline, static]

return the unique instance of Singleton<T> class

Returns:
T the unique instance of Singleton<T> class

Definition at line 32 of file Singleton.hpp.

Referenced by tuttle::host::core().

template<class T>
Singleton& Singleton< T >::operator= ( const Singleton< T > &  ) [inline, private]

Definition at line 21 of file Singleton.hpp.


Field Documentation

template<class T>
T * Singleton< T >::inst = NULL [static, private]

Definition at line 18 of file Singleton.hpp.

Referenced by Singleton< Core >::destroy(), and Singleton< Core >::instance().


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