[vtk-developers] Stop using vtkSetObjectMacro

Lorensen, William E (Research) lorensen at crd.ge.com
Tue May 7 15:38:24 EDT 2002

No. Please do not remove it! We have dozens of classes that are not checked into the repository in
various projects. Whatever you do, make sure there is still backwards compatibility.


-----Original Message-----
From: Andy Cedilnik [mailto:andy.cedilnik at kitware.com]
Sent: Tuesday, May 07, 2002 2:55 PM
To: vtk-developers
Subject: [vtk-developers] Stop using vtkSetObjectMacro


Does anybody have any problems with stop using vtkSetObjectMacro?

Here is the rationale:

vktSetObjectMacro needs header file of the argument class to be
included, which makes pre-processed files bigger and compiling slower.
Also in case of Visual Studio .NET it makes it fail to compile VTK on
some computers. By using vtkCxxSetObjectMacro you get the exactly same
functionality but you do it in the .cxx file instead of .h file. 

To use it in class vtkFoo, put instead of:
	vtkSetObjectMacro(Name, vtkBar)
	virtual void SetName(vtkBar*);

And put this to the .cxx file:

vtkCxxSetObjectMacro(vtkFoo, Name, vtkBar);

Also, make sure to replace:
#include "vtkBar.h"
class vtkBar;

and put the include in .cxx file.

I will make a test which will check all files for vtkSetObjectMacro and
it will fail if it finds it. This way, we will be able to track all of

			Andy Cedilnik

vtk-developers mailing list
vtk-developers at public.kitware.com

More information about the vtk-developers mailing list