OpenRTM-aist  1.2.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RTC::ExecutionContextBase Class Reference

A base class for ExecutionContext. More...

#include <ExecutionContextBase.h>

Inheritance diagram for RTC::ExecutionContextBase:
Inheritance graph
[legend]
Collaboration diagram for RTC::ExecutionContextBase:
Collaboration graph
[legend]

Public Member Functions

 ExecutionContextBase (const char *name)
 Virtual Destructor. More...
 
virtual ~ExecutionContextBase (void)
 Virtual Destructor. More...
 
virtual void init (coil::Properties &props)
 Initialize the ExecutionContext. More...
 
virtual RTC::ReturnCode_t bindComponent (RTC::RTObject_impl *rtc)
 Bind the component. More...
 
CORBA::Boolean isRunning ()
 Check for ExecutionContext running state. More...
 
RTC::ReturnCode_t start (void)
 Start the ExecutionContext. More...
 
virtual RTC::ReturnCode_t stop (void)
 Stop the ExecutionContext. More...
 
double getRate (void) const
 Get execution rate(Hz) of ExecutionContext. More...
 
coil::TimeValue getPeriod (void) const
 
RTC::ReturnCode_t setRate (double rate)
 Set execution rate(Hz) of ExecutionContext. More...
 
RTC::ReturnCode_t addComponent (RTC::LightweightRTObject_ptr comp)
 Add an RT-component. More...
 
RTC::ReturnCode_t removeComponent (RTC::LightweightRTObject_ptr comp)
 Remove the RT-Component from participant list. More...
 
RTC::ReturnCode_t activateComponent (RTC::LightweightRTObject_ptr comp)
 Activate an RT-component. More...
 
RTC::ReturnCode_t deactivateComponent (RTC::LightweightRTObject_ptr comp)
 Deactivate an RT-component. More...
 
RTC::ReturnCode_t resetComponent (RTC::LightweightRTObject_ptr comp)
 Reset the RT-component. More...
 
RTC::LifeCycleState getComponentState (RTC::LightweightRTObject_ptr comp)
 Get RT-component's state. More...
 
const char * getStateString (RTC::LifeCycleState state)
 
RTC::ExecutionKind getKind (void) const
 Get the ExecutionKind. More...
 
RTC::ExecutionContextProfile * getProfile (void)
 Getting Profile. More...
 
void setObjRef (RTC::ExecutionContextService_ptr ec_ptr)
 Get the reference to the CORBA object. More...
 
RTC::ExecutionContextService_ptr getObjRef (void) const
 
const char * getKindString (RTC::ExecutionKind kind) const
 Converting ExecutionKind enum to string. More...
 
RTC::ReturnCode_t setKind (RTC::ExecutionKind kind)
 Set the ExecutionKind. More...
 
RTC::ReturnCode_t setOwner (RTC::LightweightRTObject_ptr comp)
 Setting owner component of the execution context. More...
 
const RTC::RTObject_ptr getOwner () const
 Getting a reference of the owner component. More...
 
const RTC::RTCList & getComponentList () const
 Getting participant RTC list. More...
 
void setProperties (coil::Properties &props)
 Setting Properties. More...
 
const coil::Properties getProperties () const
 Setting Properties. More...
 
const RTC::ExecutionContextProfile & getProfile (void) const
 Getting Profile. More...
 
bool isAllCurrentState (RTC::LifeCycleState state)
 
bool isAllNextState (RTC::LifeCycleState state)
 
bool isOneOfCurrentState (RTC::LifeCycleState state)
 
bool isOneOfNextState (RTC::LifeCycleState state)
 
void invokeWorker ()
 
void invokeWorkerPreDo ()
 
void invokeWorkerDo ()
 
void invokeWorkerPostDo ()
 

Protected Member Functions

virtual bool onIsRunning (bool running)
 
virtual RTC::ReturnCode_t onStarting ()
 
virtual RTC::ReturnCode_t onStarted ()
 
virtual RTC::ReturnCode_t onStopping ()
 
virtual RTC::ReturnCode_t onStopped ()
 
virtual double onGetRate (double rate) const
 
virtual double onSettingRate (double rate)
 
virtual RTC::ReturnCode_t onSetRate (double rate)
 
virtual RTC::ReturnCode_t onAddingComponent (RTC::LightweightRTObject_ptr rtobj)
 
virtual RTC::ReturnCode_t onAddedComponent (RTC::LightweightRTObject_ptr rtobj)
 
virtual RTC::ReturnCode_t onRemovingComponent (RTC::LightweightRTObject_ptr rtobj)
 
