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

Method Import

Serialization/Manager/vtkObjectManager.cxx:271–301  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

269
270//------------------------------------------------------------------------------
271void 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//------------------------------------------------------------------------------
304vtkSmartPointer<vtkUnsignedCharArray> vtkObjectManager::ExportToBytes()

Callers 1

vtkSessionImportFunction · 0.45

Calls 5

ClearMethod · 0.95
ImportFromJSONMethod · 0.95
parseFunction · 0.50
whatMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected