EventAnalysis
1.0.0
|
Class to dynamically load and manage shared libraries. More...
#include <DynamicLoader.h>
Public Member Functions | |
~DynamicLoader () | |
Destructor. More... | |
template<class T > | |
bool | AddPluginFolders (const T &foldersList) |
Adds plugin folders. More... | |
bool | LoadPlugin (const std::string &pluginName) |
Loads a plugin library. More... | |
void | AutoLoad (const std::string &autoLoadFolder="") |
Loads all the shared libraries in a given folder. More... | |
Private Attributes | |
std::vector< std::string > | _pluginFolders |
std::vector< void * > | _files |
Class to dynamically load and manage shared libraries.
This class dynamically loads shared libraries. It takes care of opening and closing libraries, but does not fetch any symbol. It maintains a list of opened libraries, which are closed when the loader is destroyed.
EA::DynamicLoader::~DynamicLoader | ( | ) |
Destructor.
Closes all the loaded libraries.
bool EA::DynamicLoader::AddPluginFolders | ( | const T & | foldersList | ) |
Adds plugin folders.
Adds folders where plugin libraries specified as relative paths will be searched.
folders | a container with a list of folders (each folder as a std::string) |
void EA::DynamicLoader::AutoLoad | ( | const std::string & | autoLoadFolder = "" | ) |
Loads all the shared libraries in a given folder.
This method loads all the libraries (.so files) in the given folder.
autoLoadFolder | the folder containing the libraries to be automatically loaded. |
bool EA::DynamicLoader::LoadPlugin | ( | const std::string & | pluginName | ) |
Loads a plugin library.
This method loads a plugin library using dlopen. No symbol is fetched.
#pluginName identifies the plugin library to be loaded. It can be specified in several ways:
1) /path/to/libPlugin.so
If given as an absolute path then the path is used as is.
2) ../relativePath/to/libPlugin.so or libPlugin.so
If given as a relative path or a simple file name then the file will be searched relatively to the folders specified by calling AddPluginFolders.
3) Plugin
If given as a simple plugin name then the library file name is obtained by prepending "lib" and appending ".so" to the plugin name, and then the search is performed as in 2).
pluginName | The name of the desired plugin (see above for a detailed description of the format). |
|
private |
|
private |