MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / loadPlugin

Method loadPlugin

src/osvr/PluginHost/RegistrationContext.cpp:79–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 void RegistrationContext::loadPlugin(std::string const &pluginName) {
80 const std::string pluginPathName = pluginhost::findPlugin(pluginName);
81 if (pluginPathName.empty()) {
82 throw std::runtime_error("Could not find plugin named " +
83 pluginName);
84 }
85
86 const std::string pluginPathNameNoExt =
87 (boost::filesystem::path(pluginPathName).parent_path() /
88 boost::filesystem::path(pluginPathName).stem()).generic_string();
89 PluginRegPtr pluginReg(
90 PluginSpecificRegistrationContext::create(pluginName));
91 pluginReg->setParent(*this);
92
93 libfunc::PluginHandle plugin;
94 auto ctx = pluginReg->extractOpaquePointer();
95
96 bool success = tryLoadingPlugin(plugin, pluginPathName, ctx) ||
97 tryLoadingPlugin(plugin, pluginPathNameNoExt, ctx, true);
98 if (!success) {
99 throw std::runtime_error(
100 "Unusual error occurred trying to load plugin named " +
101 pluginName);
102 }
103
104 pluginReg->takePluginHandle(plugin);
105 adoptPluginRegistrationContext(pluginReg);
106 }
107
108 void RegistrationContext::loadPlugins() {
109 // Build a list of all the plugins we can find

Callers

nothing calls this directly

Calls 6

findPluginFunction · 0.85
tryLoadingPluginFunction · 0.85
setParentMethod · 0.80
extractOpaquePointerMethod · 0.80
takePluginHandleMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected