Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::Singleton< T > Class Template Reference
[Utilities]

This template class pattern provides a traditional Singleton pattern (see GoF). Allows you to designate a single-instance global class by inheriting off of the template class. More...

#include <Singleton.hh>

List of all members.

Static Public Methods

T * instance ()

Protected Methods

 Singleton ()
 Singleton (T *pInstance)
 Singleton (const Singleton &)
 Not implemented by design.

Singleton & operator= (const Singleton &)
 Not implemented by design.

 ~Singleton ()

Static Protected Methods

T *& getInstance ()
 The instance.

void release ()

Static Private Attributes

T * s_Instance


Detailed Description

template<typename T>
class IDEA::Singleton< T >

This template class pattern provides a traditional Singleton pattern (see GoF). Allows you to designate a single-instance global class by inheriting off of the template class.

class MyClass: public Singleton<MyClass> ...

The class will need to provide either a public or a protected friend constructor:

friend class Singleton<MyClass>;

This implementation is not thread safe.


Constructor & Destructor Documentation

template<typename T>
IDEA::Singleton< T >::Singleton   [inline, protected]
 

template<typename T>
IDEA::Singleton< T >::Singleton T *    pInstance [inline, protected]
 

template<typename T>
IDEA::Singleton< T >::Singleton const Singleton< T > &    [protected]
 

Not implemented by design.

template<typename T>
IDEA::Singleton< T >::~Singleton   [inline, protected]
 


Member Function Documentation

template<typename T>
T*& IDEA::Singleton< T >::getInstance   [inline, static, protected]
 

The instance.

This pattern is used to prevent "static initialization order fiasco" (Google this for better understanding)

template<typename T>
T* IDEA::Singleton< T >::instance   [inline, static]
 

template<typename T>
Singleton& IDEA::Singleton< T >::operator= const Singleton< T > &    [protected]
 

Not implemented by design.

template<typename T>
void IDEA::Singleton< T >::release   [inline, static, protected]
 


Member Data Documentation

template<typename T>
T* IDEA::Singleton< T >::s_Instance [static, private]
 


Contact information
© IDEA
Generated on Fri Feb 3 17:09:49 2006 for IDEA.