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

Method UpdateObjectsFromStates

Serialization/Manager/vtkObjectManager.cxx:686–713  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

684
685//------------------------------------------------------------------------------
686void vtkObjectManager::UpdateObjectsFromStates()
687{
688 // Reset dependency cache as it will be rebuilt.
689 this->Context->ResetDirectDependencies();
690 // All objects go under the top level root node
691 vtkMarshalContext::ScopedParentTracker rootNodeTracker(this->Context, vtkObjectManager::ROOT());
692 // only deserialize those objects which are strong references
693 nlohmann::json strongRefStates;
694 const auto& states = this->Context->States();
695 std::copy_if(states.begin(), states.end(), std::back_inserter(strongRefStates),
696 [](const nlohmann::json& item)
697 {
698 return item.contains("vtk-object-manager-kept-alive") &&
699 item["vtk-object-manager-kept-alive"] == true;
700 });
701 const auto deserializerOwnershipKey = this->Deserializer->GetObjectDescription();
702 for (const auto& state : strongRefStates)
703 {
704 const auto identifier = state.at("Id").get<vtkTypeUInt32>();
705 auto object = this->Context->GetObjectAtId(identifier);
706 this->Deserializer->DeserializeJSON(identifier, object);
707 this->Context->KeepAlive(deserializerOwnershipKey, object);
708 }
709 // Remove unused objects
710 this->PruneUnusedObjects();
711 // Remove unused states
712 this->PruneUnusedStates();
713}
714
715//------------------------------------------------------------------------------
716void vtkObjectManager::UpdateStatesFromObjects()

Callers 15

ImportFromJSONMethod · 0.95
deserializeMethod · 0.45
deserializeMethod · 0.45
deserializeMethod · 0.45
test2Method · 0.45
deserializeMethod · 0.45
deserializeMethod · 0.45
testMethod · 0.45
deserializeMethod · 0.45
test1Method · 0.45
deserializeMethod · 0.45

Calls 12

PruneUnusedObjectsMethod · 0.95
PruneUnusedStatesMethod · 0.95
ROOTFunction · 0.85
DeserializeJSONMethod · 0.80
KeepAliveMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
containsMethod · 0.45
GetObjectDescriptionMethod · 0.45
atMethod · 0.45
GetObjectAtIdMethod · 0.45

Tested by 15

deserializeMethod · 0.36
deserializeMethod · 0.36
deserializeMethod · 0.36
test2Method · 0.36
deserializeMethod · 0.36
deserializeMethod · 0.36
testMethod · 0.36
deserializeMethod · 0.36
test1Method · 0.36
deserializeMethod · 0.36
deserializeMethod · 0.36
deserializeMethod · 0.36