virtual RTC::ReturnCode_t onRemovedComponent (RTC::LightweightRTObject_ptr rtobj)
 
virtual RTC::ReturnCode_t onActivating (RTC::LightweightRTObject_ptr comp)
 
virtual RTC::ReturnCode_t onWaitingActivated (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::ReturnCode_t onActivated (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::ReturnCode_t onDeactivating (RTC::LightweightRTObject_ptr comp)
 
virtual RTC::ReturnCode_t onWaitingDeactivated (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::ReturnCode_t onDeactivated (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::ReturnCode_t onResetting (RTC::LightweightRTObject_ptr comp)
 
virtual RTC::ReturnCode_t onWaitingReset (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::ReturnCode_t onReset (RTC_impl::RTObjectStateMachine *comp, long int count)
 
virtual RTC::LifeCycleState onGetComponentState (RTC::LifeCycleState state)
 
virtual RTC::ExecutionKind onGetKind (RTC::ExecutionKind kind) const
 
virtual RTC::ExecutionContextProfile * onGetProfile (RTC::ExecutionContextProfile *&profile)
 

Protected Attributes

RTC::Logger rtclog
 
RTC_impl::ExecutionContextWorker m_worker
 
RTC_impl::ExecutionContextProfile m_profile
 
coil::TimeValue m_activationTimeout
 
coil::TimeValue m_deactivationTimeout
 
coil::TimeValue m_resetTimeout
 
bool m_syncActivation
 
bool m_syncDeactivation
 
bool m_syncReset
 

Detailed Description

A base class for ExecutionContext.

A base class of ExecutionContext.

Since
0.4.0

Constructor & Destructor Documentation

RTC::ExecutionContextBase::ExecutionContextBase ( const char *  name)

Virtual Destructor.

Virtual Destructor

virtual RTC::ExecutionContextBase::~ExecutionContextBase ( void  )
virtual

Virtual Destructor.

Virtual Destructor

Member Function Documentation

RTC::ReturnCode_t RTC::ExecutionContextBase::activateComponent ( RTC::LightweightRTObject_ptr  comp)

Activate an RT-component.

The given participant RTC is Inactive and is therefore not being invoked according to the execution context’s execution kind. This operation shall cause the RTC to transition to the Active state such that it may subsequently be invoked in this execution context. The callback on_activate shall be called as a result of calling this operation. This operation shall not return until the callback has returned, and shall result in an error if the callback does.

Parameters
compThe target RT-Component for activation
Returns
The return code of ReturnCode_t type
RTC::ReturnCode_t RTC::ExecutionContextBase::addComponent ( RTC::LightweightRTObject_ptr  comp)

Add an RT-component.

The operation causes the given RTC to begin participating in the execution context. The newly added RTC will receive a call to LightweightRTComponent::attach_context and then enter the Inactive state. BAD_PARAMETER will be invoked, if the given RT-Component is null or if the given RT-Component is other than DataFlowComponent.

Parameters
compThe target RT-Component for add
Returns
The return code of ReturnCode_t type
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::bindComponent ( RTC::RTObject_impl rtc)
virtual

Bind the component.

Bind the component.

RTC::ReturnCode_t RTC::ExecutionContextBase::deactivateComponent ( RTC::LightweightRTObject_ptr  comp)

Deactivate an RT-component.

The given RTC is Active in the execution context. Cause it to transition to the Inactive state such that it will not be subsequently invoked from the context unless and until it is activated again. The callback on_deactivate shall be called as a result of calling this operation. This operation shall not return until the callback has returned, and shall result in an error if the callback does.

Parameters
compThe target RT-Component for deactivate
Returns
The return code of ReturnCode_t type
const RTC::RTCList& RTC::ExecutionContextBase::getComponentList ( ) const

Getting participant RTC list.

This function returns a list of participant RTC of the execution context.

Returns
Participants RTC list
RTC::LifeCycleState RTC::ExecutionContextBase::getComponentState ( RTC::LightweightRTObject_ptr  comp)

Get RT-component's state.

This operation shall report the LifeCycleState of the given participant RTC. UNKNOWN_STATE will be returned, if the given RT-Component is not inclued in the participant list.

Parameters
compThe target RT-Component to get the state
Returns
The current state of the target RT-Component(LifeCycleState)
RTC::ExecutionKind RTC::ExecutionContextBase::getKind ( void  ) const

Get the ExecutionKind.

This operation shall report the execution kind of the execution context.

Returns
ExecutionKind
const char* RTC::ExecutionContextBase::getKindString ( RTC::ExecutionKind  kind) const

Converting ExecutionKind enum to string.

This function converts enumeration (PERIODIC, EVENT_DRIVEN, OTHER) defined in RTC::ExecutionKind to string.

Parameters
kindExecutionKind
Returns
String of ExecutionKind
RTC::ExecutionContextService_ptr RTC::ExecutionContextBase::getObjRef ( void  ) const

Get the reference to the CORBA object as ExecutioncontextService of this object.

Returns
The reference to CORBA object
const RTC::RTObject_ptr RTC::ExecutionContextBase::getOwner ( ) const

Getting a reference of the owner component.

This function returns a reference of the owner RT-Component of this execution context

Returns
a reference of the owner RT-Component
coil::TimeValue RTC::ExecutionContextBase::getPeriod ( void  ) const
RTC::ExecutionContextProfile* RTC::ExecutionContextBase::getProfile ( void  )

Getting Profile.

This function gets RTC::ExecutionContextProfile. The ownership of the obtained ExecutionContextProfile is given to caller. The caller should release obtained object when it is unneccessary anymore.

Returns
RTC::ExecutionContextProfile
const RTC::ExecutionContextProfile& RTC::ExecutionContextBase::getProfile ( void  ) const

Getting Profile.

This function gets RTC::ExecutionContextProfile.

Returns
RTC::ExecutionContextProfile
const coil::Properties RTC::ExecutionContextBase::getProperties ( ) const

Setting Properties.

This function sets ExecutionContextProfile::properties by coil::Properties.

Parameters
propsProperties to be set to ExecutionContextProfile::properties.
double RTC::ExecutionContextBase::getRate ( void  ) const

Get execution rate(Hz) of ExecutionContext.

This operation shall return the rate (in hertz) at which its Active participating RTCs are being invoked.

Returns
Execution cycle(Unit:Hz)
const char* RTC::ExecutionContextBase::getStateString ( RTC::LifeCycleState  state)
virtual void RTC::ExecutionContextBase::init ( coil::Properties props)
virtual

Initialize the ExecutionContext.

This operation initialize the ExecutionContext

Reimplemented in RTC_exp::PeriodicExecutionContext.

void RTC::ExecutionContextBase::invokeWorker ( )
inline
void RTC::ExecutionContextBase::invokeWorkerDo ( )
inline
void RTC::ExecutionContextBase::invokeWorkerPostDo ( )
inline
void RTC::ExecutionContextBase::invokeWorkerPreDo ( )
inline
bool RTC::ExecutionContextBase::isAllCurrentState ( RTC::LifeCycleState  state)
inline
bool RTC::ExecutionContextBase::isAllNextState ( RTC::LifeCycleState  state)
inline
bool RTC::ExecutionContextBase::isOneOfCurrentState ( RTC::LifeCycleState  state)
inline
bool RTC::ExecutionContextBase::isOneOfNextState ( RTC::LifeCycleState  state)
inline
CORBA::Boolean RTC::ExecutionContextBase::isRunning ( )

Check for ExecutionContext running state.

This operation shall return true if the context is in the Running state. After calling the start() of this class, this function returns true, after calling to stop function of it, this function returns false.

Returns
Working status (Running:true、Stopped:false)
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onActivated ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onActivating ( RTC::LightweightRTObject_ptr  comp)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onAddedComponent ( RTC::LightweightRTObject_ptr  rtobj)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onAddingComponent ( RTC::LightweightRTObject_ptr  rtobj)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onDeactivated ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onDeactivating ( RTC::LightweightRTObject_ptr  comp)
inlineprotectedvirtual
virtual RTC::LifeCycleState RTC::ExecutionContextBase::onGetComponentState ( RTC::LifeCycleState  state)
inlineprotectedvirtual
virtual RTC::ExecutionKind RTC::ExecutionContextBase::onGetKind ( RTC::ExecutionKind  kind) const
inlineprotectedvirtual
virtual RTC::ExecutionContextProfile* RTC::ExecutionContextBase::onGetProfile ( RTC::ExecutionContextProfile *&  profile)
inlineprotectedvirtual
virtual double RTC::ExecutionContextBase::onGetRate ( double  rate) const
inlineprotectedvirtual
virtual bool RTC::ExecutionContextBase::onIsRunning ( bool  running)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onRemovedComponent ( RTC::LightweightRTObject_ptr  rtobj)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onRemovingComponent ( RTC::LightweightRTObject_ptr  rtobj)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onReset ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onResetting ( RTC::LightweightRTObject_ptr  comp)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onSetRate ( double  rate)
inlineprotectedvirtual
virtual double RTC::ExecutionContextBase::onSettingRate ( double  rate)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onStarted ( )
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onStarting ( )
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onStopped ( )
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onStopping ( )
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onWaitingActivated ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onWaitingDeactivated ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::onWaitingReset ( RTC_impl::RTObjectStateMachine comp,
long int  count 
)
inlineprotectedvirtual
RTC::ReturnCode_t RTC::ExecutionContextBase::removeComponent ( RTC::LightweightRTObject_ptr  comp)

Remove the RT-Component from participant list.

This operation causes a participant RTC to stop participating in the execution context. The removed RTC will receive a call to LightweightRTComponent::detach_context. BAD_PARAMETER will be returned, if the given RT-Component is not participating in the participant list.

Parameters
compThe target RT-Component for delete
Returns
The return code of ReturnCode_t type
RTC::ReturnCode_t RTC::ExecutionContextBase::resetComponent ( RTC::LightweightRTObject_ptr  comp)

Reset the RT-component.

Attempt to recover the RTC when it is in Error. The ComponentAction::on_reset callback shall be invoked. This operation shall not return until the callback has returned, and shall result in an error if the callback does. If possible, the RTC developer should implement that callback such that the RTC may be returned to a valid state.

Parameters
compThe target RT-Component for reset
Returns
The return code of ReturnCode_t type
RTC::ReturnCode_t RTC::ExecutionContextBase::setKind ( RTC::ExecutionKind  kind)

Set the ExecutionKind.

This operation sets the kind of the execution context.

Parameters
kindExecutionKind
void RTC::ExecutionContextBase::setObjRef ( RTC::ExecutionContextService_ptr  ec_ptr)

Get the reference to the CORBA object.

Get the reference to the CORBA object as ExecutioncontextService of this object.

Returns
The reference to CORBA object
RTC::ReturnCode_t RTC::ExecutionContextBase::setOwner ( RTC::LightweightRTObject_ptr  comp)

Setting owner component of the execution context.

This function sets an RT-Component to be owner of the execution context.

Parameters
compan owner RT-Component of this execution context
Returns
The return code of ReturnCode_t type
void RTC::ExecutionContextBase::setProperties ( coil::Properties props)

Setting Properties.

This function sets ExecutionContextProfile::properties by coil::Properties.

Parameters
propsProperties to be set to ExecutionContextProfile::properties.
RTC::ReturnCode_t RTC::ExecutionContextBase::setRate ( double  rate)

Set execution rate(Hz) of ExecutionContext.

This operation shall set the rate (in hertz) at which this context’s Active participating RTCs are being called. If the execution kind of the context is PERIODIC, a rate change shall result in the invocation of on_rate_changed on any RTCs realizing DataFlowComponentAction that are registered with any RTCs participating in the context.

Parameters
rateExecution cycle(Unit:Hz)
Returns
The return code of ReturnCode_t type RTC_OK: Succeed BAD_PARAMETER: Invalid value. The value might be negative.
RTC::ReturnCode_t RTC::ExecutionContextBase::start ( void  )

Start the ExecutionContext.

Request that the context enter the Running state. Once the state transition occurs, the ComponentAction::on_startup operation will be invoked. An execution context may not be started until the RT-Components that participate in it have been initialized. An execution context may be started and stopped multiple times.

Returns
The return code of ReturnCode_t type
virtual RTC::ReturnCode_t RTC::ExecutionContextBase::stop ( void  )
virtual

Stop the ExecutionContext.

Request that the context enter the Stopped state. Once the transition occurs, the ComponentAction::on_shutdown operation will be invoked. An execution context must be stopped before the RT components that participate in it are finalized. An execution context may be started and stopped multiple times.

Returns
The return code of ReturnCode_t type

Reimplemented in RTC_exp::PeriodicExecutionContext, RTC::ExtTrigExecutionContext, and RTC::OpenHRPExecutionContext.

Member Data Documentation

coil::TimeValue RTC::ExecutionContextBase::m_activationTimeout
protected
coil::TimeValue RTC::ExecutionContextBase::m_deactivationTimeout
protected
RTC_impl::ExecutionContextProfile RTC::ExecutionContextBase::m_profile
protected
coil::TimeValue RTC::ExecutionContextBase::m_resetTimeout
protected
bool RTC::ExecutionContextBase::m_syncActivation
protected
bool RTC::ExecutionContextBase::m_syncDeactivation
protected
bool RTC::ExecutionContextBase::m_syncReset
protected
RTC_impl::ExecutionContextWorker RTC::ExecutionContextBase::m_worker
protected
RTC::Logger RTC::ExecutionContextBase::rtclog
mutableprotected

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