28 #ifndef BERSERK_SINGLETON_HPP
29 #define BERSERK_SINGLETON_HPP
46 template<
typename TInstance>
51 return mInstancePointer;
56 return *mInstancePointer;
61 static void Provide(TInstance *reference) {
62 if (mInstancePointer ==
nullptr) {
63 mInstancePointer = reference;
68 static void Remove(TInstance *reference) {
69 if (mInstancePointer == reference) {
70 mInstancePointer =
nullptr;
75 static TInstance *mInstancePointer;
78 template<
typename TInstance>
#define BRK_NS_END
Definition: Config.hpp:48
Singleton class.
Definition: Singleton.hpp:47
static void Provide(TInstance *reference)
Definition: Singleton.hpp:61
static TInstance & Instance()
Definition: Singleton.hpp:55
static TInstance * InstancePointer()
Definition: Singleton.hpp:50
static void Remove(TInstance *reference)
Definition: Singleton.hpp:68
Definition: GLDevice.cpp:46