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

Method DeepCopy

Common/DataModel/vtkDataObjectTree.cxx:494–525  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

492
493//------------------------------------------------------------------------------
494void vtkDataObjectTree::DeepCopy(vtkDataObject* src)
495{
496 if (src == this)
497 {
498 return;
499 }
500
501 this->Internals->Children.clear();
502 this->Superclass::DeepCopy(src);
503
504 if (auto from = vtkDataObjectTree::SafeDownCast(src))
505 {
506 unsigned int numChildren = from->GetNumberOfChildren();
507 this->SetNumberOfChildren(numChildren);
508 for (unsigned int cc = 0; cc < numChildren; cc++)
509 {
510 if (auto fromChild = from->GetChild(cc))
511 {
512 vtkDataObject* toChild = fromChild->NewInstance();
513 toChild->DeepCopy(fromChild);
514 this->SetChild(cc, toChild);
515 toChild->FastDelete();
516 if (from->HasChildMetaData(cc))
517 {
518 vtkInformation* toInfo = this->GetChildMetaData(cc);
519 toInfo->Copy(from->GetChildMetaData(cc), /*deep=*/1);
520 }
521 }
522 }
523 }
524 this->Modified();
525}
526
527//------------------------------------------------------------------------------
528void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)

Callers

nothing calls this directly

Calls 11

SetNumberOfChildrenMethod · 0.95
SetChildMethod · 0.95
GetChildMetaDataMethod · 0.95
FastDeleteMethod · 0.80
HasChildMetaDataMethod · 0.80
clearMethod · 0.45
GetNumberOfChildrenMethod · 0.45
GetChildMethod · 0.45
NewInstanceMethod · 0.45
CopyMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected