#include <pluginManager.h>
Public Member Functions |
|
void | addPluginDirectory (const QString &dir, bool autoactivate=false) |
Tries to load all plugins (files
named like: pluginMyPlugin. |
|
bool | removePluginDirectory (const QString &dir) |
Tries to unload all plugins (files
named like: pluginMyPlugin. |
|
vector< QString > | getPluginDirectories () const |
Return a list of directories
currently searched for plugins. |
|
BALLPlugin * | loadPlugin (const QString &plugin_name) |
Loads the plugin specified by
plugin_name. |
|
bool | unloadPlugin (const QString &plugin) |
Unloads the plugin specified by
plugin_name. |
|
QObject * | getPluginInstance (const QString &plugin) |
Searches for the plugin and returns
a pointer to it if it has been loaded. |
|
QObject * | getPluginInstance (int pos) |
Searches for the plugin and returns
a pointer to it if it has been loaded. |
|
bool | startPlugin (int plugin) |
See
startPlugin(BALLPlugin* plugin). |
|
bool | startPlugin (const QString &plugin) |
See
startPlugin(BALLPlugin* plugin). |
|
bool | startPlugin (BALLPlugin *plugin) |
Starts the specified plugin through
a applicable
PluginHandler. |
|
bool | stopPlugin (int plugin) |
See
stopPlugin(BALLPlugin* plugin). |
|
bool | stopPlugin (const QString &plugin) |
See
stopPlugin(BALLPlugin* plugin). |
|
bool | stopPlugin (BALLPlugin *plugin) |
Stops the specified plugin by
letting all PluginHandlers stop it. |
|
void | unloadAllPlugins () |
Unload all registered
plugins. |
|
int | getPluginCount () const |
Returns the number of loaded
plugins. |
|
void | registerHandler (PluginHandler *h) |
Register a new
PluginHandler. |
|
virtual bool | getValue (String &) const |
Overload this in derived
classes! |
|
virtual bool | setValue (const String &) |
Overload this in derived
classes! |
|
Static Public Member Functions |
|
static PluginManager & | instance () |
Use this method to obtain the
PluginManager
instance. |
|
Protected Member Functions |
|
PluginManager (const PluginManager &) | |
const PluginManager & | operator= (const PluginManager &) |
Protected Attributes |
|
std::map< QString, vector < BALLPlugin * > > |
loaded_plugin_dirs_ |
QHash< QString, QPluginLoader * > | loaders_ |
std::list< PluginHandler * > | handlers_ |
QReadWriteLock | handler_mutex_ |
QReadWriteLock | loader_mutex_ |
Static Protected Attributes |
|
static const char * | BETWEEN_PLUGINDIR_SEPERATOR |
static boost::shared_ptr < PluginManager > |
manager_ |
static QMutex | mutex_ |
It is responsible for loading, starting and stopping plugins. For the task of properly initializing the plugins it utilizes the PluginHandler helper classes, that need to be supplemented for each new plugin type.
void BALL::PluginManager::addPluginDirectory | ( | const QString & | dir, | |
bool | autoactivate =
false |
|||
) |
Tries to load all plugins (files named like: pluginMyPlugin.
$LIBRARY_SUFFIX) located in the specified directoy dir.
dir | the directory to search for plugins. |
QObject* BALL::PluginManager::getPluginInstance | ( | int | pos | ) |
Searches for the plugin and returns a pointer to it if it has been loaded.
pos | The position of the plugin in the plugin list |
QObject* BALL::PluginManager::getPluginInstance | ( | const QString & | plugin | ) |
Searches for the plugin and returns a pointer to it if it has been loaded.
plugin | The name of the plugin to search |
static PluginManager& BALL::PluginManager::instance | ( | ) | [static] |
Use this method to obtain the PluginManager instance.
This method is thread safe.
BALLPlugin* BALL::PluginManager::loadPlugin | ( | const QString & | plugin_name | ) |
Loads the plugin specified by plugin_name.
plugin_name | The path to the plugin to load |
void BALL::PluginManager::registerHandler | ( | PluginHandler * | h | ) |
Register a new PluginHandler.
This handler will then be available for starting new plugins.
bool BALL::PluginManager::removePluginDirectory | ( | const QString & | dir | ) |
Tries to unload all plugins (files named like: pluginMyPlugin.
$LIBRARY_SUFFIX) located in the specified directoy dir.
dir | the directory to search for plugins to remove. |
bool BALL::PluginManager::startPlugin | ( | BALLPlugin * | plugin | ) |
Starts the specified plugin through a applicable PluginHandler.
plugin | A pointer to the plugin to be started |
bool BALL::PluginManager::stopPlugin | ( | BALLPlugin * | plugin | ) |
Stops the specified plugin by letting all PluginHandlers stop it.
plugin | A pointer to the plugin to be stopped |
bool BALL::PluginManager::unloadPlugin | ( | const QString & | plugin | ) |
Unloads the plugin specified by plugin_name.
plugin_name | The name of the plugin to unload |