itom
|
class for AddIn management More...
#include <addInManager.h>
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::FilterParams * | getHashedFilterParams (ito::AddInAlgo::t_filterParam filterParam) const |
const QList< struct PluginLoadStatus > | getPluginLoadStatus () const |
const AlgoInterfaceValidator * | getAlgoInterfaceValidator (void) const |
const ito::AddInAlgo::AlgoWidgetDef * | getAlgoWidgetDef (QString algoWidgetName, QString algoPluginName=QString()) |
PlugInModel * | getPluginModel (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 > *¶msMand, QVector< ito::Param > *¶msOpt) |
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 AddInManager * | createInstance (QString itomSettingsFile, void **apiFuncsGraph, QObject *mainWindow=NULL, QObject *mainApplication=NULL) |
static RetVal | closeInstance () |
static AddInManager * | instance () |
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< AddInManagerPrivate > | d_ptr |
Static Private Attributes | |
static AddInManager * | staticInstance = NULL |
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.
|
private |
private constructor. Use createInstance to get an instance of AddInManager
|
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.
|
slot |
close passed plugin
closeAddIn close an instance of an actuator addIn object
[in] | addIn | the addIn to close |
At first the close method of the plugin class is invoked. Then the closeInst method of the addInInterfaceBase is called.
|
static |
close the singleton class of AddInManager
closeInstance
closes the instance of the AddInManager - should only be called at the very closing of the main program
|
static |
create a new instance of AddInManager as singleton class or returns the recently opened instance
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
[in] | addIn | the addIn to increment reference |
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
const QList< QObject * > * ito::AddInManager::getActList | ( | void | ) | const |
return list of actuator plugins
void * ito::AddInManager::getAddInPtr | ( | const int | itemNum | ) |
get plugin pointer
const QList< QObject * > * ito::AddInManager::getAlgList | ( | void | ) | const |
return list of algorithm plugins
const AlgoInterfaceValidator * ito::AddInManager::getAlgoInterfaceValidator | ( | void | ) | const |
const ito::AddInAlgo::AlgoWidgetDef * ito::AddInManager::getAlgoWidgetDef | ( | QString | algoWidgetName, |
QString | algoPluginName = QString() ) |
const QHash< QString, ito::AddInAlgo::AlgoWidgetDef * > * ito::AddInManager::getAlgoWidgetList | ( | void | ) | const |
return list of algorithm widgets
const QList< QObject * > * ito::AddInManager::getDataIOList | ( | void | ) | const |
return list of all dataIO plugins
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
iface | |
tag |
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
iface | |
cat | |
tag |
const QHash< QString, ito::AddInAlgo::FilterDef * > * ito::AddInManager::getFilterList | ( | void | ) | const |
return list of all filters
const QList< ito::AddInAlgo::FilterDef * > ito::AddInManager::getFiltersByCategory | ( | ito::AddInAlgo::tAlgoCategory | cat | ) | const |
return list of filter matching the passed category
cat |
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
filterParam | filterParam |
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
[in] | name | plugin name for which the initialisation parameters should be retrieved |
[in] | pluginType | plugin type, i.e. in which of the plugin lists should be searched for the plugin |
[out] | pluginNum | number of the plugin in the plugin list, this number is needed later to create an instance of the plugin class |
[out] | paramsMand | mandatory initialisation parameters |
[out] | paramsOpt | optional initialisation parameters |
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.
int ito::AddInManager::getItemIndexInList | ( | const void * | item | ) |
get index in plugin list based on plugin pointer
void ** ito::AddInManager::getItomApiFuncsPtr | ( | void | ) |
return itomApi functions pointer (e.g. used in plugins to call itom api functions)
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
[in] | name | plugin name for which type and number should be retrieved |
[out] | pluginType | plugin type, i.e. in which of the plugin lists should be searched for the plugin |
[out] | pluginNum | number of the plugin in the plugin list, this number is needed later to create an instance of the plugin class |
[out] | pluginTypeString | type of the plugin as string |
[out] | author | author name or company |
[out] | description | short description of the plugin |
[out] | detaildescription | detail description of the plugin |
[out] | version | plugin version number |
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!).
const QList< PluginLoadStatus > ito::AddInManager::getPluginLoadStatus | ( | ) | const |
return status of all plugins
PlugInModel * ito::AddInManager::getPluginModel | ( | void | ) |
returns pointer to plugin model, usable in a model/view relationship
int ito::AddInManager::getTotalNumAddIns | ( | void | ) | const |
returns the overall number of loaded plugins
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
[in] | addIn | the addIn to increment reference |
The method increments the reference counter of the addin.
|
slot |
initialize actuator plugin based on number and name
initAddIn initialize new instance of a actuator addIn class
[in] | pluginNum | number of the plugin in the plugin list, retrieved with getInitParams |
[in] | name | name 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] | addIn | pointer to the new instance of the plugin class |
[in] | paramsMand | mandatory 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] | paramsOpt | mandatory 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] | aimWait | wait condition for calls from other threads. See also ItomSharedSemaphore |
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.
|
slot |
initialize algorithm plugin based on number and name
initAddIn initialize new instance of a algo addIn class
[in] | pluginNum | number of the plugin in the plugin list, retrieved with getInitParams |
[in] | name | name 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] | addIn | pointer to the new instance of the plugin class |
[in] | paramsMand | mandatory 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] | paramsOpt | mandatory 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 |
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.
|
slot |
initialize dataIO plugin based on number and name
initAddIn initialize new instance of a dataIO addIn class
[in] | pluginNum | number of the plugin in the plugin list, retrieved with getInitParams |
[in] | name | name 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] | addIn | pointer to the new instance of the plugin class |
[in] | paramsMand | mandatory 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] | paramsOpt | mandatory 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] | aimWait | wait condition for calls from other threads. See also ItomSharedSemaphore |
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.
|
inlinestatic |
returns the instantiated singleton class or NULL if it has not been loaded, yet
|
slot |
interrupts all active actuator instances
bool ito::AddInManager::isPluginInstanceDead | ( | const ito::AddInBase * | plugin | ) | const |
check if given instance of plugin still reacts
plugin |
|
private |
self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)
const ito::RetVal ito::AddInManager::reloadAddIn | ( | const QString & | name | ) |
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
path | directory path to search in (currently unused) |
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)
const ito::RetVal ito::AddInManager::setMainWindow | ( | QObject * | mainWindow | ) |
pass main window pointer to addInManager, which is used for the construction / displaying of plugin widgets
const ito::RetVal ito::AddInManager::setTimeOuts | ( | const int | initClose, |
const int | general ) |
set plugin time outs (initialization / closing and general)
|
slot |
show plugin configuration dialog, don't call this method if no Qt gui application is available.
showConfigDialog show the plugin's configuration dialog
[in] | addin | addin 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.
|
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
[in] | addin | addin from which the dialog should be called |
[in] | visible | 1=show, 0=hide, -1=toggle |
[in,out] | waitCond | wait 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.
|
signal |
show plugin load splash screen
void ito::AddInManager::updateModel | ( | void | ) |
forces the plugin model to be updated
|
private |
static instance pointer