Loading...
Searching...
No Matches
Go to the documentation of this file.
24#define __DeclareSingleton(type) \
26 thread_local static type * Singleton; \
27 static type * Instance() { n_assert(nullptr != Singleton); return Singleton; }; \
28 static bool HasInstance() { return nullptr != Singleton; }; \
31#define __DeclareInterfaceSingleton(type) \
33 static type * Singleton; \
34 static type * Instance() { n_assert(nullptr != Singleton); return Singleton; }; \
35 static bool HasInstance() { return nullptr != Singleton; }; \
38#define __ImplementSingleton(type) \
39 thread_local type * type::Singleton = nullptr;
41#define __ImplementInterfaceSingleton(type) \
42 type * type::Singleton = nullptr;
44#define __ConstructSingleton \
45 n_assert(nullptr == Singleton); Singleton = this;
47#define __ConstructInterfaceSingleton \
48 n_assert(nullptr == Singleton); Singleton = this;
50#define __DestructSingleton \
51 n_assert(Singleton); Singleton = nullptr;
53#define __DestructInterfaceSingleton \
54 n_assert(Singleton); Singleton = nullptr;