BALL 1.5.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BALL::PluginHandler Class Referenceabstract

#include <BALL/PLUGIN/pluginHandler.h>

Inheritance diagram for BALL::PluginHandler:
BALL::VIEW::InputDevPluginHandler BALL::VIEW::ModularWidgetPluginHandler BALL::VIEW::PluginDialog

Public Member Functions

virtual ~PluginHandler ()
 
virtual bool canHandle (BALLPlugin *plugin) const =0
 
bool startPlugin (BALLPlugin *plugin)
 
bool stopPlugin (BALLPlugin *plugin)
 
virtual bool isRunning (BALLPlugin *plugin) const
 

Protected Member Functions

virtual bool specificSetup_ (BALLPlugin *plugin)=0
 
virtual bool specificShutdown_ (BALLPlugin *plugin)=0
 

Protected Attributes

std::list< BALLPlugin * > running_plugins_
 

Detailed Description

A PluginHandler is a class that is responsible for initializing a certain plugin type. 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.

Definition at line 27 of file pluginHandler.h.

Constructor & Destructor Documentation

◆ ~PluginHandler()

virtual BALL::PluginHandler::~PluginHandler ( )
virtual

A virtual destructor. Does nothing at the moment.

Member Function Documentation

◆ canHandle()

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;

Returns
true if the handler can make use of the plugin, false otherwise

Implemented in BALL::VIEW::PluginDialog, BALL::VIEW::InputDevPluginHandler, and BALL::VIEW::ModularWidgetPluginHandler.

◆ isRunning()

virtual bool BALL::PluginHandler::isRunning ( BALLPlugin plugin) const
virtual

This function must check if the passed plugin has been started by this handler

Returns
true if the handler started the plugin, false otherwise

◆ specificSetup_()

virtual bool BALL::PluginHandler::specificSetup_ ( BALLPlugin plugin)
protectedpure 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.

Returns
true if the setup succeeded, false otherwise

Implemented in BALL::VIEW::PluginDialog, BALL::VIEW::InputDevPluginHandler, and BALL::VIEW::ModularWidgetPluginHandler.

◆ specificShutdown_()

virtual bool BALL::PluginHandler::specificShutdown_ ( BALLPlugin plugin)
protectedpure 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.

Returns
true if the deinitialization succeeded, false otherwise

Implemented in BALL::VIEW::PluginDialog, BALL::VIEW::InputDevPluginHandler, and BALL::VIEW::ModularWidgetPluginHandler.

◆ startPlugin()

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.

Returns
true if the plugin could be started, false otherwise.

◆ stopPlugin()

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.

Returns
true if the plugin could be stopped, false otherwise.

Member Data Documentation

◆ running_plugins_

std::list<BALLPlugin*> BALL::PluginHandler::running_plugins_
protected

The list of plugins this handler is responsible for. Plugins should only be added/removed by using start/stopPlugin

Definition at line 101 of file pluginHandler.h.