ITK  5.4.0
Insight Toolkit
Macros
itkSingletonMacro.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define itkGetGlobalDeclarationMacro(Type, VarName)   static Type * Get##VarName##Pointer()
 
#define itkGetGlobalInitializeMacro(Class, Type, VarName, SingletonName, Init)
 
#define itkGetGlobalSimpleMacro(Class, Type, Name)   itkGetGlobalInitializeMacro(Class, Type, Name, Class, (void)0)
 
#define itkGetGlobalValueMacro(Class, Type, Name, Value)   itkGetGlobalInitializeMacro(Class, Type, Name, Name, *m_##Name = Value)
 
#define itkInitGlobalsMacro(VarName)
 

Macro Definition Documentation

◆ itkGetGlobalDeclarationMacro

#define itkGetGlobalDeclarationMacro (   Type,
  VarName 
)    static Type * Get##VarName##Pointer()

Definition at line 35 of file itkSingletonMacro.h.

◆ itkGetGlobalInitializeMacro

#define itkGetGlobalInitializeMacro (   Class,
  Type,
  VarName,
  SingletonName,
  Init 
)
Value:
Type * Class::Get##VarName##Pointer() \
{ \
if (m_##VarName == nullptr) \
{ \
const auto deleteLambda = []() { \
delete m_##VarName; \
m_##VarName = nullptr; \
}; \
auto * old_instance = SingletonIndex::GetInstance()->GetGlobalInstance<Type>(#SingletonName); \
m_##VarName = Singleton<Type>(#SingletonName, deleteLambda); \
if (old_instance == nullptr) \
{ \
Init; \
} \
} \
return m_##VarName; \
} \
ITK_MACROEND_NOOP_STATEMENT

Definition at line 42 of file itkSingletonMacro.h.

◆ itkGetGlobalSimpleMacro

#define itkGetGlobalSimpleMacro (   Class,
  Type,
  Name 
)    itkGetGlobalInitializeMacro(Class, Type, Name, Class, (void)0)

Definition at line 37 of file itkSingletonMacro.h.

◆ itkGetGlobalValueMacro

#define itkGetGlobalValueMacro (   Class,
  Type,
  Name,
  Value 
)    itkGetGlobalInitializeMacro(Class, Type, Name, Name, *m_##Name = Value)

Definition at line 39 of file itkSingletonMacro.h.

◆ itkInitGlobalsMacro

#define itkInitGlobalsMacro (   VarName)
Value:
{ \
static auto * staticGlobals = Get##VarName##Pointer(); \
(void)staticGlobals; \
} \
ITK_MACROEND_NOOP_STATEMENT

itkSingletonMacro.h defines macros that are used to declare and define global variables across ITK with a global map that is used to synchronize this variables across multiple instantiations of ITK if necessary. Note: this is rarely necessary.

Definition at line 28 of file itkSingletonMacro.h.

Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93