MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / load

Method load

Examples/SCExample/HotReloadSystem.h:149–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 }
148
149 Result load(StringView identifier)
150 {
151 const PluginDynamicLibrary* exampleLibrary = registry.findPlugin(identifier);
152
153 Buffer serializedModelState, serializedViewState;
154 if (exampleLibrary)
155 {
156 ISCExample* example = nullptr;
157 if (exampleLibrary->queryInterface(example) and example->serialize.isValid())
158 {
159 SC_TRY(example->serialize(serializedModelState, serializedViewState));
160 }
161 if (example and example->closeAsync.isValid())
162 {
163 SC_TRY(example->closeAsync(*eventLoop));
164 }
165 }
166
167 SC_TRY(registry.loadPlugin(identifier, compiler, sysroot, state.executablePath.view(),
168 PluginRegistry::LoadMode::Reload));
169
170 ISCExample* example = nullptr;
171 SC_TRY(exampleLibrary->queryInterface(example));
172 if (example)
173 {
174 if (example->deserialize.isValid() and not serializedModelState.isEmpty())
175 {
176 SC_TRY(example->deserialize(serializedModelState.toSpanConst(), serializedViewState.toSpanConst()));
177 }
178 if (example->initAsync.isValid())
179 {
180 SC_TRY(example->initAsync(*eventLoop));
181 }
182 }
183 return Result(true);
184 }
185
186 void unload(StringView identifier) { (void)registry.unloadPlugin(identifier); }
187

Callers 2

drawInternalMethod · 0.45
drawToolbarMethod · 0.45

Calls 11

findPluginMethod · 0.80
queryInterfaceMethod · 0.80
loadPluginMethod · 0.80
ResultClass · 0.50
isValidMethod · 0.45
serializeMethod · 0.45
closeAsyncMethod · 0.45
viewMethod · 0.45
isEmptyMethod · 0.45
deserializeMethod · 0.45
initAsyncMethod · 0.45

Tested by

no test coverage detected