[vtk-developers] Stop using vtkSetObjectMacro

Andy Cedilnik andy.cedilnik at kitware.com
Tue May 7 14:54:54 EDT 2002


Hello!

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)
this:
	virtual void SetName(vtkBar*);

And put this to the .cxx file:

vtkCxxSetObjectMacro(vtkFoo, Name, vtkBar);

Also, make sure to replace:
#include "vtkBar.h"
with 
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
them.

			Andy Cedilnik






More information about the vtk-developers mailing list