#include <PluginManager.h>
|
static std::string | s_gui_postfix = "gui" |
| the postfix to gui plugin, default="gui" (e.g. myplugin_gui.so) More...
|
|
|
PluginLoadStatus | loadPlugin (const std::string &plugin, const std::string &suffix=getDefaultSuffix(), bool ignoreCase=true, bool recursive=true, std::ostream *errlog=nullptr) |
|
PluginLoadStatus | loadPluginByPath (const std::string &path, std::ostream *errlog=nullptr) |
|
PluginLoadStatus | loadPluginByName (const std::string &pluginName, const std::string &suffix=getDefaultSuffix(), bool ignoreCase=true, bool recursive=true, std::ostream *errlog=nullptr) |
|
bool | unloadPlugin (const std::string &path, std::ostream *errlog=nullptr) |
| Unloads a plugin from process memory. More...
|
|
void | init () |
|
void | init (const std::string &pluginPath) |
|
std::string | findPlugin (const std::string &pluginName, const std::string &suffix=getDefaultSuffix(), bool ignoreCase=true, bool recursive=true, int maxRecursiveDepth=3) |
|
bool | pluginIsLoaded (const std::string &plugin) |
|
bool | checkDuplicatedPlugin (const Plugin &plugin, const std::string &pluginPath) |
|
PluginMap & | getPluginMap () |
|
Plugin * | getPlugin (const std::string &plugin, const std::string &=getDefaultSuffix(), bool=true) |
|
Plugin * | getPluginByName (const std::string &pluginName) |
|
void | readFromIniFile (const std::string &path) |
|
void | readFromIniFile (const std::string &path, type::vector< std::string > &listLoadedPlugins) |
|
void | writeToIniFile (const std::string &path) |
|
void | addOnPluginLoadedCallback (const std::string &key, std::function< void(const std::string &, const Plugin &)> callback) |
|
void | removeOnPluginLoadedCallback (const std::string &key) |
|
◆ s_gui_postfix
std::string sofa::helper::system::PluginManager::s_gui_postfix = "gui" |
|
static |
the postfix to gui plugin, default="gui" (e.g. myplugin_gui.so)
◆ addOnPluginLoadedCallback()
void sofa::helper::system::PluginManager::addOnPluginLoadedCallback |
( |
const std::string & |
key, |
|
|
std::function< void(const std::string &, const Plugin &)> |
callback |
|
) |
| |
◆ checkDuplicatedPlugin()
bool sofa::helper::system::PluginManager::checkDuplicatedPlugin |
( |
const Plugin & |
plugin, |
|
|
const std::string & |
pluginPath |
|
) |
| |
◆ findPlugin()
std::string sofa::helper::system::PluginManager::findPlugin |
( |
const std::string & |
pluginName, |
|
|
const std::string & |
suffix = getDefaultSuffix() , |
|
|
bool |
ignoreCase = true , |
|
|
bool |
recursive = true , |
|
|
int |
maxRecursiveDepth = 3 |
|
) |
| |
◆ getDefaultSuffix()
std::string sofa::helper::system::PluginManager::getDefaultSuffix |
( |
| ) |
|
|
static |
Get the default suffix applied to plugin names to find the actual lib to load Returns "_d" in debug configuration and an empty string otherwise
Get the default suffix applied to plugin names to find the actual lib to load (depends on platform, version, debug/release build)
◆ getInstance()
PluginManager & sofa::helper::system::PluginManager::getInstance |
( |
| ) |
|
|
static |
◆ getPlugin()
Plugin * sofa::helper::system::PluginManager::getPlugin |
( |
const std::string & |
plugin, |
|
|
const std::string & |
= getDefaultSuffix() , |
|
|
bool |
= true |
|
) |
| |
◆ getPluginByName()
Plugin * sofa::helper::system::PluginManager::getPluginByName |
( |
const std::string & |
pluginName | ) |
|
◆ getPluginMap()
PluginMap& sofa::helper::system::PluginManager::getPluginMap |
( |
| ) |
|
|
inline |
◆ GetPluginNameFromPath()
std::string sofa::helper::system::PluginManager::GetPluginNameFromPath |
( |
const std::string & |
pluginPath | ) |
|
|
static |
◆ init() [1/2]
void sofa::helper::system::PluginManager::init |
( |
void |
| ) |
|
◆ init() [2/2]
void sofa::helper::system::PluginManager::init |
( |
const std::string & |
pluginPath | ) |
|
◆ loadPlugin()
auto sofa::helper::system::PluginManager::loadPlugin |
( |
const std::string & |
plugin, |
|
|
const std::string & |
suffix = getDefaultSuffix() , |
|
|
bool |
ignoreCase = true , |
|
|
bool |
recursive = true , |
|
|
std::ostream * |
errlog = nullptr |
|
) |
| |
Loads a plugin library in process memory.
- Parameters
-
plugin | Can be just the filename of the library to load (without extension) or the full path |
suffix | An optional suffix to apply to the filename. Defaults to "_d" with debug builds and is empty otherwise. |
ignoreCase | Specify if the plugin search should be case insensitive (activated by default). Not used if the plugin string passed as a parameter is a full path |
errlog | An optional stream for error logging. |
◆ loadPluginByName()
auto sofa::helper::system::PluginManager::loadPluginByName |
( |
const std::string & |
pluginName, |
|
|
const std::string & |
suffix = getDefaultSuffix() , |
|
|
bool |
ignoreCase = true , |
|
|
bool |
recursive = true , |
|
|
std::ostream * |
errlog = nullptr |
|
) |
| |
Loads a plugin library in process memory.
- Parameters
-
pluginName | The filename without extension of the plugin to load |
suffix | An optional suffix to apply to the filename. Defaults to "_d" with debug builds, empty otherwise. |
ignoreCase | Specify if the plugin search should be case insensitive (activated by default). Not used if the plugin string passed as a parameter is a full path |
errlog | An optional stream for error logging. |
◆ loadPluginByPath()
Loads a plugin library in process memory.
- Parameters
-
path | The full path of the plugin to load |
errlog | An optional stream for error logging. |
◆ pluginIsLoaded()
bool sofa::helper::system::PluginManager::pluginIsLoaded |
( |
const std::string & |
plugin | ) |
|
◆ readFromIniFile() [1/2]
void sofa::helper::system::PluginManager::readFromIniFile |
( |
const std::string & |
path | ) |
|
◆ readFromIniFile() [2/2]
void sofa::helper::system::PluginManager::readFromIniFile |
( |
const std::string & |
path, |
|
|
type::vector< std::string > & |
listLoadedPlugins |
|
) |
| |
◆ removeOnPluginLoadedCallback()
void sofa::helper::system::PluginManager::removeOnPluginLoadedCallback |
( |
const std::string & |
key | ) |
|
◆ unloadPlugin()
bool sofa::helper::system::PluginManager::unloadPlugin |
( |
const std::string & |
path, |
|
|
std::ostream * |
errlog = nullptr |
|
) |
| |
Unloads a plugin from process memory.
◆ writeToIniFile()
void sofa::helper::system::PluginManager::writeToIniFile |
( |
const std::string & |
path | ) |
|
◆ PluginLoadStatus
Enumerator |
---|
SUCCESS | |
ALREADY_LOADED | |
PLUGIN_FILE_NOT_FOUND | |
INVALID_LOADING | |
MISSING_SYMBOL | |
INIT_ERROR | |
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const PluginManager & |
pluginManager |
|
) |
| |
|
friend |
◆ operator>>
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
PluginManager & |
pluginManager |
|
) |
| |
|
friend |