[vtk-developers] Three sweeping changes

Brad King brad.king at kitware.com
Fri Jan 4 09:46:17 EST 2002


Hello, all:

I have just commited three changes affecting nearly every file in
VTK.  Any new VTK classes should follow the pattern shown by these
changes:

1.)  vtkTypeRevisionMacro is now used in all VTK classes in place of
vtkTypeMacro.  It invokes the original vtkTypeMacro and then adds a
protected CollectRevisions method for future use in serialization. A
corresponding vtkCxxRevisionMacro has been added to every .cxx file to
implement the CollectRevisions method for each class.  This will allow
collection of every class revision at run time.  Any new VTK class should
use vtkTypeRevisionMacro instead of vtkTypeMacro.  The .cxx implementation
should then have the following line:
  vtkCxxRevisionMacro(vtkFoo, "$Revision: 1.1 $");
CVS should insert the correct revision number when the class is commited.

2.)  vtkTypeMacro now also adds a typedef called "Superclass" to refer to
the superclass of any VTK class.  All PrintSelf methods have been updated
to call their superclass's PrintSelf like this:
  this->Superclass::PrintSelf(os,indent);
This should reduce the number of places that refer to a superclass by its
actual name.

3.) The standard ::New() method implementation has been replaced with a
macro.  Instead of an explicitly written implementation to try the object
factory and then call the new operator, VTK classes should instead use the
following macro unless they have a special New() method:
  vtkStandardNewMacro(vtkFoo);
This will implement the New() method in the standard way.  The line should
appear in the .cxx implementation file, not in the header. Using the macro
will make it easier to change the standard implementation of the method.

The above change descriptions also appear in the commit log for the
change.

Everything compiles and runs on linux with gcc 2.93.3.  Hopefully any
errors that may be left on other platforms will be trivial to fix.  Sorry
for any inconvenience caused by such a large change, but it had to be made
at some point.

-Brad




More information about the vtk-developers mailing list