6 * This file contains the Singleton template.
13 extern bool g_shutdown
; /**< Whether we should allow calls to <code>Free</code>. */
16 * A template class that implements the Singleton pattern.
17 * Written on 08-23-2006 by Eran Ifrah.
18 * Many thanks for allowing the free use of this template!
20 template <class T
> class Singleton
22 static T
* ms_instance
; /**< The one instance of this class. */
25 * Static method to access the only pointer of this instance.
26 * @return a pointer to the only instance of this class
30 /** Release resources. */
34 /** Default constructor. */
41 template <class T
> T
* Singleton
<T
>::ms_instance
= 0;
43 template <class T
> Singleton
<T
>::Singleton()
47 template <class T
> Singleton
<T
>::~Singleton()
51 template <class T
> T
* Singleton
<T
>::Get()
56 ms_instance
= new T();
60 template <class T
> void Singleton
<T
>::Free()