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

Singleton< T > Class Template Reference

#include <Singleton.h>

Inheritance diagram for Singleton< T >:

Inheritance graph
[legend]
Collaboration diagram for Singleton< T >:

Collaboration graph
[legend]
List of all members.

template<class T>
class Singleton< T >


Static Public Methods

T & getObj ()

Protected Methods

 Singleton ()

Static Protected Methods

void releaseObj ()
 should only be called by the class that inherits the Singleton functionality after the subclasses releases all its necessary resources


Static Private Attributes

T * m_pSingleton = 0

Constructor & Destructor Documentation

template<class T>
Singleton< T >::Singleton   [protected]
 

Definition at line 49 of file Singleton.h.

00049 { }


Member Function Documentation

template<class T>
T & Singleton< T >::getObj   [static]
 

Definition at line 55 of file Singleton.h.

References Singleton< T >::m_pSingleton, and T.

00056 {
00057   if( m_pSingleton == 0 )
00058   {
00059     m_pSingleton = new T;
00060     assert(m_pSingleton);
00061   }
00062   return *m_pSingleton;
00063 }

template<class T>
void Singleton< T >::releaseObj   [static, protected]
 

should only be called by the class that inherits the Singleton functionality after the subclasses releases all its necessary resources

Definition at line 66 of file Singleton.h.

References Singleton< T >::m_pSingleton.

00067 {
00068   delete m_pSingleton;
00069   m_pSingleton = 0;
00070 }


Member Data Documentation

template<class T>
T * Singleton< T >::m_pSingleton = 0 [static, private]
 

Definition at line 52 of file Singleton.h.

Referenced by Singleton< T >::getObj(), and Singleton< T >::releaseObj().


The documentation for this class was generated from the following file:
Generated on Wed Apr 23 05:52:14 2003 for Modern Warfare by doxygen1.3-rc2