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

Function vtkSessionUpdateObjectFromState

Serialization/Manager/vtkSession.cxx:230–263  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

228
229 //-------------------------------------------------------------------------------
230 void vtkSessionUpdateObjectFromState(vtkSession session, vtkSessionJson state)
231 {
232 char* stateJsonCString = session->StringifyJson(state);
233 auto stateJson = nlohmann::json::parse(stateJsonCString, nullptr, false);
234 free(stateJsonCString);
235 if (stateJson.is_discarded())
236 {
237 vtkLog(ERROR, << "Failed to parse state!");
238 return;
239 }
240 else if (auto idIter = stateJson.find("Id"); idIter != stateJson.end())
241 {
242 if (auto classNameIter = stateJson.find("ClassName"); classNameIter != stateJson.end())
243 {
244 if (*classNameIter == "vtkOSOpenGLRenderWindow")
245 {
246 *classNameIter = "vtkRenderWindow";
247 }
248 }
249 if (auto objectImpl = session->Manager->GetObjectAtId(*idIter))
250 {
251 const std::string className = objectImpl->GetClassName();
252 if (auto propertiesIter = session->SkippedClassProperties.find(className);
253 propertiesIter != session->SkippedClassProperties.end())
254 {
255 for (const auto& propertyName : propertiesIter->second)
256 {
257 stateJson.erase(propertyName);
258 }
259 }
260 }
261 }
262 session->Manager->UpdateObjectFromState(stateJson);
263 }
264
265 //-------------------------------------------------------------------------------
266 void vtkSessionUpdateStateFromObject(vtkSession session, vtkObjectHandle object)

Callers 3

SetMethod · 0.85
UpdateObjectFromStateMethod · 0.85
SetMethod · 0.85

Calls 7

parseFunction · 0.50
findMethod · 0.45
endMethod · 0.45
GetObjectAtIdMethod · 0.45
GetClassNameMethod · 0.45
eraseMethod · 0.45
UpdateObjectFromStateMethod · 0.45

Tested by

no test coverage detected