itom  4.1.0
ito::AddInManager Class Reference

class for AddIn management More...

#include <addInManager.h>

Inheritance diagram for ito::AddInManager:

Public Slots

ito::RetVal showConfigDialog (ito::AddInBase *addin, ItomSharedSemaphore *waitCond=NULL)
 

show plugin configuration dialog, don't call this method if no Qt gui application is available.

More...
 
ito::RetVal showDockWidget (ito::AddInBase *addin, int visible, ItomSharedSemaphore *waitCond=NULL)
 

show plugin dock widget, don't call this method if no Qt gui application is available.

More...
 
ito::RetVal initAddIn (const int pluginNum, const QString &name, ito::AddInDataIO **addIn, QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait=NULL)
 

initialize dataIO plugin based on number and name

More...
 
ito::RetVal initAddIn (const int pluginNum, const QString &name, ito::AddInActuator **addIn, QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait=NULL)
 

initialize actuator plugin based on number and name

More...
 
ito::RetVal initAddIn (const int pluginNum, const QString &name, ito::AddInAlgo **addIn, QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait=NULL)
 

initialize algorithm plugin based on number and name

More...
 
ito::RetVal closeAddIn (ito::AddInBase *addIn, ItomSharedSemaphore *aimWait=NULL)
 

close passed plugin

More...
 
ito::RetVal interruptAllActuatorInstances (ItomSharedSemaphore *aimWait=NULL)
 

interrupts all active actuator instances


 

Signals

void splashLoadMessage (const QString &message)
 

show plugin load splash screen


 

Public Member Functions

const RetVal scanAddInDir (const QString &path, const int checkQCoreApp=1)
 
const QList< QObject * > * getDataIOList (void) const
 

return list of all dataIO plugins


 
const QList< QObject * > * getActList (void) const
 

return list of actuator plugins


 
const QList< QObject * > * getAlgList (void) const
 

return list of algorithm plugins


 
const QHash< QString, ito::AddInAlgo::FilterDef * > * getFilterList (void) const
 

return list of all filters


 
const QHash< QString, ito::AddInAlgo::AlgoWidgetDef * > * getAlgoWidgetList (void) const
 

return list of algorithm widgets


 
const ito::FilterParamsgetHashedFilterParams (ito::AddInAlgo::t_filterParam filterParam) const
 

return parameters used for / within a filter based on the filter function pointer

More...
 
const QList< struct PluginLoadStatusgetPluginLoadStatus () const
 

return status of all plugins


 
const AlgoInterfaceValidatorgetAlgoInterfaceValidator (void) const
 >
 
const ito::AddInAlgo::AlgoWidgetDefgetAlgoWidgetDef (QString algoWidgetName, QString algoPluginName=QString())
 > More...
 
PlugInModelgetPluginModel (void)
 

returns pointer to plugin model, usable in a model/view relationship


 
const RetVal reloadAddIn (const QString &name)
 

Reload plugin library (dll)

More...
 
int getTotalNumAddIns (void) const
 

returns the overall number of loaded plugins


 
void * getAddInPtr (const int itemNum)
 

get plugin pointer


 
int getItemIndexInList (const void *item)
 

get index in plugin list based on plugin pointer


 
void updateModel (void)
 

forces the plugin model to be updated


 
const RetVal getInitParams (const QString &name, const int pluginType, int *pluginNum, QVector< ito::Param > *&paramsMand, QVector< ito::Param > *&paramsOpt)
 

get parameters for plugin initialization, based on plugin number getItemIndexList

More...
 
const RetVal getAboutInfo (const QString &name, QString &versionString)
 

returns the a string containing the about string based on plugin number and type

More...
 
const RetVal getPluginInfo (const QString &name, int &pluginType, int &pluginNum, int &version, QString &typeString, QString &author, QString &description, QString &detaildescription, QString &license, QString &about)
 

return plugin information based on plugin number and type

More...
 
const RetVal incRef (ito::AddInBase *plugin)
 

increment plugin reference counter, use e.g. when making a copy of the plugin pointer to avoid plugin being closed while still holding a reference

More...
 
const RetVal decRef (ito::AddInBase **plugin)
 

decrement plugin reference counter, use to ensure proper closing / deletion of plugin after incrementing reference counter

More...
 
const RetVal setTimeOuts (const int initClose, const int general)
 

set plugin time outs (initialization / closing and general)


 
const RetVal setMainWindow (QObject *mainWindow)
 

pass main window pointer to addInManager, which is used for the construction / displaying of plugin widgets


 
bool isPluginInstanceDead (const ito::AddInBase *plugin) const
 

check if given instance of plugin still reacts

More...
 
const QList< ito::AddInAlgo::FilterDef * > getFilterByInterface (ito::AddInAlgo::tAlgoInterface iface, const QString tag=QString::Null()) const
 

