SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::helper::system::PluginManager Class Reference

#include <PluginManager.h>

Static Public Attributes

static std::string s_gui_postfix = "gui"
 the postfix to gui plugin, default="gui" (e.g. myplugin_gui.so) More...
 

Public Member Functions

bool loadPlugin (const std::string &plugin, const std::string &suffix=getDefaultSuffix(), bool ignoreCase=true, bool recursive=true, std::ostream *errlog=nullptr)
 
bool loadPluginByPath (const std::string &path, std::ostream *errlog=nullptr)
 
bool 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=6)
 
bool pluginIsLoaded (const std::string &plugin)
 
bool checkDuplicatedPlugin (const Plugin &plugin, const std::string &pluginPath)
 
PluginMapgetPluginMap ()
 
PlugingetPlugin (const std::string &plugin, const std::string &=getDefaultSuffix(), bool=true)
 
PlugingetPluginByName (const std::string &pluginName)
 
void readFromIniFile (const std::string &path)
 
void writeToIniFile (const std::string &path)
 

Static Public Member Functions

static PluginManagergetInstance ()
 
static std::string getDefaultSuffix ()
 

Friends

std::ostream & operator<< (std::ostream &os, const PluginManager &pluginManager)
 
std::istream & operator>> (std::istream &in, PluginManager &pluginManager)
 

Attribute details

std::string sofa::helper::system::PluginManager::s_gui_postfix = "gui"
static

the postfix to gui plugin, default="gui" (e.g. myplugin_gui.so)

Function details

bool sofa::helper::system::PluginManager::checkDuplicatedPlugin ( const Plugin plugin,
const std::string &  pluginPath 
)
std::string sofa::helper::system::PluginManager::findPlugin ( const std::string &  pluginName,
const std::string &  suffix = getDefaultSuffix(),
bool  ignoreCase = true,
bool  recursive = true,
int  maxRecursiveDepth = 6 
)
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)

PluginManager & sofa::helper::system::PluginManager::getInstance ( )
static
Plugin * sofa::helper::system::PluginManager::getPlugin ( const std::string &  plugin,
const std::string &  = getDefaultSuffix(),
bool  = true 
)
Plugin * sofa::helper::system::PluginManager::getPluginByName ( const std::string &  pluginName)
PluginMap& sofa::helper::system::PluginManager::getPluginMap ( )
inline
void sofa::helper::system::PluginManager::init ( void  )
void sofa::helper::system::PluginManager::init ( const std::string &  pluginPath)
bool 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
pluginCan be just the filename of the library to load (without extension) or the full path
suffixAn optional suffix to apply to the filename. Defaults to "_d" with debug builds and is empty otherwise.
ignoreCaseSpecify 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
errlogAn optional stream for error logging.
bool 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
pluginNameThe filename without extension of the plugin to load
suffixAn optional suffix to apply to the filename. Defaults to "_d" with debug builds, empty otherwise.
ignoreCaseSpecify 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
errlogAn optional stream for error logging.
bool sofa::helper::system::PluginManager::loadPluginByPath ( const std::string &  path,
std::ostream *  errlog = nullptr 
)

Loads a plugin library in process memory.

Parameters
pathThe full path of the plugin to load
errlogAn optional stream for error logging.
bool sofa::helper::system::PluginManager::pluginIsLoaded ( const std::string &  plugin)
void sofa::helper::system::PluginManager::readFromIniFile ( const std::string &  path)
bool sofa::helper::system::PluginManager::unloadPlugin ( const std::string &  path,
std::ostream *  errlog = nullptr 
)

Unloads a plugin from process memory.

void sofa::helper::system::PluginManager::writeToIniFile ( const std::string &  path)

Related details

std::ostream& operator<< ( std::ostream &  os,
const PluginManager pluginManager 
)
friend
std::istream& operator>> ( std::istream &  in,
PluginManager pluginManager 
)
friend