-------------------------------------------------------------------------------
| 109 | |
| 110 | //------------------------------------------------------------------------------- |
| 111 | vtkSessionResult vtkSessionRegisterState(vtkSession session, vtkSessionJson state) |
| 112 | { |
| 113 | char* stateJsonCString = session->StringifyJson(state); |
| 114 | auto stateJson = nlohmann::json::parse(stateJsonCString, nullptr, false); |
| 115 | free(stateJsonCString); |
| 116 | if (stateJson.is_discarded()) |
| 117 | { |
| 118 | vtkLog(ERROR, << "Failed to parse state!"); |
| 119 | return vtkSessionResultFailure; |
| 120 | } |
| 121 | if (auto classNameIter = stateJson.find("ClassName"); classNameIter != stateJson.end()) |
| 122 | { |
| 123 | if (*classNameIter == "vtkOSOpenGLRenderWindow") |
| 124 | { |
| 125 | *classNameIter = "vtkRenderWindow"; |
| 126 | } |
| 127 | if (auto propertiesIter = session->SkippedClassProperties.find(*classNameIter); |
| 128 | propertiesIter != session->SkippedClassProperties.end()) |
| 129 | { |
| 130 | for (const auto& propertyName : propertiesIter->second) |
| 131 | { |
| 132 | stateJson.erase(propertyName); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | return session->Manager->RegisterState(stateJson) ? vtkSessionResultSuccess |
| 137 | : vtkSessionResultFailure; |
| 138 | } |
| 139 | |
| 140 | //------------------------------------------------------------------------------- |
| 141 | vtkSessionResult vtkSessionUnRegisterState(vtkSession session, vtkObjectHandle object) |
no test coverage detected