- Main Page
- Classes
- Files

- File List
- File Members

# C:/Users/Public/AGS Final Folder/BFLETCHER D4010283/Source/Game/Source/TSingleton.h

Go to the documentation of this file.

    00001 #ifndef _TSINGLETON_H_
    00002 #define _TSINGLETON_H_
    00003
    00004 template <class T> class TSingleton
    00005 {
    00006         public:
    00007         TSingleton()
    00008         {
    00009         }
    00010
    00011         ~TSingleton()
    00012         {
    00013         }
    00014
    00015         static T* getSingleton()
    00016         {
    00017                 if(!m_pInstance)
    00018                         m_pInstance = new T;
    00019                 return m_pInstance;
    00020         }
    00021
    00022         static void deleteSingleton()
    00023         {
    00024                 delete m_pInstance;
    00025                 m_pInstance = 0;
    00026         }
    00027
    00028         protected:
    00029         static T *m_pInstance;
    00030 };
    00031
    00032 #endif