MCPcopy Create free account
hub / github.com/Kitware/VTK / operator()

Method operator()

IO/Export/vtkJSONDataSetWriter.cxx:308–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306{
307 template <class TArray>
308 void operator()(TArray* input, vtkJSONDataSetWriter* self, const char* filePath)
309 {
310 using ValueType = typename TArray::ValueType;
311 // Check if we need to convert the (u)int64 to (u)int32
312 if (std::is_integral_v<ValueType> && sizeof(ValueType) > 4)
313 {
314 if (std::is_signed_v<ValueType>)
315 {
316 vtkNew<vtkAOSDataArrayTemplate<unsigned int>> uint32;
317 uint32->DeepCopy(input);
318 const char* content = reinterpret_cast<const char*>(uint32->GetPointer(0));
319 size_t size = uint32->GetNumberOfValues() * uint32->GetDataTypeSize();
320 self->GetArchiver()->InsertIntoArchive(filePath, content, size);
321 }
322 else
323 {
324 vtkNew<vtkAOSDataArrayTemplate<int>> int32;
325 int32->DeepCopy(input);
326 const char* content = reinterpret_cast<const char*>(int32->GetPointer(0));
327 size_t size = int32->GetNumberOfValues() * int32->GetDataTypeSize();
328 self->GetArchiver()->InsertIntoArchive(filePath, content, size);
329 }
330 }
331 else
332 {
333 const char* content = reinterpret_cast<const char*>(input->GetPointer(0));
334 size_t size = input->GetNumberOfValues() * input->GetDataTypeSize();
335 self->GetArchiver()->InsertIntoArchive(filePath, content, size);
336 }
337 }
338};
339
340//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

DeepCopyMethod · 0.45
GetPointerMethod · 0.45
GetNumberOfValuesMethod · 0.45
GetDataTypeSizeMethod · 0.45
InsertIntoArchiveMethod · 0.45

Tested by

no test coverage detected