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

Method ShallowCopy

Common/DataModel/vtkDataObjectTree.cxx:528–559  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

526
527//------------------------------------------------------------------------------
528void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
529{
530 if (src == this)
531 {
532 return;
533 }
534
535 this->Internals->Children.clear();
536 this->Superclass::ShallowCopy(src);
537
538 if (auto from = vtkDataObjectTree::SafeDownCast(src))
539 {
540 unsigned int numChildren = from->GetNumberOfChildren();
541 this->SetNumberOfChildren(numChildren);
542 for (unsigned int cc = 0; cc < numChildren; cc++)
543 {
544 if (auto child = from->GetChild(cc))
545 {
546 auto clone = child->NewInstance();
547 clone->ShallowCopy(child);
548 this->SetChild(cc, clone);
549 clone->FastDelete();
550 }
551 if (from->HasChildMetaData(cc))
552 {
553 vtkInformation* toInfo = this->GetChildMetaData(cc);
554 toInfo->Copy(from->GetChildMetaData(cc), /*deep=*/0);
555 }
556 }
557 }
558 this->Modified();
559}
560
561//------------------------------------------------------------------------------
562void vtkDataObjectTree::Initialize()

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