[vtk-developers] Removing include files

Brad King brad.king at kitware.com
Tue Nov 26 15:31:21 EST 2002


Jim,

> I understand it in general.  But if my program is not explictly creating
> or calling a method on an ImageData, why should I have to include the
> header?

The reason you had to add the includes was because the SetInput method
takes a pointer to a superclass of vtkImageData (probably vtkDataSet).
With only the forward declaration of vtkImageData, there is no way the
compiler knows about the inheritance relationship.  It cannot perform the
upcast until you've included vtkImageData.h.

As for the design decision to not automatically include the header, I have
no comment.  However, all we have to do is provide the SetInput overloads
to take the vtkImageData pointer and then the compiler won't need the
class at all.  I don't know if we want to make a change like this, though,
because it may get into problems with hiding the SetInput from the
filter's superclass.  Compilers often complain about name hiding virtual
functions.

-Brad




More information about the vtk-developers mailing list