Files
core_misc/tjp/core/singleton/Singleton.cpp
Timothy Prepscius fa54be052a flatten 20260225
2026-02-25 12:39:24 -05:00

44 lines
723 B
C++
Executable File

// 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