[vtkusers] How to use vtkDataObjectReader in C++

David E DeMarle dave.demarle at kitware.com
Thu Feb 9 08:12:21 EST 2012


You need to use New() and Delete() for to create vtkObjects. This
makes it possible for VTK to reference count everything to help ensure
objects are not accessed after deletion or deleted more than once.

Consider using smart pointers as well because then you don't generally
have to Delete() what you New() and are less likely to leak memory.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Thu, Feb 9, 2012 at 8:04 AM,  <ycollette.nospam at free.fr> wrote:
> Hello,
>
> I tried to compile the following code under C++, but the compiler complains about not being able to access protected members (the contructor and the destructor).
> Here is the peice of code:
>
>  vtkFieldData * dataSet = NULL;
>  vtkDataObjectReader * do_reader = new vtkDataObjectReader;
>
>  do_reader->ReadAllFieldsOn();
>  do_reader->SetFileName(Filename);
>  dataSet = do_reader->ReadFieldData();
>
>
> My question is: how to use vtkDataObjectReader in C++ ?
>
> Best regards,
>
> YC
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list