itom
Loading...
Searching...
No Matches
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)
 
ito::RetVal showDockWidget (ito::AddInBase *addin, int visible, ItomSharedSemaphore *waitCond=NULL)
 
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)
 
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)
 
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)
 
ito::RetVal closeAddIn (ito::AddInBase *addIn, ItomSharedSemaphore *aimWait=NULL)
 
ito::RetVal interruptAllActuatorInstances (ItomSharedSemaphore *aimWait=NULL)
 

Signals

void splashLoadMessage (const QString &message)
 

Public Member Functions

const RetVal scanAddInDir (const QString &path, const int checkQCoreApp=1)
 
const QList< QObject * > * getDataIOList (void) const
 
const QList< QObject * > * getActList (void) const
 
const QList< QObject * > * getAlgList (void) const
 
const QHash< QString, ito::AddInAlgo::FilterDef * > * getFilterList (void) const
 
const QHash< QString, ito::AddInAlgo::AlgoWidgetDef * > * getAlgoWidgetList (void) const
 
const ito::FilterParamsgetHashedFilterParams (ito::AddInAlgo::t_filterParam filterParam) const
 
const QList< struct PluginLoadStatusgetPluginLoadStatus () const
 
const AlgoInterfaceValidatorgetAlgoInterfaceValidator (void) const
 
const ito::AddInAlgo::AlgoWidgetDefgetAlgoWidgetDef (QString algoWidgetName, QString algoPluginName=QString())
 
PlugInModelgetPluginModel (void)
 
const RetVal reloadAddIn (const QString &name)
 
int getTotalNumAddIns (void) const
 
void * getAddInPtr (const int itemNum)
 
int getItemIndexInList (const void *item)
 
void updateModel (void)
 
const RetVal getInitParams (const QString &name, const int pluginType, int *pluginNum, QVector< ito::Param > *&paramsMand, QVector< ito::Param > *&paramsOpt)
 
const RetVal getAboutInfo (const QString &name, QString &versionString)
 
const RetVal getPluginInfo (const QString &name, int &pluginType, int &pluginNum, int &version, QString &typeString, QString &author, QString &description, QString &detaildescription, QString &license, QString &about)
 
const RetVal incRef (ito::AddInBase *plugin)
 
const RetVal decRef (ito::AddInBase **plugin)
 
const RetVal setTimeOuts (const int initClose, const int general)
 
const RetVal setMainWindow (QObject *mainWindow)
 
bool isPluginInstanceDead (const ito::AddInBase *plugin) const
 
const QList< ito::AddInAlgo::FilterDef * > getFilterByInterface (ito::AddInAlgo::tAlgoInterface iface, const QString tag=QString()) const
 
const QList< ito::AddInAlgo::FilterDef * > getFiltersByCategory (ito::AddInAlgo::tAlgoCategory cat) const
 
const QList< ito::AddInAlgo::FilterDef * > getFilterByInterfaceAndCategory (ito::AddInAlgo::tAlgoInterface iface, ito::AddInAlgo::tAlgoCategory cat, const QString tag=QString()) const
 
void ** getItomApiFuncsPtr (void)
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

QScopedPointer< AddInManagerPrivated_ptr
 

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 themselves 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

◆ AddInManager()

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

‍private constructor. Use createInstance to get an instance of AddInManager

◆ ~AddInManager()

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

◆ closeAddIn

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.

◆ closeInstance()

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

◆ createInstance()

AddInManager * ito::AddInManager::createInstance ( QString itomSettingsFile,
void ** apiFuncsGraph,
QObject * mainWindow = NULL,
QObject * mainApplication = NULL )
static

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

◆ decRef()

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.

◆ getAboutInfo()

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

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

◆ getActList()

const QList< QObject * > * ito::AddInManager::getActList ( void ) const

‍return list of actuator plugins

◆ getAddInPtr()

void * ito::AddInManager::getAddInPtr ( const int itemNum)

‍get plugin pointer

◆ getAlgList()

