VTK/VTK 6 Migration/Removal of ShouldIReleaseData

From KitwarePublic
< VTK
Revision as of 19:10, 6 April 2012 by Berk (talk | contribs) (Created page with "= Removal of ShouldIReleaseData() and ReleaseDataFlag methods from vtkDataObject = VTK 6 introduces a number of backwards-incompatible changes. The reasons behind these changes ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Removal of ShouldIReleaseData() and ReleaseDataFlag methods from vtkDataObject

VTK 6 introduces a number of backwards-incompatible changes. The reasons behind these changes are described in more detail [here]. One of these changes is the removal of all pipeline related methods from vtkDataObject. Among these are the following vtkDataObject methods:

  • ShouldIReleaseData()
  • SetReleaseDataFlag()
  • GetReleaseDataFlag()
  • ReleaseDataFlagToOn()
  • ReleaseDataFlagToOff()

All of these methods (except ShouldIReleaseData) have always had their counterparts in vtkDemandDrivenPipeline and any code that uses them can be fixed by using the vtkDemandDrivenPipeline methods instead. ShouldIReleaseData is a convenience method that was used by pipeline executives and is not normally used outside this context.

Example 1

Replace

<source lang="cpp"> vtkDataObject* dobj = anAlgorithm->GetOutput(); dobj->SetReleaseDataFlag(1); </source>

with

<source lang="cpp"> vtkDemandDrivenPipeline* executive =

       vtkDemandDrivenPipeline::SafeDownCast(
            anAlgorithm->GetExecutive());

if (executive)

 {
 executive->SetReleaseDataFlag(0, 1); // where 0 is the port index
 }

</source>