class ito::AddInBase

Base class for all plugins.

The common methods and members are defined here. The available plugin type (actuator AddInActuator, dataIO AddInDataIO and algo AddInAlgo) are derived from this class. At the main program startup all available plugins located in the plugin directory are searched and matched against the current plugin interface version. Then all compatible plugins can be check with the AddInManager. Up to that stage for each plugin only a lightweight AddInInterface AddInInterfaceBase class has been loaded. To use a plugin instances of the plugin class have to be instantiated. The AddInInterface is run in the calling thread whilst the plugin classes are run in separate threads. Therefore the plugin functions are implemented as slots which can be used e.g. with the invokeMethod function. The base functionality included in this base class is getting the plugin’s parameter list, getting the classes uniqueID (which is used e.g. for saveing the parameter values) and optinally to bring up a configuration dialog.

Public Functions

const Param getParamRec(const QString name, bool * nameCheckOk = NULL)

method to retrieve a parameter from the parameter map (m_params)

returns parameter from m_params vector. If the parameter could not be found or if the given name is invalid an invalid Param is returned. If you provide the nameCheckOk-pointer, you will return a boolean value describing whether your name matched the possible regular expression.

The parameter name, that is search can have the following form:

until now, the Idx is ignored by this method.

Param as copy of the internal m_params-map or empty Param, if name could not be resolved or found
  • name -

    is the name of the parameter

  • nameCheckOk -

    returns true if name corresponds to the necessary syntax, else false

AddInInterfaceBase * getBasePlugin(void)

returns the interface of this instance.


ito::RetVal MoveToThread(void)

creates new thread for the class instance and moves this instance to the new thread

const ito::RetVal getParamList(QMap< QString, Param > ** paramNames)

returns a map with the parameters of this plugin.

const ito::RetVal getExecFuncList(QMap< QString, ExecFuncParams > ** funcs)

returns list of registered additional functions

int getID()

retrieve the uniqueID of this instance

QString getIdentifier()

retrieve the unique identifier of this instance

int hasConfDialog(void)

determine if a configuration dialog is available

method indicates whether this plugin instance has a configuration dialog.

Overwrite this method if your plugin provides such a configuration dialog by simply returning 1 instead of 0.

0 since the base implementation of a plugin does not have a configuration dialog. If there is a configuration dialog overwrite this method and return 1.

const ito::RetVal showConfDialog(void)

open configuration dialog

method called if the configuration dialog of the plugin should be shown.

Overwrite this method if your plugin provides a configuration dialog. This method is directly called by the main (GUI) thread. Therefore you can directly show your configuration dialog, connect it with signals and slots of your plugin instance (which possibly is executed in another thread), wait for any commands or that the dialog is closed and handle the result.

retWarning since you have to overwrite this method in order to show your configuration dialog.

int createdByGUI()

returns true if this instance has firstly been created by the GUI

void setCreatedByGUI(int value)

method to set whether this instance has been firstly created by the GUI (true) or by any other component (Python, C++, other plugin,..) (false)

int getRefCount(void)

Returns the reference counter of this instance.

bool hasDockWidget(void)

Returns true if this plugin provides a dock widget, that can be shown in the main window.

QDockWidget * getDockWidget(void)

Returns the reference to the dock widget of this plugin or NULL, if no dock widget is provided.

void dockWidgetDefaultStyle(bool & floating, bool & visible, Qt::DockWidgetArea & defaultArea)

returns default style properties for dock-widget of plugin

int isAlive(void)

returns the alive-flag of this plugin

void setAlive(void)

sets the alive-flag to 1 (“still alive”)

bool isInitialized(void)

returns in a thread-safe way the status of the m_initialized-member variable. This variable should be set to true at the end of the init-method.

void setInitialized(bool initialized)

sets in a thread-safe way the status of the m_initialized-member

QVector< ito::AddInBase::AddInRef * > * getArgAddIns(void)

returns vector of AddInRef instances.

Public Slot

ito::RetVal init

method for the initialisation of a new instance of the class (must be overwritten)

ito::RetVal close

method for closing an instance (must be overwritten)

ito::RetVal getParam

method for the retrieval of a parameter. The actual value is always passed as ito::Param (must be overwritten). See also setParam

ito::RetVal setParam

method to set a parameter. The actual value is always passed as ito::ParamBase (must be overwritten). See also getParam

ito::RetVal setParamVector

method for setting various parameters in a sequence

Using this method, only one over-thread call needs to be executed in order to set various parameters by calling setParam for each parameter.

setParam, ParamBase
  • values -

    is a vector of parameters to set

  • waitCond -

    is the locked semaphore that is released at the end of the method.

ito::RetVal execFunc

this method can handle additional functions of your plugin.

Use registerExecFunc to register a specific function name and a set of mandatory and optional default parameters. It one on those functions is called (for instance by a python-call), this method is executed. Implement a switch case for the function name and start the execution. The mandatory and optional parameters are handled like it is the case for the creation (init-method) of a plugin. Additionally define an optional vector of output parameters, that are finally filled with a valid input during the execution of the function.

registerExecFunc, init
  • funcName -

    is the function name

  • paramsMand -

    is the vector of mandatory parameters for the specific function name

  • paramsOpt -

    is the vector of optional parameters for the specific function name

  • paramsOut -

    is the vector of parameters (must have flag OUT, not IN), that are the return value(s) of the specific function call

  • waitCond -

    is the semaphore in order guarantee, that the caller of this method waits until the function has been executed.


void parametersChanged

This signal usually is emitted if the vector m_params is changed.

Emit this signal for instance in setParam if the parameter has been changed in order to inform connected dock-widgets... about the change. This signal is also emitted if you invoke the slot sendParameterRequest.

m_params, sendParameterRequest
  • params -

    is the parameter-vector to send (usually m_params)

Protected Functions



This constructor is called by any constructor of classes AddInActuator, AddInDataIO or AddInAlgo. Please make sure to call these constructors in your plugin constructor, since this is not automatically be done (due to the single parameter of the constructor).

This constructor simply initializes several member variables of this class.

  • uniqueID -

    is the unique identifier of this plugin instance. This identifier can be changed in the constructor or finally at the beginning of in the init-method. Afterwards it is used by different organizers and GUI components.



This destructor is automatically called if any plugin instance is destroyed. It does the following steps:

void setIdentifier(const QString & identifier)

sets the identifier of the plugin. The slot AbstractAddInDockWidget::identifierChanged is invoked if a corresponding dock widget is available.

void createDockWidget(QString title, QDockWidget::DockWidgetFeatures features, Qt::DockWidgetAreas allowedAreas = Qt::AllDockWidgetAreas, QWidget * content = NULL)

Creates the dock-widget for this plugin.

ito::RetVal registerExecFunc(const QString funcName, const QVector< ito::Param > & paramsMand, const QVector< ito::Param > & paramsOpt, const QVector< ito::Param > & paramsOut, const QString infoString)

Registers an additional function with specific name and default parameters.

void setBasePlugin(AddInInterfaceBase * base)

sets the interface of this instance to base.


Protected Attributes

QThread * m_pThread

the instance’s thread

AddInInterfaceBase * m_pBasePlugin

the AddInInterfaceBase instance of this plugin

QMap< QString, Param > m_params

map of the available parameters

QString m_identifier

unique identifier (serial number, com-port...)

int m_refCount

reference counter, used to avoid early deletes (0 means that one instance is holding one reference, 1 that two participants hold the reference...)

int m_createdByGUI

1 if this instance has firstly been created by GUI, 0: this instance has been created by c++ or python

QVector< ito::AddInBase::AddInRef * > m_hwDecList

list of hardware that was passed to the plugin on initialisation and whose refcounter was incremented

QMap< QString, ExecFuncParams > m_execFuncList

map with registered additional functions. funcExec-name -> (default mandParams, default optParams, default outParams, infoString)

class AddInRef

Public Functions

AddInRef(void * p, int t)

Public Members

int type

void * ptr

Public Slot


Previous topic

Plugin class - Basic information

Next topic

Plugin class - DataIO

This Page