18 #ifndef itkSingleton_h
19 #define itkSingleton_h
51 #ifndef ITK_LEGACY_REMOVE
52 using SingletonData [[deprecated(
"The internal representation of the singleton data is private, and may not "
53 "correspond with SingletonData anymore.")]] =
54 std::map<std::string, std::tuple<
void *, std::function<void(
void *)>, std::function<void()>>>;
63 return static_cast<T *>(this->GetGlobalInstancePrivate(globalName));
73 this->SetGlobalInstancePrivate(globalName, global, deleteFunc);
76 #ifndef ITK_FUTURE_LEGACY_REMOVE
78 [[deprecated(
"Prefer calling the SetGlobalInstance(globalName, global, deleteFunc) overload (without the unused func "
80 SetGlobalInstance(
const char * globalName,
82 std::function<
void(
void *)> itkNotUsed(func),
83 std::function<
void()> deleteFunc)
85 this->SetGlobalInstance(globalName, global, deleteFunc);
96 SetInstance(
Self * instance);
108 GetGlobalInstancePrivate(
const char * globalName);
112 SetGlobalInstancePrivate(
const char * globalName,
void * global, std::function<
void()> deleteFunc);
126 template <
typename T>
128 Singleton(
const char * globalName, std::function<
void()> deleteFunc)
133 if (instance ==
nullptr)
142 #ifndef ITK_FUTURE_LEGACY_REMOVE
143 template <
typename T>
144 [[deprecated(
"Prefer calling the Singleton(globalName, deleteFunc) overload (without the unused func parameter)!")]] T *
145 Singleton(
const char * globalName, std::function<
void(
void *)> itkNotUsed(func), std::function<
void()> deleteFunc)
147 return Singleton<T>(globalName, deleteFunc);