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