itom
Loading...
Searching...
No Matches
ito::PluginThreadCtrl Class Reference

Base class for DataIOThreadCtrl and ActuatorThreadCtrl. More...

#include <pluginThreadCtrl.h>

Inheritance diagram for ito::PluginThreadCtrl:
ito::ActuatorThreadCtrl ito::DataIOThreadCtrl

Public Member Functions

 PluginThreadCtrl ()
 default constructor. No plugin instance is currently under control.
 
 PluginThreadCtrl (const ito::ParamBase &pluginParameter, ito::RetVal *retval=NULL)
 Creates the control object for a plugin instance.
 
 PluginThreadCtrl (ito::AddInBase *plugin, ito::RetVal *retval=NULL)
 Creates the control object for a plugin instance.
 
 PluginThreadCtrl (const PluginThreadCtrl &other)
 copy constructor. The reference counter of the covered plugin by other will be incremented another time.
 
virtual ~PluginThreadCtrl ()
 destructor. Decrements the reference counter of the covered plugin and deletes it, if it drops to zero.
 
PluginThreadCtrloperator= (const PluginThreadCtrl &other)
 assignment operator. Gets control over the plugin currently covered by other. Decrements the reference counter of the former plugin and increments it of the plugin controlled by other.
 
ito::RetVal getParam (ito::Param &val, int timeOutMS=PLUGINWAIT)
 
ito::RetVal setParam (ito::ParamBase val, int timeOutMS=PLUGINWAIT)
 
ito::RetVal waitForSemaphore (int timeOutMS=PLUGINWAIT)
 

Protected Attributes

ito::AddInBasem_pPlugin
 
ItomSharedSemaphoreLocker m_semaphoreLocker
 

Detailed Description

Base class for DataIOThreadCtrl and ActuatorThreadCtrl.

This base class only provides access to setParam and getParam of the covered plugin in order to get or set internal parameters of the plugin. This is common for actuators and dataIO instances.

Constructor & Destructor Documentation

◆ PluginThreadCtrl() [1/2]

ito::PluginThreadCtrl::PluginThreadCtrl ( const ito::ParamBase & pluginParameter,
ito::RetVal * retval = NULL )

Creates the control object for a plugin instance.

This implementation gets the controlled instance from a ito::ParamBase object of param type ito::ParamBase::HWRef. Use this version, if the controlled plugin is passed to an algorithm or other plugin via a vector of mandatory or optional parameters in terms of ito::ParamBase objects.

This constructor increments the reference of the controlled plugin such that the plugin is not deleted until the reference has been decremented in the destructor of this class.

Parameters
pluginParameteris a plugin parameter of type ito::ParamBase::HWRef.
retvalis an optional pointer to ito::RetVal. An error is set to this retval if the given plugin is no valid dataIO plugin instance.
Returns
(void)
See also
CameraThreadCtrl

◆ PluginThreadCtrl() [2/2]

ito::PluginThreadCtrl::PluginThreadCtrl ( ito::AddInBase * plugin,
ito::RetVal * retval = NULL )

Creates the control object for a plugin instance.

This implementation gets the controlled instance from the real pointer to a ito::AddInBase instance.

This constructor increments the reference of the controlled plugin such that the plugin is not deleted until the reference has been decremented in the destructor of this class.

Parameters
pluginis the pointer to the controlled plugin.
retvalis an optional pointer to ito::RetVal. An error is set to this retval if the given plugin is no valid plugin instance.

◆ ~PluginThreadCtrl()

ito::PluginThreadCtrl::~PluginThreadCtrl ( )
virtual

destructor. Decrements the reference counter of the covered plugin and deletes it, if it drops to zero.

\detail The destructor

Member Function Documentation

◆ getParam()

ito::RetVal ito::PluginThreadCtrl::getParam ( ito::Param & val,
int timeOutMS = PLUGINWAIT )

Get a parameter of the plugin

\detail Get any parameter of the camera defined by val.name. val must be initialised and name must be correct. After correct execution, val has the correct value.

Parameters
[in|out]val Initialised tParam (correct name | in)
[in]timeOutMSTimeOut for the semaphore-wait
Returns
retOk or retError

◆ setParam()

ito::RetVal ito::PluginThreadCtrl::setParam ( ito::ParamBase val,
int timeOutMS = PLUGINWAIT )

Set a parameter of the plugin

\detail Get the parameter of the plugin defined by val.name to the value of val.

Parameters
[in]valInitialised tParam (correct name | value)
[in]timeOutMSTimeOut for the semaphore-wait
Returns
retOk or retError

◆ waitForSemaphore()

ito::RetVal ito::PluginThreadCtrl::waitForSemaphore ( int timeOutMS = PLUGINWAIT)

Wait until plugin thread has finished the last command

\detail After the invoke-command this thread must wait / be synchronize with the plugin-thread. Therefore the wait-Function of m_semaphoreLocker is called. If the plugin do not answer within timeOutMS and the pMyCamera is not alive anymore, the function returns a timeout.

Parameters
[in]timeOutMStimeout for the wait. -1: endless wait until the plugin finished the last invocation or it is not 'alive' anymore, 0: no wait (this method does nothing), >0: time in ms
Returns
retOk if semaphore was successfully released, retError if semaphore returned an error message or if a timeout occurred (error code: 256)

Member Data Documentation

◆ m_pPlugin

ito::AddInBase* ito::PluginThreadCtrl::m_pPlugin
protected

Handle to the plugin

◆ m_semaphoreLocker

ItomSharedSemaphoreLocker ito::PluginThreadCtrl::m_semaphoreLocker
protected

Handle to the semaphore needed for thread save communication. Allocated in constructor, deleted in destructor


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