------------------------------------------------------------------------------
| 302 | |
| 303 | //------------------------------------------------------------------------------ |
| 304 | vtkSmartPointer<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 | //------------------------------------------------------------------------------ |
| 320 | std::vector<vtkSmartPointer<vtkObjectBase>> vtkObjectManager::ImportFromBytes( |