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

Method PopArray

Parallel/Core/vtkMultiProcessStream.cxx:366–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364//------------------------------------------------------------------------------
365template <typename T>
366void vtkMultiProcessStream::PopArray(T*& array, unsigned int& size)
367{
368 assert("pre: stream data must be the right type" &&
369 this->Internals->Data.front() == vtkTypeTraits<T>::VTKTypeID());
370 this->Internals->Data.pop_front();
371
372 if (array == nullptr)
373 {
374 // Get the size of the array
375 this->Internals->Pop(reinterpret_cast<unsigned char*>(&size), sizeof(unsigned int));
376
377 // Allocate array
378 array = new T[size];
379 assert("ERROR: cannot allocate array" && (array != nullptr));
380 }
381 else
382 {
383 unsigned int sz;
384
385 // Get the size of the array
386 this->Internals->Pop(reinterpret_cast<unsigned char*>(&sz), sizeof(unsigned int));
387 assert("ERROR: input array size does not match size of data" && (sz == size));
388 }
389
390 // Pop the array data
391 this->Internals->Pop(reinterpret_cast<unsigned char*>(array), sizeof(T) * size);
392}
393
394//------------------------------------------------------------------------------
395void vtkMultiProcessStream::Pop(char*& array, unsigned int& size)

Callers 1

PopMethod · 0.95

Calls 4

pop_frontMethod · 0.80
assertFunction · 0.50
frontMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected