MCPcopy Create free account
hub / github.com/Kitware/VTK / ForceOwnership

Method ForceOwnership

Common/DataModel/vtkGraph.cxx:1728–1749  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1726
1727//------------------------------------------------------------------------------
1728void vtkGraph::ForceOwnership()
1729{
1730 // If the reference count == 1, we own it and can change it.
1731 // If the reference count > 1, we must make a copy to avoid
1732 // changing the structure of other graphs.
1733 if (this->Internals->GetReferenceCount() > 1)
1734 {
1735 vtkGraphInternals* internals = vtkGraphInternals::New();
1736 internals->Adjacency = this->Internals->Adjacency;
1737 internals->NumberOfEdges = this->Internals->NumberOfEdges;
1738 this->SetInternals(internals);
1739 internals->Delete();
1740 }
1741 if (this->EdgePoints && this->EdgePoints->GetReferenceCount() > 1)
1742 {
1743 vtkGraphEdgePoints* oldEdgePoints = this->EdgePoints;
1744 vtkGraphEdgePoints* edgePoints = vtkGraphEdgePoints::New();
1745 edgePoints->Storage = oldEdgePoints->Storage;
1746 this->EdgePoints = edgePoints;
1747 oldEdgePoints->Delete();
1748 }
1749}
1750
1751//------------------------------------------------------------------------------
1752vtkFieldData* vtkGraph::GetAttributesAsFieldData(int type)

Callers 8

InitializeMethod · 0.95
AddVertexInternalMethod · 0.95
AddEdgeInternalMethod · 0.95
RemoveVertexInternalMethod · 0.95
RemoveEdgeInternalMethod · 0.95
ReorderOutVerticesMethod · 0.95
GetGraphInternalsMethod · 0.95
InitializeMethod · 0.80

Calls 2

DeleteMethod · 0.65
NewFunction · 0.50

Tested by

no test coverage detected