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

Method DeepCopy

Common/Core/vtkBitArray.cxx:215–254  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Deep copy of another bit array.

Source from the content-addressed store, hash-verified

213//------------------------------------------------------------------------------
214// Deep copy of another bit array.
215void vtkBitArray::DeepCopy(vtkDataArray* ia)
216{
217 // Do nothing on a nullptr input.
218 if (ia == nullptr)
219 {
220 return;
221 }
222
223 this->DataChanged();
224
225 if (ia->GetDataType() != vtkBitArray::DataTypeTag::value)
226 {
227 vtkIdType numTuples = ia->GetNumberOfTuples();
228 this->NumberOfComponents = ia->GetNumberOfComponents();
229 this->SetNumberOfTuples(numTuples);
230
231 for (vtkIdType i = 0; i < numTuples; i++)
232 {
233 this->SetTuple(i, ia->GetTuple(i));
234 }
235 return;
236 }
237
238 if (this != ia)
239 {
240 if (this->DeleteFunction)
241 {
242 this->DeleteFunction(this->Array);
243 }
244
245 this->NumberOfComponents = ia->GetNumberOfComponents();
246 this->MaxId = ia->GetMaxId();
247 this->Size = ia->GetSize();
248 this->DeleteFunction = ::operator delete[];
249
250 this->Array = new ValueType[(this->Size + 7) / 8];
251 memcpy(this->Array, static_cast<ValueType*>(ia->GetVoidPointer(0)),
252 static_cast<size_t>((this->Size + 7) / 8) * sizeof(ValueType));
253 }
254}
255
256//------------------------------------------------------------------------------
257void vtkBitArray::PrintSelf(ostream& os, vtkIndent indent)

Callers 1

LookupValueMethod · 0.45

Calls 9

DataChangedMethod · 0.95
SetNumberOfTuplesMethod · 0.95
SetTupleMethod · 0.95
GetDataTypeMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetTupleMethod · 0.45
GetSizeMethod · 0.45
GetVoidPointerMethod · 0.45

Tested by

no test coverage detected