18 #ifndef itkSingleton_h
19 #define itkSingleton_h
49 typedef std::map<std::string, std::tuple<void*, std::function<void(void*)>, std::function<void(void)> > >
SingletonData;
55 {
return static_cast<T*
>(this->GetGlobalInstancePrivate(globalName)); }
63 bool SetGlobalInstance(
const char * globalName, T * global, std::function<
void(
void*)> func, std::function<
void(
void)> deleteFunc)
64 {
return this->SetGlobalInstancePrivate(globalName, global, func, deleteFunc);}
68 static Self* GetInstance();
81 void * GetGlobalInstancePrivate(
const char *globalName );
84 bool SetGlobalInstancePrivate(
const char * globalName,
void * global, std::function<
void(
void*)> func, std::function<
void(
void)> deleteFunc);
98 T*
Singleton(
const char *globalName, std::function<
void(
void*)> func, std::function<
void(
void)> deleteFunc)
103 if( instance ==
nullptr )
void Unused(const T &)
A function which does nothing.
static Self * GetInstance()
T * Singleton(const char *globalName, std::function< void(void *)> func, std::function< void(void)> deleteFunc)
SingletonData m_GlobalObjects
std::map< std::string, std::tuple< void *, std::function< void(void *)>, std::function< void(void)> > > SingletonData
T * GetGlobalInstance(const char *globalName)
bool SetGlobalInstance(const char *globalName, T *global, std::function< void(void *)> func, std::function< void(void)> deleteFunc)