#include <pluginHandler.h>
Public Member Functions |
|
virtual | ~PluginHandler () |
A virtual destructor. |
|
virtual bool | canHandle (BALLPlugin *plugin) const =0 |
This function is used to check
whether this
PluginHandler can initialize the passed plugin.
|
|
bool | startPlugin (BALLPlugin *plugin) |
This function checks whether the
plugin can be handled and if it is not already running.
|
|
bool | stopPlugin (BALLPlugin *plugin) |
This function checks whether the
plugin is currently running and atempts to stop it via the
specificShutdown_() method. |
|
virtual bool | isRunning (BALLPlugin *plugin) const |
This function must check if the
passed plugin has been started by this handler. |
|
Protected Member Functions |
|
virtual bool | specificSetup_ (BALLPlugin *plugin)=0 |
A purely virtual function which is
responsible for properly initialising the passed plugin
instance. |
|
virtual bool | specificShutdown_ (BALLPlugin *plugin)=0 |
A purely virtual function which is
responsible for properly deinitialising the passed plugin
instance. |
It provides the method canHandle() that checks whether a plugin can be initialized by the handler and has the purely virtual methods specificSetup_() and specificShutdown_() that provide plugin type specific initializations.
Implementing a suitable PluginHandler is the second step besides defining the plugin interface itsself that is needed to create a new plugin api for BALL.
virtual BALL::PluginHandler::~PluginHandler | ( | ) | [virtual] |
A virtual destructor.
Does nothing at the moment.
virtual bool BALL::PluginHandler::canHandle | ( | BALLPlugin * | plugin | ) | const [pure virtual] |
This function is used to check whether this PluginHandler can initialize the passed plugin.
A usual implementation would be something like:
return qobject_cast<MyPlugin*>(plugin) != 0;
Implemented in BALL::VIEW::InputDevPluginHandler.
virtual bool BALL::PluginHandler::isRunning | ( | BALLPlugin * | plugin | ) | const [virtual] |
This function must check if the passed plugin has been started by this handler.
virtual bool BALL::PluginHandler::specificSetup_ | ( | BALLPlugin * | plugin | ) | [protected, pure virtual] |
A purely virtual function which is responsible for properly initialising the passed plugin instance.
The passed plugin may be assumed to be of a type that can be handled by this PluginHandler.
Implemented in BALL::VIEW::InputDevPluginHandler.
virtual bool BALL::PluginHandler::specificShutdown_ | ( | BALLPlugin * | plugin | ) | [protected, pure virtual] |
A purely virtual function which is responsible for properly deinitialising the passed plugin instance.
The passed plugin may be assumed to be of a type that can be handled by this PluginHandler.
Implemented in BALL::VIEW::InputDevPluginHandler.
bool BALL::PluginHandler::startPlugin | ( | BALLPlugin * | plugin | ) |
This function checks whether the plugin can be handled and if it is not already running.
Then the specificSetup()_ routine is called which should take care of all plugin specific initilizations.
If specificSetup_() returns true, the plugin is added to the list of already running plugins.
bool BALL::PluginHandler::stopPlugin | ( | BALLPlugin * | plugin | ) |
This function checks whether the plugin is currently running and atempts to stop it via the specificShutdown_() method.
On success the plugin is removed from the list of running plugins.