const QList< QObject * > * ito::AddInManager::getAlgList ( void ) const

‍return list of algorithm plugins

◆ getAlgoInterfaceValidator()

const AlgoInterfaceValidator * ito::AddInManager::getAlgoInterfaceValidator ( void ) const

◆ getAlgoWidgetDef()

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

Parameters
algoWidgetNamealgoPluginName
algoPluginName
Returns
ito::AddInAlgo::AlgoWidgetDef

◆ getAlgoWidgetList()

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

‍return list of algorithm widgets

◆ getDataIOList()

const QList< QObject * > * ito::AddInManager::getDataIOList ( void ) const

‍return list of all dataIO plugins

◆ getFilterByInterface()

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

‍return list of filter matching the passed interface

Parameters
iface
tag
Returns
QList<ito::AddInAlgo::FilterDef *>

◆ getFilterByInterfaceAndCategory()

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

‍return list of filter matching the passed interface and category

Parameters
iface
cat
tag
Returns
QList<ito::AddInAlgo::FilterDef

◆ getFilterList()

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

‍return list of all filters

◆ getFiltersByCategory()

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 *>

◆ getHashedFilterParams()

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

◆ getInitParams()

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 searches 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.

◆ getItemIndexInList()

int ito::AddInManager::getItemIndexInList ( const void * item)

‍get index in plugin list based on plugin pointer

◆ getItomApiFuncsPtr()

void ** ito::AddInManager::getItomApiFuncsPtr ( void )

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

◆ getPluginInfo()

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 description of the plugin
[out]detaildescriptiondetail description of the plugin
[out]versionplugin version number
Returns
ito::retOk on success ito::retError otherwise

The getPlugInInfo method searches 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!).

◆ getPluginLoadStatus()

const QList< PluginLoadStatus > ito::AddInManager::getPluginLoadStatus ( ) const

‍return status of all plugins

◆ getPluginModel()

PlugInModel * ito::AddInManager::getPluginModel ( void )

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

◆ getTotalNumAddIns()

int ito::AddInManager::getTotalNumAddIns ( void ) const

‍returns the overall number of loaded plugins

◆ incRef()

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.

◆ initAddIn [1/3]

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.

◆ initAddIn [2/3]

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.

◆ initAddIn [3/3]

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.

◆ instance()

static AddInManager * ito::AddInManager::instance ( )
inlinestatic

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

◆ interruptAllActuatorInstances

ito::RetVal ito::AddInManager::interruptAllActuatorInstances ( ItomSharedSemaphore * aimWait = NULL)
slot

‍interrupts all active actuator instances

◆ isPluginInstanceDead()

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

‍check if given instance of plugin still reacts

Parameters
plugin
Returns
bool

◆ Q_DECLARE_PRIVATE()

ito::AddInManager::Q_DECLARE_PRIVATE ( AddInManager )
private

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

◆ reloadAddIn()

const ito::RetVal ito::AddInManager::reloadAddIn ( const QString & name)

‍Reload plugin library (dll)

Parameters
name
Returns
ito::RetVal

◆ scanAddInDir()

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 whether an instance of Q(Core)Application is already running, which is necessary for multithreading, i.e. asynchronous 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)

◆ setMainWindow()

const ito::RetVal ito::AddInManager::setMainWindow ( QObject * mainWindow)

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

◆ setTimeOuts()

const ito::RetVal ito::AddInManager::setTimeOuts ( const int initClose,
const int general )

‍set plugin time outs (initialization / closing and general)

◆ showConfigDialog

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.

◆ showDockWidget

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.

◆ splashLoadMessage

void ito::AddInManager::splashLoadMessage ( const QString & message)
signal

‍show plugin load splash screen

◆ updateModel()

void ito::AddInManager::updateModel ( void )

‍forces the plugin model to be updated

Member Data Documentation

◆ d_ptr

QScopedPointer<AddInManagerPrivate> ito::AddInManager::d_ptr
private

‍static instance pointer


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