1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include "instance.h"
InstancesManager * InstancesManager::singleton_ (0);
InstancesManager & InstancesManager::Instance()
{
if (!singleton_) singleton_ = new InstancesManager;
return *singleton_;
}
void InstancesManager::DestroyInstance()
{
delete singleton_;
singleton_ = 0;
}
InstancesManager::~InstancesManager() {
while (!destroy_funcs_.empty()) {
destroy_funcs_.top()();
destroy_funcs_.pop();
}
}
void InstancesManager::Push(void(*pf)())
{
destroy_funcs_.push(pf);
}
|