MCPcopy Create free account
hub / github.com/DFHack/dfhack / findFunction

Method findFunction

library/RemoteServer.cpp:186–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186ServerFunctionBase *ServerConnection::findFunction(color_ostream &out, const std::string &plugin, const std::string &name)
187{
188 RPCService *svc;
189
190 if (plugin.empty())
191 svc = core_service;
192 else
193 {
194 svc = plugin_services[plugin];
195
196 if (!svc)
197 {
198 Plugin *plug = Core::getInstance().plug_mgr->getPluginByName(plugin);
199 if (!plug)
200 {
201 out.printerr("No such plugin: {}\n", plugin);
202 return NULL;
203 }
204
205 svc = plug->rpc_connect(out);
206 if (!svc)
207 {
208 out.printerr("Plugin {} doesn't export any RPC methods.\n", plugin);
209 return NULL;
210 }
211
212 svc->finalize(this, &functions);
213 plugin_services[plugin] = svc;
214 }
215 }
216
217 return svc->getFunction(name);
218}
219
220void ServerConnection::connection_ostream::flush_proxy()
221{

Callers 1

BindMethodMethod · 0.80

Calls 4

rpc_connectMethod · 0.80
finalizeMethod · 0.80
getFunctionMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected