[vtk-developers] itkTypeMacro vs itkTypeRevisionMacro
brad.king at kitware.com
Wed Jan 9 15:57:32 EST 2002
> Why was a new macro added (causing all files to be updated) rather
> than changing the behaviour of vtkTypeMacro to contain the new logic?
The new vtkTypeRevisionMacro adds the declaration
void CollectRevisions(ostream& os);
to every class using it. Since vtkObject::CollectRevisions is a virtual
function, the vtable of every class using this macro will attempt to find
the CollectRevisions method. This method is defined with a
vtkCxxRevisionMacro in the .cxx file (must be in .cxx).
If we had added the declaration to vtkTypeMacro, then every class in every
program or library using VTK would need to be updated to have a
vtkCxxRevisionMacro before it would compile and link. For example, every
class in GE-VTK would need to be updated before it would work again.
Making the change in a separate macro allows users to change to
vtkTypeRevisionMacro and add the vtkCxxRevisionMacro whenever they get
around to it.
We may want to edit the print-self tests to check VTK classes for use of
vtkTypeRevisionMacro. This will keep the main toolkit classes up-to-date.
More information about the vtk-developers