Classes | Public Member Functions | Protected Types | Protected Attributes | Private Types | List of all members
RTC::PeriodicExecutionContext Class Reference

PeriodicExecutionContext class. More...

#include <PeriodicExecutionContext.h>

Inheritance diagram for RTC::PeriodicExecutionContext:
Inheritance graph
[legend]

Classes

struct  Comp
 The structure for the component management. More...
 
class  DFP
 DFP class. More...
 
class  DFPBase
 DFPBase class. More...
 
struct  find_comp
 Functor to find the component. More...
 
class  find_participant
 
struct  invoke_on_rate_changed
 Functor to invoke on_rate_changed. More...
 
struct  invoke_on_shutdown
 Functor to invoke on_shutdown. More...
 
struct  invoke_on_startup
 Functor to invoke on_startup. More...
 
struct  invoke_worker
 Functor to invoke worker. More...
 
struct  Worker
 Condition variable class for worker. More...
 

Public Member Functions

virtual ReturnCode_t activate_component (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Activate an RT-component. More...
 
virtual ReturnCode_t add_component (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Add an RT-component. More...
 
virtual RTC::ReturnCode_t bindComponent (RTObject_impl *rtc)
 Bind the component. More...
 
virtual int close (unsigned long flags)
 Thread execution function for ExecutionContext. More...
 
virtual ReturnCode_t deactivate_component (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Deactivate an RT-component. More...
 
virtual LifeCycleState get_component_state (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Get RT-component's state. More...
 
virtual ExecutionKind get_kind (void) throw (CORBA::SystemException)
 Get the ExecutionKind. More...
 
virtual ExecutionContextProfile * get_profile (void) throw (CORBA::SystemException)
 Get the ExecutionContextProfile. More...
 
virtual CORBA::Double get_rate (void) throw (CORBA::SystemException)
 Get execution rate(Hz) of ExecutionContext. More...
 
virtual ExecutionContextService_ptr getObjRef (void)
 Get the reference to the CORBA object. More...
 
virtual CORBA::Boolean is_running (void) throw (CORBA::SystemException)
 Check for ExecutionContext running state. More...
 
virtual int open (void *args)
 Generate internal activity thread for ExecutionContext. More...
 
 PeriodicExecutionContext ()
 Default Constructor. More...
 
 PeriodicExecutionContext (OpenRTM::DataFlowComponent_ptr owner, double rate=1000.0)
 Constructor. More...
 
virtual ReturnCode_t remove_component (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Remove the RT-Component from participant list. More...
 
virtual ReturnCode_t reset_component (LightweightRTObject_ptr comp) throw (CORBA::SystemException)
 Reset the RT-component. More...
 
virtual ReturnCode_t set_rate (CORBA::Double rate) throw (CORBA::SystemException)
 Set execution rate(Hz) of ExecutionContext. More...
 
virtual ReturnCode_t start (void) throw (CORBA::SystemException)
 Start the ExecutionContext. More...
 
virtual ReturnCode_t stop (void) throw (CORBA::SystemException)
 Stop the ExecutionContext. More...
 
virtual int svc (void)
 Thread execution function for ExecutionContext. More...
 
virtual ~PeriodicExecutionContext (void)
 Destructor. More...
 
- Public Member Functions inherited from RTC::ExecutionContextBase
virtual void tick () throw (CORBA::SystemException)
 Proceed with tick of ExecutionContext. More...
 
virtual ~ExecutionContextBase (void)
 Virtual Destructor. More...
 
- Public Member Functions inherited from coil::Task
virtual void activate ()
 Create a thread. More...
 
virtual void activate ()
 Create a thread. More...
 
virtual void finalize ()
 Finalizing the task. More...
 
virtual void finalize ()
 Finalizing the task. More...
 
virtual void reset ()
 Reset of task count. More...
 
virtual void reset ()
 Reset of task count. More...
 
virtual int resume (void)
 Resuming the suspended task. More...
 
virtual int resume (void)
 Resuming the suspended task. More...
 
virtual int suspend (void)
 Suspending the task. More...
 
virtual int suspend (void)
 Suspending the task. More...
 
 Task ()
 Constructor. More...
 
 Task ()
 Constructor. More...
 
virtual int wait (void)
 Waiting for the thread terminate. More...
 
virtual int wait (void)
 Waiting for the thread terminate. More...
 
virtual ~Task ()
 Destructor. More...
 
virtual ~Task ()
 Destructor. More...
 

Protected Types

typedef std::vector< Comp >::iterator CompItr
 
typedef RTC_Utils::StateHolder< ExecContextStateECStates
 
typedef LifeCycleState ExecContextState
 

Protected Attributes

std::vector< Compm_comps
 List of the participating component. More...
 
bool m_nowait
 Flag of ExecutionContext to run immediately (to run without waiting) More...
 
coil::TimeValue m_period
 Execution cycle of ExecutionContext. More...
 
ExecutionContextProfile m_profile
 ExecutionContextProfile. More...
 
coil::Mutex m_profileMutex
 
ExecutionContextService_var m_ref
 Reference to ExecutionContextService object. More...
 
bool m_running
 The running state of ExecutionContext true: running, false: stopped. More...
 
bool m_svc
 The thread running flag of ExecutionContext. More...
 
Worker m_worker
 A condition variable for external triggered worker. More...
 
Logger rtclog
 Logger stream. More...
 

Private Types

typedef coil::Guard< coil::MutexGuard
 

Additional Inherited Members

- Static Public Member Functions inherited from coil::Task
static void * svc_run (void *args=0)
 Start thread Execution. More...
 
static unsigned int WINAPI svc_run (void *args=0)
 Start thread Execution. More...
 

Detailed Description

PeriodicExecutionContext class.

Periodic Sampled Data Processing (for the execution cycles) ExecutionContext class

Since
0.4.0

Definition at line 64 of file PeriodicExecutionContext.h.

Member Typedef Documentation

◆ CompItr

typedef std::vector<Comp>::iterator RTC::PeriodicExecutionContext::CompItr
protected

Definition at line 1479 of file PeriodicExecutionContext.h.

◆ ECStates

Definition at line 648 of file PeriodicExecutionContext.h.

◆ ExecContextState

typedef LifeCycleState RTC::PeriodicExecutionContext::ExecContextState
protected

Definition at line 639 of file PeriodicExecutionContext.h.

◆ Guard

Definition at line 68 of file PeriodicExecutionContext.h.

Constructor & Destructor Documentation

◆ PeriodicExecutionContext() [1/2]

RTC::PeriodicExecutionContext::PeriodicExecutionContext ( )

Default Constructor.

Default constructor.

Default Constructor Set the following items to profile.

  • kind : PERIODIC
  • rate : 0.0

Definition at line 38 of file PeriodicExecutionContext.cpp.

◆ PeriodicExecutionContext() [2/2]

RTC::PeriodicExecutionContext::PeriodicExecutionContext ( OpenRTM::DataFlowComponent_ptr  owner,
double  rate = 1000.0 
)

Constructor.

Construnctor.

Constructor Set the configuration value to profile.

Parameters
ownerThe owner of this Executioncontext
rateExecution cycle(Hz)(The default value:1000)

Definition at line 66 of file PeriodicExecutionContext.cpp.

◆ ~PeriodicExecutionContext()

RTC::PeriodicExecutionContext::~PeriodicExecutionContext ( void  )
virtual

Destructor.

Destructor

Definition at line 96 of file PeriodicExecutionContext.cpp.

Member Function Documentation

◆ activate_component()

ReturnCode_t RTC::PeriodicExecutionContext::activate_component ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

Activate an RT-component.

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

Definition at line 324 of file PeriodicExecutionContext.cpp.

◆ add_component()

ReturnCode_t RTC::PeriodicExecutionContext::add_component ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

Add an RT-component.

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

Definition at line 526 of file PeriodicExecutionContext.cpp.

◆ bindComponent()

RTC::ReturnCode_t RTC::PeriodicExecutionContext::bindComponent ( RTObject_impl rtc)
virtual

Bind the component.

Bind the component.

Parameters
rtcRT-Component's instances
Returns
The return code of ReturnCode_t type

Implements RTC::ExecutionContextBase.

Definition at line 557 of file PeriodicExecutionContext.cpp.

◆ close()

int RTC::PeriodicExecutionContext::close ( unsigned long  flags)
virtual

Thread execution function for ExecutionContext.

This function is invoked when activity thread for ExecutionContext exits. Deactivate the component object and notify it to manager. This is coil::Task class method's override.

Parameters
flagsFlag of the close
Returns
The close result

Reimplemented from coil::Task.

Definition at line 190 of file PeriodicExecutionContext.cpp.

◆ deactivate_component()

ReturnCode_t RTC::PeriodicExecutionContext::deactivate_component ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

Deactivate an RT-component.

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

Definition at line 368 of file PeriodicExecutionContext.cpp.

◆ get_component_state()

LifeCycleState RTC::PeriodicExecutionContext::get_component_state ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

Get RT-component's state.

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)

Definition at line 478 of file PeriodicExecutionContext.cpp.

◆ get_kind()

ExecutionKind RTC::PeriodicExecutionContext::get_kind ( void  )
throw (CORBA::SystemException
)
virtual

Get the ExecutionKind.

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

Returns
ExecutionKind

Definition at line 511 of file PeriodicExecutionContext.cpp.

◆ get_profile()

ExecutionContextProfile * RTC::PeriodicExecutionContext::get_profile ( void  )
throw (CORBA::SystemException
)
virtual

Get the ExecutionContextProfile.

This operation provides a profile ¡Èdescriptor¡É for the execution context.

Returns
ExecutionContextProfile

Definition at line 634 of file PeriodicExecutionContext.cpp.

◆ get_rate()

CORBA::Double RTC::PeriodicExecutionContext::get_rate ( void  )
throw (CORBA::SystemException
)
virtual

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)

Definition at line 281 of file PeriodicExecutionContext.cpp.

◆ getObjRef()

virtual ExecutionContextService_ptr RTC::PeriodicExecutionContext::getObjRef ( void  )
inlinevirtual

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

Implements RTC::ExecutionContextBase.

Definition at line 149 of file PeriodicExecutionContext.h.

◆ is_running()

CORBA::Boolean RTC::PeriodicExecutionContext::is_running ( void  )
throw (CORBA::SystemException
)
virtual

Check for ExecutionContext running state.

This operation shall return true if the context is in the Running state. While the context is Running, all Active RTCs participating in the context shall be executed according to the context¡Çs execution kind.

Returns
Check state function (Running:true¡¢Stopping:false)

Definition at line 211 of file PeriodicExecutionContext.cpp.

◆ open()

int RTC::PeriodicExecutionContext::open ( void *  args)
virtual

Generate internal activity thread for ExecutionContext.

Generate internal activity thread and run. This is coil::Task class method's override.

Parameters
argsUsually give 0
Returns
The generation result

Reimplemented from coil::Task.

Definition at line 123 of file PeriodicExecutionContext.cpp.

◆ remove_component()

ReturnCode_t RTC::PeriodicExecutionContext::remove_component ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

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

Definition at line 590 of file PeriodicExecutionContext.cpp.

◆ reset_component()

ReturnCode_t RTC::PeriodicExecutionContext::reset_component ( LightweightRTObject_ptr  comp)
throw (CORBA::SystemException
)
virtual

Reset the RT-component.

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

Definition at line 453 of file PeriodicExecutionContext.cpp.

◆ set_rate()

ReturnCode_t RTC::PeriodicExecutionContext::set_rate ( CORBA::Double  rate)
throw (CORBA::SystemException
)
virtual

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

Definition at line 296 of file PeriodicExecutionContext.cpp.

◆ start()

ReturnCode_t RTC::PeriodicExecutionContext::start ( void  )
throw (CORBA::SystemException
)
virtual

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

Definition at line 225 of file PeriodicExecutionContext.cpp.

◆ stop()

ReturnCode_t RTC::PeriodicExecutionContext::stop ( void  )
throw (CORBA::SystemException
)
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

Definition at line 255 of file PeriodicExecutionContext.cpp.

◆ svc()

int RTC::PeriodicExecutionContext::svc ( void  )
virtual

Thread execution function for ExecutionContext.

Thread execution function for ExecutionContext. Invoke the registered components operation.

Returns
The execution result

Reimplemented from coil::Task.

Reimplemented in OpenRTM::RTPreemptEC, RTC::ExtTrigExecutionContext, RTC::OpenHRPExecutionContext, and RTC::ArtExecutionContext.

Definition at line 141 of file PeriodicExecutionContext.cpp.

Member Data Documentation

◆ m_comps

std::vector<Comp> RTC::PeriodicExecutionContext::m_comps
protected

List of the participating component.

Definition at line 1478 of file PeriodicExecutionContext.h.

◆ m_nowait

bool RTC::PeriodicExecutionContext::m_nowait
protected

Flag of ExecutionContext to run immediately (to run without waiting)

Definition at line 1570 of file PeriodicExecutionContext.h.

◆ m_period

coil::TimeValue RTC::PeriodicExecutionContext::m_period
protected

Execution cycle of ExecutionContext.

Definition at line 1551 of file PeriodicExecutionContext.h.

◆ m_profile

ExecutionContextProfile RTC::PeriodicExecutionContext::m_profile
protected

ExecutionContextProfile.

Definition at line 1541 of file PeriodicExecutionContext.h.

◆ m_profileMutex

coil::Mutex RTC::PeriodicExecutionContext::m_profileMutex
protected

Definition at line 1542 of file PeriodicExecutionContext.h.

◆ m_ref

ExecutionContextService_var RTC::PeriodicExecutionContext::m_ref
protected

Reference to ExecutionContextService object.

Definition at line 1560 of file PeriodicExecutionContext.h.

◆ m_running

bool RTC::PeriodicExecutionContext::m_running
protected

The running state of ExecutionContext true: running, false: stopped.

Definition at line 1499 of file PeriodicExecutionContext.h.

◆ m_svc

bool RTC::PeriodicExecutionContext::m_svc
protected

The thread running flag of ExecutionContext.

Definition at line 1508 of file PeriodicExecutionContext.h.

◆ m_worker

Worker RTC::PeriodicExecutionContext::m_worker
protected

A condition variable for external triggered worker.

Definition at line 1532 of file PeriodicExecutionContext.h.

◆ rtclog

Logger RTC::PeriodicExecutionContext::rtclog
protected

Logger stream.

Definition at line 1488 of file PeriodicExecutionContext.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:47