diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/leeds/CustomSoundTrack.cpp | 1 | ||||
-rw-r--r-- | src/leeds/base/singletonManager.h | 40 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/leeds/CustomSoundTrack.cpp b/src/leeds/CustomSoundTrack.cpp index bcbfb82f..a71a66cc 100644 --- a/src/leeds/CustomSoundTrack.cpp +++ b/src/leeds/CustomSoundTrack.cpp @@ -4,6 +4,7 @@ // TODO - implement +template<> cCustomSoundTrack* base::cSingleton<cCustomSoundTrack>::mspInstance = nil; cCustomSoundTrack::cCustomSoundTrack() : diff --git a/src/leeds/base/singletonManager.h b/src/leeds/base/singletonManager.h index 833e178b..9c980bb2 100644 --- a/src/leeds/base/singletonManager.h +++ b/src/leeds/base/singletonManager.h @@ -5,6 +5,26 @@ namespace base { +class cSingletonBase; + +class cSingletonManager +{ + cSingletonBase* head; + cSingletonBase* tail; + +public: + cSingletonManager() : + head(nil), + tail(nil) + {} + + void Add(cSingletonBase*); + void Purge(); + ~cSingletonManager(); +}; + +cSingletonManager& SingletonManager(); + class cSingletonBase { friend class cSingletonManager; @@ -19,7 +39,7 @@ template<typename T> class cSingleton : public cSingletonBase { static T* mspInstance; - static void cSingleton<T>::CreateInstance() + static void CreateInstance() { mspInstance = new T(); SingletonManager().Add(mspInstance); @@ -39,22 +59,4 @@ public: } }; -class cSingletonManager -{ - cSingletonBase* head; - cSingletonBase* tail; - -public: - cSingletonManager() : - head(nil), - tail(nil) - {} - - void Add(cSingletonBase*); - void Purge(); - ~cSingletonManager(); -}; - -cSingletonManager& SingletonManager(); - }
\ No newline at end of file |