ITK  5.0.0
Insight Segmentation and Registration 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

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

Definition at line 34 of file itkSingletonMacro.h.

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

Definition at line 43 of file itkSingletonMacro.h.

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

Definition at line 37 of file itkSingletonMacro.h.

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

Definition at line 40 of file itkSingletonMacro.h.

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

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.