This class provides methods for loading Field plugins from disk.
More...
#include <PluginLoader.h>
|
static void | loadPlugins () |
| Checks all paths in $FIELD3D_DSO_PATH and loads the plugins it finds. More...
|
|
This class provides methods for loading Field plugins from disk.
- Todo:
- Look into adding maya-style single-plugin load and unload functions
Definition at line 68 of file PluginLoader.h.
PluginLoader::PluginLoader |
( |
| ) |
|
PluginLoader::~PluginLoader |
( |
| ) |
|
void PluginLoader::loadPlugins |
( |
| ) |
|
|
static |
Checks all paths in $FIELD3D_DSO_PATH and loads the plugins it finds.
Definition at line 252 of file PluginLoader.cpp.
References FIELD3D_NAMESPACE_SOURCE_CLOSE, findRegistrationFunc(), getDirSos(), Msg::print(), RegistrationFunc, Msg::SevWarning, and ClassFactory::singleton().
Referenced by ClassFactory::ClassFactory().
255 char *cptr = getenv(
"FIELD3D_DSO_PATH");
259 std::string path = cptr;
262 std::vector<std::string> paths;
263 const std::string delimiters =
":";
265 tokenize(path, delimiters, paths);
268 for (
unsigned int i = 0; i < paths.size(); i++) {
271 std::vector<std::string> sos;
277 for (
unsigned int j = 0; j < sos.size(); j++) {
278 std::string sofile = sos[j];
281 const std::string pathDelimiter =
"/";
282 std::vector<std::string> pluginName;
283 tokenize(sofile, pathDelimiter, pluginName);
285 bool pluginAlreadyLoaded =
false;
288 if (pluginName.size() > 0) {
292 pluginAlreadyLoaded =
true;
298 if (pluginAlreadyLoaded) {
302 if (pluginName.size() > 0) {
303 std::string lastName = pluginName[pluginName.size() -1];
315 "failed to init Field3D plugin " + sofile);
317 Msg::print(
"Initialized Field3D Plugin " + sofile);
FIELD3D_NAMESPACE_OPEN typedef int(* RegistrationFunc)(ClassFactory &)
static ClassFactory & singleton()
}
FIELD3D_API void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity. ...
static std::vector< std::string > ms_pluginsLoaded
List of plugins loaded.
bool getDirSos(std::vector< std::string > &sos, std::string &dir)
static RegistrationFunc findRegistrationFunc(const std::string &sofile)
std::vector< std::string > PluginLoader::ms_pluginsLoaded |
|
staticprivate |
The documentation for this class was generated from the following files: