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

Method DeepCopy

Common/DataModel/vtkGenericAttributeCollection.cxx:293–317  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Recursive duplication of `other' in `this'.

Source from the content-addressed store, hash-verified

291// Description:
292// Recursive duplication of `other' in `this'.
293void vtkGenericAttributeCollection::DeepCopy(vtkGenericAttributeCollection* other)
294{
295 assert("pre: other_exists" && other != nullptr);
296 assert("pre: not_self" && other != this);
297
298 this->AttributeInternalVector->Vector.resize(other->AttributeInternalVector->Vector.size());
299
300 this->AttributeIndices->Vector.resize(other->AttributeIndices->Vector.size());
301
302 int c = static_cast<int>(this->AttributeInternalVector->Vector.size());
303 for (int i = 0; i < c; i++)
304 {
305 if (this->AttributeInternalVector->Vector[i] == nullptr)
306 {
307 this->AttributeInternalVector->Vector[i] =
308 other->AttributeInternalVector->Vector[i]->NewInstance();
309 }
310 this->AttributeInternalVector->Vector[i]->DeepCopy(other->AttributeInternalVector->Vector[i]);
311 // Don't need to copy the contents of AttributeIndices: it will be
312 // recomputed because of the following Moditied call.
313 }
314 this->Modified();
315
316 assert("post: same_size" && this->GetNumberOfAttributes() == other->GetNumberOfAttributes());
317}
318
319//------------------------------------------------------------------------------
320// Description:

Callers

nothing calls this directly

Calls 6

GetNumberOfAttributesMethod · 0.95
assertFunction · 0.50
resizeMethod · 0.45
sizeMethod · 0.45
NewInstanceMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected