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

Method ExportToBytes

Serialization/Manager/vtkObjectManager.cxx:304–317  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

302
303//------------------------------------------------------------------------------
304vtkSmartPointer<vtkUnsignedCharArray> vtkObjectManager::ExportToBytes()
305{
306 nlohmann::json exportJson;
307 exportJson["States"] = this->Context->States();
308 exportJson["Blobs"] = this->Context->Blobs();
309 auto exportBytes = nlohmann::json::to_cbor(exportJson);
310 auto byteArray = vtk::TakeSmartPointer(vtkUnsignedCharArray::New());
311 using OutputAdapterType = ::output_vtk_buffer_adapter<unsigned char>;
312 using CBORWriter = nlohmann::detail::binary_writer<nlohmann::json, unsigned char>;
313 auto adapter = std::make_shared<OutputAdapterType>(byteArray);
314 CBORWriter writer(adapter);
315 writer.write_cbor(exportJson);
316 return byteArray;
317}
318
319//------------------------------------------------------------------------------
320std::vector<vtkSmartPointer<vtkObjectBase>> vtkObjectManager::ImportFromBytes(

Callers 1

serializeFunction · 0.80

Calls 3

to_cborFunction · 0.85
write_cborMethod · 0.80
NewFunction · 0.50

Tested by 1

serializeFunction · 0.64