File: instance.cc

package info (click to toggle)
xgalaga%2B%2B 0.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 376 kB
  • sloc: cpp: 2,785; makefile: 242
file content (32 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (5)
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);
}