Singleton.h
Go to the documentation of this file.
00001 //SINGLETON:
00002 //                      Title:                  template Singleton
00003 //                      File:                           Singleton.h
00004 //
00005 //                      Function:               Singleton template for managing resources
00006 //
00007 //                      Author:                 Thomas Mörwald
00008 //                      Date:                           26.03.2009
00009 // ----------------------------------------------------------------------------
00010 
00011 #include <stdio.h>
00012 
00013 namespace Tracking{
00014 
00015 template <typename T>
00016 class Singleton
00017 {
00018 public:
00019         static T* GetInstance(){
00020                 if (!m_instance)
00021                         m_instance = new T ();
00022                 return m_instance;
00023         }
00024         virtual ~Singleton(){
00025                 m_instance = 0;
00026         }
00027 private:
00028         static T* m_instance;
00029 protected:
00030         Singleton() { }
00031 };
00032 
00033 template <typename T>
00034 T* Singleton <T>::m_instance = 0;
00035 
00036 }
00037 


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12