Skip to content

Commit

Permalink
STYLE: ITK_FUTURE_LEGACY_REMOVE itkTypeMacro and itkTypeMacroNoParent
Browse files Browse the repository at this point in the history
Deprecated `itkTypeMacro` and `itkTypeMacroNoParent`, in favor of
`itkOverrideGetNameOfClassMacro` and `itkVirtualGetNameOfClassMacro`, respectively.
  • Loading branch information
N-Dekker authored and hjmjohnson committed Dec 26, 2023
1 parent 2c264ea commit 36e9549
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Modules/Core/Common/include/itkMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,24 @@ namespace itk
const char * GetNameOfClass() const override { return #thisClass; } \
ITK_MACROEND_NOOP_STATEMENT

/** Macro used to add standard methods to all classes, mainly type information. */
#define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
#define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
#ifdef ITK_FUTURE_LEGACY_REMOVE
# define itkTypeMacro(thisClass, superclass) \
static_assert(false, \
"In a future revision of ITK, the macro `itkTypeMacro(thisClass, superclass)` will be removed. " \
"Please call `itkOverrideGetNameOfClassMacro(thisClass)` instead!")
# define itkTypeMacroNoParent(thisClass) \
static_assert(false, \
"In a future revision of ITK, the macro `itkTypeMacroNoParent(thisClass)` will be removed. " \
"Please call `itkVirtualGetNameOfClassMacro(thisClass)` instead!")
#else
/** Legacy macro's to add or override a `GetNameOfClass()` member function.
* \deprecated Instead of `itkTypeMacro`, it is preferred to call `itkOverrideGetNameOfClassMacro` (without `superclass`
* argument). Instead of `itkTypeMacroNoParent`, it is preferred to call `itkVirtualGetNameOfClassMacro`.
*/
# define itkTypeMacro(thisClass, superclass) itkOverrideGetNameOfClassMacro(thisClass)
# define itkTypeMacroNoParent(thisClass) itkVirtualGetNameOfClassMacro(thisClass)
#endif


namespace itk
{
Expand Down

0 comments on commit 36e9549

Please sign in to comment.