[vtk-developers] Const get macro?

Karthik Krishnan karthik.krishnan at kitware.com
Sat Aug 15 09:16:00 EDT 2009


On Sat, Aug 15, 2009 at 8:56 AM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

>
> On Fri, Aug 14, 2009 at 11:38 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>
> @Bill, I have no idea about wrapping - so if someone sees a problem can you
> please take a look? Was there a reason that this const get method was omited
> in the first place?
>

As Bill already mentioned, VTK is not const correct. The library predates
const support in all compilers, I think.

There are issues with wrapping (some wrapped languages have no notion of
const). And VTK's wrapper is more arcane than ITK's swig based wrapper, its
going to choke on it.


>
> I am a bit confused about the ObjectMacros. In vtkSetGet.h, it says
> vtkSetObjectMacro should be used in the h file and vtkCxxSetObjectMacro
> shoulnd be used in the cxx file. But the comment for vtkCxxSetObjectMacro
> says you have to actually put
> virtual void Set"name"("type" *);
> in the header file... so then what would be the use of vtkSetObjectMacro?
> and why is there no vtkCxxGetObjectMacro?
>

virtual void Set#name(type*) in the header and vtkCxxSetObjectMacro in the
implementation file is the preferred way. It avoids the necessity of
including the "type.h" header from the class's header file. VTK uses forward
declarations in header files to improve build times.

vtkSetObjectMacro is there for Backward compatibility reasons and for some
unavoidable use cases.

--
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090815/60811b3b/attachment.html>


More information about the vtk-developers mailing list