NLMISC::CSingleton< T > Class Template Reference

#include <singelton.h>

template<class T>
class NLMISC::CSingleton< T >


Static Public Member Functions

T & getInstance ()

Protected Member Functions

 CSingleton ()
 no public ctor to be sure that the user can't create an object


Static Protected Attributes

T * Instance = 0

Constructor & Destructor Documentation

template<class T>
NLMISC::CSingleton< T >::CSingleton  )  [inline, protected]
 

no public ctor to be sure that the user can't create an object

Definition at line 74 of file singelton.h.

00075         {
00076         }


Member Function Documentation

template<class T>
T& NLMISC::CSingleton< T >::getInstance  )  [inline, static]
 

returns a reference and not a pointer to be sure that the user doesn't have to test the return value and can directly access the class

Definition at line 61 of file singelton.h.

References nlassert.

00062         {
00063                 if(!Instance)
00064                 {
00065                         Instance = new T;
00066                         nlassert(Instance);
00067                 }
00068                 return *Instance;
00069         }


Field Documentation

template<class T>
T * NLMISC::CSingleton< T >::Instance = 0 [static, protected]
 

Definition at line 82 of file singelton.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 13:33:24 2004 for NeL by doxygen 1.3.6