return list of filter matching the passed interface

More...
 
const QList< ito::AddInAlgo::FilterDef * > getFiltersByCategory (ito::AddInAlgo::tAlgoCategory cat) const
 

return list of filter matching the passed category

More...
 
const QList< ito::AddInAlgo::FilterDef * > getFilterByInterfaceAndCategory (ito::AddInAlgo::tAlgoInterface iface, ito::AddInAlgo::tAlgoCategory cat, const QString tag=QString::Null()) const
 

return list of filter matching the passed interface and category

More...
 
void ** getItomApiFuncsPtr (void)
 

return itomApi functions pointer (e.g. used in plugins to call itom api functions)


 

Static Public Member Functions

static AddInManagercreateInstance (QString itomSettingsFile, void **apiFuncsGraph, QObject *mainWindow=NULL, QObject *mainApplication=NULL)
 

create a new instance of AddInManager as singleton class or returns the recently opened instance


 
static RetVal closeInstance ()
 

close the singleton class of AddInManager

More...
 
static AddInManagerinstance ()
 

returns the instantiated singleton class or NULL if it has not been loaded, yet


 

Private Member Functions

 AddInManager (QString itomSettingsFile, void **apiFuncsGraph, QObject *mainWindow=NULL, QObject *mainApplication=NULL)
 

private constructor. Use createInstance to get an instance of AddInManager


 
 ~AddInManager (void)
 
 Q_DECLARE_PRIVATE (AddInManager)
 

self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)


 
 Q_DISABLE_COPY (AddInManager)
 

Private Attributes

QScopedPointer< AddInManagerPrivated_ptr
 

static instance pointer


 

Static Private Attributes

static AddInManagerstaticInstance = NULL
 

Detailed Description

class for AddIn management

This class is internally used for plugin handling, i.e. detecting available plugins which can be loaded, maintaining a list (widget AddInModel) of available and loaded plugins, loading and unloading of plugins. The plugins themselfs are based on the addInInterface, declared in addInInterface. The AddInManager is implemented as singleton class because it must exist only one instance of it (which would also be possible using a static class) but which also does a clean up of the instantiated plugin classes at program exit.

Constructor & Destructor Documentation

ito::AddInManager::~AddInManager ( void  )
private

destructor, closes all instances of plugins and plugins

Before the AddInManager itself is closed it closes all instances of plugins that are in the plugins' instance lists. Afterwards the AddInInterfaceBase for each plugin (i.e. the library) is closed an it is removed from the plugin list. This is done for dataIO, actuator and algo plugins.

Member Function Documentation

ito::RetVal ito::AddInManager::closeAddIn ( ito::AddInBase addIn,
ItomSharedSemaphore aimWait = NULL 
)
slot

close passed plugin

closeAddIn close an instance of an actuator addIn object

Parameters
[in]addInthe addIn to close
Returns
on success ito::retOk, ito::retError otherwise

At first the close method of the plugin class is invoked. Then the closeInst method of the addInInterfaceBase is called.

RetVal ito::AddInManager::closeInstance ( void  )
static

close the singleton class of AddInManager

closeInstance

Returns
ito::retOk

closes the instance of the AddInManager - should only be called at the very closing of the main program

const ito::RetVal ito::AddInManager::decRef ( ito::AddInBase **  addIn)

decrement plugin reference counter, use to ensure proper closing / deletion of plugin after incrementing reference counter

decRef decrement reference counter of addin and close it if necessary

Parameters
[in]addInthe addIn to increment reference
Returns
on success ito::retOk, ito::retError otherwise

The method decrements the reference counter of the addin.

const RetVal ito::AddInManager::getAboutInfo ( const QString &  name,
QString &  versionString 
)

returns the a string containing the about string based on plugin number and type

getAboutString

Parameters
[in]nameplugin name for which type and number should be retrieved
[out]versionStringplugin version string
Returns
ito::retOk on success ito::retError otherwise

The getVersionString method searches in all three plugin lists for a plugin wirh the name 'name'. In case the according plugin is found its inforamtion about the plugin version string is returned. In contrast to the version number returned by the function 'getPluginInfo' the plugin version string can also handle alphanumerical signs.

const ito::AddInAlgo::AlgoWidgetDef * ito::AddInManager::getAlgoWidgetDef ( QString  algoWidgetName,
QString  algoPluginName = QString() 
)

>

Parameters
algoWidgetNamealgoPluginName
algoPluginName
Returns
ito::AddInAlgo::AlgoWidgetDef
const QList< ito::AddInAlgo::FilterDef * > ito::AddInManager::getFilterByInterface ( ito::AddInAlgo::tAlgoInterface  iface,
const QString  tag = QString::Null() 
) const

return list of filter matching the passed interface

