------------------------------------------------------------------------------
| 269 | |
| 270 | //------------------------------------------------------------------------------ |
| 271 | void vtkObjectManager::Import(const std::string& stateFileName, const std::string& blobFileName) |
| 272 | { |
| 273 | this->Clear(); |
| 274 | // Register all the states. |
| 275 | nlohmann::json importJson; |
| 276 | try |
| 277 | { |
| 278 | importJson["States"] = nlohmann::json::parse(std::ifstream(stateFileName)); |
| 279 | } |
| 280 | catch (nlohmann::json::type_error& e) |
| 281 | { |
| 282 | vtkErrorMacro(<< "Failed to parse states from " << stateFileName << ". message=" << e.what()); |
| 283 | } |
| 284 | // Register all the blobs. |
| 285 | try |
| 286 | { |
| 287 | importJson["Blobs"] = nlohmann::json::parse(std::ifstream(blobFileName)); |
| 288 | } |
| 289 | catch (nlohmann::json::type_error& e) |
| 290 | { |
| 291 | vtkErrorMacro(<< "Failed to parse blobs from " << blobFileName << ". message=" << e.what()); |
| 292 | } |
| 293 | const auto strongObjectIds = this->ImportFromJSON(importJson); |
| 294 | if (strongObjectIds.empty()) |
| 295 | { |
| 296 | vtkWarningMacro(<< "No strong objects were imported from the files: " << stateFileName << ", " |
| 297 | << blobFileName |
| 298 | << ". Check whether the states contain the key " |
| 299 | "\"vtk-object-manager-kept-alive\": true"); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | //------------------------------------------------------------------------------ |
| 304 | vtkSmartPointer<vtkUnsignedCharArray> vtkObjectManager::ExportToBytes() |
no test coverage detected