itkTypeMacro


(Francois Budin) #1

Looking into the itkMacro.h file, I was surprised to discover that the macro called itkTypeMacro which takes as arguments the name of the class and the name of the superclass actually do not do anything with the name of the superclass. I looked at the history of the file, as far back as what github supports (I did not check past that point on my computer with git) and the superclass name has never been used. A new macro was added at some point for classes that do not have parents (itkTypeMacroNoParent) but I don’t see why that new macro is necessary since the original macro doesn’t use the parent class name anyway. Could anyone explain why the macro itkTypeMacro take the superclass name as an argument then?


(Bradley Lowekamp) #2

Likely just following the vtkTypeMacro as much of the original ITK infrastructure was based on VTK.


(Pablo Hernandez-Cerdan) #3

Yeah I was surprised too! But it is because they have different qualifiers.

The one with parent is of type:

const char *GetNameOfClass() const override

The NoParent

virtual const char *GetNameOfClass() const

The parent name itself is unused though.