Hello fellow vtk users,
I have a probably simple question about VTK smart pointers. I want to use a VTK class (externalDataPtr or Type vtkImageData* in my case ), generated by a VTK pipeline, in a class which doesn't inherit vtkBaseObject. To make sure that the vtkImageData* isn't deleted by the pipeline, I need to manually increase the reference count by calling externalDataPtr->Register( NULL ); and decrease the reference count afterwards by externalDataPtr->Delete(); I'm wondering if giving a NULL pointer to the Register() function is correct (I assume that I need to give a pointer to the object which references my imageData here, which I can't, since my class does not inherit vtkBaseObject), since this parameter isn't documented well in the online documentation. Could anybody give me clue on what this parameter is actually good for? Regards Hendrik ------------------------------------------------------------------------------------- Dipl.-Inform. Hendrik Belitz Central Institute of Electronics / Zentralinstitut für Elektronik Multimodal image processing workgroup / AG Multimodale Bildverarbeitung Research Center Juelich / Forschungszentrum Jülich GmbH D-52428 Jülich, Germany Tel.: (++49)2461 61 8701 Fax: (++49)2461 61 3990 email: [hidden email] ggp-key available via http://pgpkeys.pca.dfn.de _______________________________________________ This is the private VTK discussion list. Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers |
I've been told that "The argument to Register/UnRegister is only used
when printing debugging messages so that the human knows what is referencing the object." You should balance your call to Register with a call to UnRegister (as opposed to Delete), also passing NULL as the parameter. In this case, it's probably six of one, half-dozen of the other, but Reg/UnReg are there to balance each other, so you should use them that way. Hope this helps, David Hendrik Belitz wrote: >Hello fellow vtk users, > >I have a probably simple question about VTK smart pointers. I want to use a >VTK class (externalDataPtr or Type vtkImageData* in my case ), generated by a >VTK pipeline, in a class which doesn't inherit vtkBaseObject. To make sure >that the vtkImageData* isn't deleted by the pipeline, I need to manually >increase the reference count by calling > >externalDataPtr->Register( NULL ); > >and decrease the reference count afterwards by > >externalDataPtr->Delete(); > >I'm wondering if giving a NULL pointer to the Register() function is correct >(I assume that I need to give a pointer to the object which references my >imageData here, which I can't, since my class does not inherit >vtkBaseObject), since this parameter isn't documented well in the online >documentation. Could anybody give me clue on what this parameter is actually >good for? > >Regards > Hendrik > >------------------------------------------------------------------------------------- >Dipl.-Inform. Hendrik Belitz >Central Institute of Electronics / Zentralinstitut für Elektronik > Multimodal image processing workgroup / AG Multimodale Bildverarbeitung >Research Center Juelich / Forschungszentrum Jülich GmbH >D-52428 Jülich, Germany >Tel.: (++49)2461 61 8701 Fax: (++49)2461 61 3990 >email: [hidden email] >ggp-key available via http://pgpkeys.pca.dfn.de > > >------------------------------------------------------------------------ > >_______________________________________________ >This is the private VTK discussion list. >Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ >Follow this link to subscribe/unsubscribe: >http://www.vtk.org/mailman/listinfo/vtkusers > > This is the private VTK discussion list. Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers |
Free forum by Nabble | Edit this page |