Parameters
iface
tag
Returns
QList<ito::AddInAlgo::FilterDef *>
const QList< ito::AddInAlgo::FilterDef * > ito::AddInManager::getFilterByInterfaceAndCategory ( ito::AddInAlgo::tAlgoInterface  iface,
ito::AddInAlgo::tAlgoCategory  cat,
const QString  tag = QString::Null() 
) const

return list of filter matching the passed interface and category

Parameters
iface
cat
tag
Returns
QList<ito::AddInAlgo::FilterDef
const QList< ito::AddInAlgo::FilterDef * > ito::AddInManager::getFiltersByCategory ( ito::AddInAlgo::tAlgoCategory  cat) const

return list of filter matching the passed category

Parameters
cat
Returns
QList<ito::AddInAlgo::FilterDef *>
const ito::FilterParams * ito::AddInManager::getHashedFilterParams ( ito::AddInAlgo::t_filterParam  filterParam) const

return parameters used for / within a filter based on the filter function pointer

Parameters
filterParamfilterParam
Returns
ito::FilterParams
const RetVal ito::AddInManager::getInitParams ( const QString &  name,
const int  pluginType,
int *  pluginNum,
QVector< ito::Param > *&  paramsMand,
QVector< ito::Param > *&  paramsOpt 
)

get parameters for plugin initialization, based on plugin number getItemIndexList

getInitParams

Parameters
[in]nameplugin name for which the initialisation parameters should be retrieved
[in]pluginTypeplugin type, i.e. in which of the plugin lists should be searched for the plugin
[out]pluginNumnumber of the plugin in the plugin list, this number is needed later to create an instance of the plugin class
[out]paramsMandmandatory initialisation parameters
[out]paramsOptoptional initialisation parameters
Returns
ito::retOk on success ito::retError otherwise

The getInitParams method searchs the plugin list given by plugin type for a plugin with the name 'name'. In case the according plugin is found its number, mandatory and optional initialisation parameters are returned.

Please consider that this method returns pointers to the original initialization parameter vectors. If you change the value of these elements consider to copy the complete vector.

const RetVal ito::AddInManager::getPluginInfo ( const QString &  name,
int &  pluginType,
int &  pluginNum,
int &  version,
QString &  typeString,
QString &  author,
QString &  description,
QString &  detaildescription,
QString &  license,
QString &  about 
)

return plugin information based on plugin number and type

getPlugInInfo

Parameters
[in]nameplugin name for which type and number should be retrieved
[out]pluginTypeplugin type, i.e. in which of the plugin lists should be searched for the plugin
[out]pluginNumnumber of the plugin in the plugin list, this number is needed later to create an instance of the plugin class
[out]pluginTypeStringtype of the plugin as string
[out]authorauthor name or company
[out]descriptionshort discribtion of the plugin
[out]detaildescriptiondetail discription of the plugin
[out]versionplugin version number
Returns
ito::retOk on success ito::retError otherwise

The getPlugInInfo method searchs in all three plugin lists for a plugin with the name 'name'. In case the according plugin is found its information about number, name ... returned. For all parameters of type char** provide the address to a char*-variable. Then, a newly allocated \0-terminated string is returned. Don't forget to free this pointer after using it (free not delete!).

const ito::RetVal ito::AddInManager::incRef ( ito::AddInBase addIn)

increment plugin reference counter, use e.g. when making a copy of the plugin pointer to avoid plugin being closed while still holding a reference

incRef increment reference counter of addin

Parameters
[in]addInthe addIn to increment reference
Returns
on success ito::retOk, ito::retError otherwise

The method increments the reference counter of the addin.

ito::RetVal ito::AddInManager::initAddIn ( const int  pluginNum,
const QString &  name,
ito::AddInDataIO **  addIn,
QVector< ito::ParamBase > *  paramsMand,
QVector< ito::ParamBase > *  paramsOpt,
bool  autoLoadPluginParams,
ItomSharedSemaphore aimWait = NULL 
)
slot

initialize dataIO plugin based on number and name

initAddIn initialize new instance of a dataIO addIn class

Parameters
[in]pluginNumnumber of the plugin in the plugin list, retrieved with getInitParams
[in]namename of the plugin to be initialized, this just a check that number and name correspond, principally it should not be necessary to pass the name
[out]addInpointer to the new instance of the plugin class
[in]paramsMandmandatory initialisation parameters which are required by the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
[in]paramsOptmandatory initialisation parameters which may optionally be passed to the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
[in,out]aimWaitwait condition for calls from other threads. See also ItomSharedSemaphore
Returns
on success ito::retOk, ito::retError otherwise

A new instance from the addIn class is created then the newly created object is moved into a new thread. Afterwards the classes init method is invoked with the passed mandatory and optional parameters. As a last step the plugins parameters are loaded from the plugins parameters xml file loadParamVals.

