[vtkusers] What is vtkCxxSetObjectMacro
David Doria
daviddoria at gmail.com
Fri Dec 9 07:00:14 EST 2011
On Fri, Dec 9, 2011 at 6:24 AM, Wenlong Wang <scc.wwl at gmail.com> wrote:
> Dear all,
>
> I'm trying to set a vtkPoints to my polydata. Here is what I do.
>
> polydata->SetPoints(points);
>
> The compiler returns a access vialation and redirect me to line 32 in
> vtkPointSet.cxx. The source code is vtkCxxSetObjectMacro(vtkPointSet,
> Points, vtkPoints);
>
> I haven't find any reference about it online. Can anyone tell me what is
> this and how it works?
>
> Thank you very much.
>
> Best Regards
> Wenlong
There are thousands of SetXYZ() functions in VTK. Each one of the set
functions also deals with things like setting the Modified time of the
object, etc. Instead of requiring huge duplication of this code, in
vtkSetGet.h there are macros defined so that developers can simply do
vtkSetMacro(type, name)
to deal with everything automatically. If you look in
Common/vtkSetGet.h, you can see the macros that are defined.
I agree that macros can be troubling to debug, because you can't see
the actual code that is being run.
David
More information about the vtkusers
mailing list