flatten 20260225
This commit is contained in:
43
tjp/core/singleton/Singleton.cpp
Executable file
43
tjp/core/singleton/Singleton.cpp
Executable file
@@ -0,0 +1,43 @@
|
||||
// TJP COPYRIGHT HEADER
|
||||
|
||||
/**
|
||||
* legal header
|
||||
*
|
||||
* ============================================================================
|
||||
* TJP 10/11/01 Got rid of the constructed singleton, it was essentially
|
||||
* a pointer!
|
||||
*
|
||||
* @author Timothy Prepscius
|
||||
* @created 3/../01
|
||||
*/
|
||||
|
||||
#include "Singleton.hpp"
|
||||
|
||||
namespace timprepscius {
|
||||
namespace core {
|
||||
|
||||
Singletons::Singletons_ &Singletons::singletons()
|
||||
{
|
||||
static Singletons_ *v = new Singletons_();
|
||||
return *v;
|
||||
}
|
||||
|
||||
void Singletons::clearAll ()
|
||||
{
|
||||
for (auto *singleton : singletons())
|
||||
singleton->clear();
|
||||
}
|
||||
|
||||
Singleton_::Singleton_ ()
|
||||
{
|
||||
Singletons::singletons().insert(this);
|
||||
}
|
||||
|
||||
Singleton_::~Singleton_ ()
|
||||
{
|
||||
Singletons::singletons().erase(this);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user