ito::RetVal ito::AddInManager::initAddIn ( const int  pluginNum,
const QString &  name,
ito::AddInActuator **  addIn,
QVector< ito::ParamBase > *  paramsMand,
QVector< ito::ParamBase > *  paramsOpt,
bool  autoLoadPluginParams,
ItomSharedSemaphore aimWait = NULL 
)
slot

initialize actuator plugin based on number and name

initAddIn initialize new instance of a actuator addIn class

Parameters
[in]pluginNumnumber of the plugin in the plugin list, retrieved with getInitParams
[in]namename of the plugin to be initialized, this just a check that number and name correspond, principally it should not be necessary to pass the name
[out]addInpointer to the new instance of the plugin class
[in]paramsMandmandatory initialisation parameters which are required by the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
[in]paramsOptmandatory initialisation parameters which may optionally be passed to the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
[in,out]aimWaitwait condition for calls from other threads. See also ItomSharedSemaphore
Returns
on success ito::retOk, ito::retError otherwise

A new instance from the addIn class is created then the newly created object is moved into a new thread. Afterwards the classes init method is invoked with the passed mandatory and optional parameters. As a last step the plugins parameters are loaded from the plugins parameters xml file loadParamVals.

ito::RetVal ito::AddInManager::initAddIn ( const int  pluginNum,
const QString &  name,
ito::AddInAlgo **  addIn,
QVector< ito::ParamBase > *  paramsMand,
QVector< ito::ParamBase > *  paramsOpt,
bool  autoLoadPluginParams,
ItomSharedSemaphore aimWait = NULL 
)
slot

initialize algorithm plugin based on number and name

initAddIn initialize new instance of a algo addIn class

Parameters
[in]pluginNumnumber of the plugin in the plugin list, retrieved with getInitParams
[in]namename of the plugin to be initialized, this just a check that number and name correspond, principally it should not be necessary to pass the name
[out]addInpointer to the new instance of the plugin class
[in]paramsMandmandatory initialisation parameters which are required by the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
[in]paramsOptmandatory initialisation parameters which may optionally be passed to the initialisation. As this vector should(must) be retrieved from the plugin previously with the getInitParams method it should always be filled with meaningful values
Returns
on success ito::retOk, ito::retError otherwise

new instance from the addIn class is created. In contrast to the dataIO and actuator plugins the new object is not moved to a new thread and no init method is called. As a last step the plugins parameters are loaded from the plugins parameters xml file loadParamVals.

bool ito::AddInManager::isPluginInstanceDead ( const ito::AddInBase plugin) const

check if given instance of plugin still reacts

Parameters
plugin
Returns
bool
const ito::RetVal ito::AddInManager::reloadAddIn ( const QString &  name)

Reload plugin library (dll)

Parameters
name
Returns
ito::RetVal
const RetVal ito::AddInManager::scanAddInDir ( const QString &  path,
const int  checkQCoreApp = 1 
)

scan directory at path for loadable plugins, if checkQCoreApp is 1 it is checked wether an instance of Q(Core)Application is already running, which is necessary for multithreading, i.e. asyncronous use of plugins. If no instance is found a new one is created

scanAddInDir

Parameters
pathdirectory path to search in (currently unused)
Returns
returns ito::retOk on success otherwise ito::retError

This method searches the plugin directory which is currently assumed to be in the main programs folder and must habe the name "plugins" for loadable plugins. The found plugins are sorted into the three lists with the available plugins (ito::AddInManager::m_addInListDataIO, ito::AddInManager::m_addInListAct, ito::AddInManager::m_addInListAlg)

ito::RetVal ito::AddInManager::showConfigDialog ( ito::AddInBase addin,
ItomSharedSemaphore waitCond = NULL 
)
slot

show plugin configuration dialog, don't call this method if no Qt gui application is available.

showConfigDialog show the plugin's configuration dialog

Parameters
[in]addinaddin from which the dialog should be called

This method opens the configuration dialog of a plugin. The dialog can be opened using a right click on an instance of the plugin in the addInModel list or using showConfiguration command in python. An implementation of a configuration dialog is not mandatory, so in case there is no dialog implemented nothing happens.

ito::RetVal ito::AddInManager::showDockWidget ( ito::AddInBase addin,
int  visible,
ItomSharedSemaphore waitCond = NULL 
)
slot

show plugin dock widget, don't call this method if no Qt gui application is available.

showDockWidget show or hide the plugin's widget

Parameters
[in]addinaddin from which the dialog should be called
[in]visible1=show, 0=hide, -1=toggle
[in,out]waitCondwait condition for calls from other threads. See also ItomSharedSemaphore

This method opens or closes the widget of a plugin. The widget can be opened or closed using a right click on an instance of the plugin in the addInModel list or using showToolbox or hideToolbox command in python. An implementation of a configuration dialog is not mandatory, so in case there is no dialog implemented nothing happens.


The documentation for this class was generated from the following files: