diff options
Diffstat (limited to 'src/leeds/base/singletonManager.cpp')
-rw-r--r-- | src/leeds/base/singletonManager.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/leeds/base/singletonManager.cpp b/src/leeds/base/singletonManager.cpp new file mode 100644 index 00000000..9ff9f28c --- /dev/null +++ b/src/leeds/base/singletonManager.cpp @@ -0,0 +1,36 @@ +#include "common.h" + +#include "singletonManager.h" + +namespace base +{ + +cSingletonManager& SingletonManager() +{ + static cSingletonManager manager; + return manager; +} + +cSingletonManager::~cSingletonManager() +{ + Purge(); +} + +void cSingletonManager::Add(cSingletonBase* node) +{ + node->next = head; + if (!head) + tail = node; + head = node; +} + +void cSingletonManager::Purge() +{ + for (cSingletonBase* node = tail; node; node = tail) { + tail = node->next; + delete node; + } +} + + +}
\ No newline at end of file |