summaryrefslogtreecommitdiffstats
path: root/lib/base/singleton.hpp
blob: 77511c09aa90dfd5614bb9e6d2804fa13e520f57 (plain)
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
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

#ifndef SINGLETON_H
#define SINGLETON_H

#include "base/i2-base.hpp"

namespace icinga
{

/**
 * A singleton.
 *
 * @ingroup base
 */
template<typename T>
class Singleton
{
public:
	static T *GetInstance()
	{
		static T instance;
		return &instance;
	}
};

}

#endif /* SINGLETON_H */