TuttleOFX  1
StaticSingleton< T > Class Template Reference

StaticSingleton<ClassStaticSingleton> Can transform a class into static Singleton (by inheriting this class) More...

#include <StaticSingleton.hpp>

Static Public Member Functions

static T & instance ()
 return the unique instance of StaticSingleton<T> class

Protected Member Functions

 StaticSingleton ()
virtual ~StaticSingleton ()=0

Private Member Functions

 StaticSingleton (const StaticSingleton &)
StaticSingletonoperator= (const StaticSingleton &)

Static Private Attributes

static T inst

Detailed Description

template<class T>
class StaticSingleton< T >

StaticSingleton<ClassStaticSingleton> Can transform a class into static Singleton (by inheriting this class)

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

Definition at line 15 of file StaticSingleton.hpp.


Constructor & Destructor Documentation

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

Definition at line 21 of file StaticSingleton.hpp.

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

Definition at line 25 of file StaticSingleton.hpp.

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

Definition at line 43 of file StaticSingleton.hpp.


Member Function Documentation

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

return the unique instance of StaticSingleton<T> class

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

Definition at line 33 of file StaticSingleton.hpp.

References StaticSingleton< T >::inst.

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

Definition at line 22 of file StaticSingleton.hpp.


Field Documentation

template<class T >
T StaticSingleton< T >::inst [static, private]

Definition at line 18 of file StaticSingleton.hpp.

Referenced by StaticSingleton< T >::instance().


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