diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-08-30 09:58:57 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-08-30 10:44:11 +0200 |
commit | b67a08744849c2d0912ac818de92b752ee563e19 (patch) | |
tree | 5089e481f2d5f318b381e7626c2e43c3403881de | |
parent | Merge remote-tracking branch 'upstream/lcs' into lcs (diff) | |
download | re3-b67a08744849c2d0912ac818de92b752ee563e19.tar re3-b67a08744849c2d0912ac818de92b752ee563e19.tar.gz re3-b67a08744849c2d0912ac818de92b752ee563e19.tar.bz2 re3-b67a08744849c2d0912ac818de92b752ee563e19.tar.lz re3-b67a08744849c2d0912ac818de92b752ee563e19.tar.xz re3-b67a08744849c2d0912ac818de92b752ee563e19.tar.zst re3-b67a08744849c2d0912ac818de92b752ee563e19.zip |
-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 |