Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

RTC::PeriodicExecutionContext Class Reference

#include <PeriodicExecutionContext.h>

Inheritance diagram for RTC::PeriodicExecutionContext:

RTC::ExecutionContextBase List of all members.

Public Member Functions

 PeriodicExecutionContext ()
 PeriodicExecutionContext (DataFlowComponent_ptr owner, double rate=1000.0)
virtual ~PeriodicExecutionContext ()
ExecutionContextService_ptr getRef ()
virtual int open (void *args)
 Create internal activity thread.
virtual int svc (void)
 Create internal activity thread.
virtual int close (unsigned long flags)
 Close activity thread.
virtual CORBA::Boolean is_running ()
 Test for ExecutionContext running state.
virtual ReturnCode_t start ()
 Start the ExecutionContext.
virtual ReturnCode_t stop ()
 Stop the ExecutionContext.
virtual CORBA::Double get_rate ()
 Get executionrate(Hz).
virtual ReturnCode_t set_rate (CORBA::Double rate)
 Set rate (Hz).
virtual ReturnCode_t activate_component (LightweightRTObject_ptr comp)
 Activate a component.
virtual ReturnCode_t deactivate_component (LightweightRTObject_ptr comp)
 Deactivate a component.
virtual ReturnCode_t reset_component (LightweightRTObject_ptr comp)
 Deactivate a component.
virtual LifeCycleState get_component_state (LightweightRTObject_ptr comp)
 Get component's state.
virtual ExecutionKind get_kind ()
 Get the ExecutionKind.
virtual ReturnCode_t add (LightweightRTObject_ptr comp)
 Add a component.
virtual ReturnCode_t remove (LightweightRTObject_ptr comp)
 Remove the component from component list.
virtual ExecutionContextProfile * get_profile ()
 Get the ExecutionContextProfile.

Protected Types

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

Protected Attributes

std::vector< Compm_comps
bool m_running
ExecutionContextProfile m_profile
long int m_usec
ExecutionContextService_var m_ref
bool m_nowait

Classes

struct  Comp
class  DFP
class  DFPBase
struct  find_comp
struct  invoke_on_rate_changed
struct  invoke_on_shutdown
struct  invoke_on_startup
struct  invoke_worker

Member Typedef Documentation

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

typedef StateHolder<ExecContextState> RTC::PeriodicExecutionContext::ECStates [protected]
 

typedef LifeCycleState RTC::PeriodicExecutionContext::ExecContextState [protected]
 


Constructor & Destructor Documentation

RTC::PeriodicExecutionContext::PeriodicExecutionContext  ) 
 

RTC::PeriodicExecutionContext::PeriodicExecutionContext DataFlowComponent_ptr  owner,
double  rate = 1000.0
 

virtual RTC::PeriodicExecutionContext::~PeriodicExecutionContext  )  [virtual]
 


Member Function Documentation

virtual ReturnCode_t RTC::PeriodicExecutionContext::activate_component LightweightRTObject_ptr  comp  )  [virtual]
 

Activate a component.

Description

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.

Constraints

  • An execution context can only activate its participant components. If the given RTC is not participating in the execution context, this operation shall fail with BAD_PARAMETER.
  • An RTC that is in the Error state cannot be activated until after it has been reset. If the given RTC is in the Error state, this operation shall fail with PRECONDITION_NOT_MET.
Returns:
This operation returns OK, BAD_PARAMETER or PRECONDITION_NOT_MET

Reimplemented from RTC::ExecutionContextBase.

virtual ReturnCode_t RTC::PeriodicExecutionContext::add LightweightRTObject_ptr  comp  )  [virtual]
 

Add a component.

The operation causes the given RTC to begin participating in the execution context.

The newly added RTC will begin in the Inactive state. If the ExecutionKind is PERIODIC, the index represents the sorted order in which the RTC is to be executed. Otherwise, the meaning of the index is implementation-defined and may be ignored.

Constraints

  • If the ExecutionKind is PERIODIC, the RTC must be a data flow participant (see OMG RTC Specification section 2.3.1.2). Otherwise, this operation will fail with PRECONDITION_NOT_MET.
Returns:
OK or PRECONDITION_NOT_ME would be returned.

Reimplemented from RTC::ExecutionContextBase.

virtual int RTC::PeriodicExecutionContext::close unsigned long  flags  )  [virtual]
 

Close activity thread.

close() method is called when activity thread svc() is returned. This method deactivate this object and notify it to manager. ACE_Task class method override.

virtual ReturnCode_t RTC::PeriodicExecutionContext::deactivate_component LightweightRTObject_ptr  comp  )  [virtual]
 

Deactivate a component.

Description

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.

Constraints

  • An execution context can only deactivate its participant components. If the given RTC is not participating in the execution context, this operation shall fail with BAD_PARAMETER.
Returns:
This operation returns OK or BAD_PARAMETER.

Reimplemented from RTC::ExecutionContextBase.

virtual LifeCycleState RTC::PeriodicExecutionContext::get_component_state LightweightRTObject_ptr  comp  )  [virtual]
 

Get component's state.

Description

This operation shall report the LifeCycleState of the given participant RTC.

Constraints

  • The given RTC must be Alive.
  • The given RTC must be a participant in the target ExecutionContext.
  • The LifeCycleState returned by this operation shall be one of LifeCycleState::INACTIVE, ACTIVE, or ERROR.
Returns:
The LifeCycleState returned by this operation shall be one of LifeCycleState::INACTIVE, ACTIVE, or ERROR.

Reimplemented from RTC::ExecutionContextBase.

virtual ExecutionKind RTC::PeriodicExecutionContext::get_kind  )  [virtual]
 

Get the ExecutionKind.

Description

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

ExecutionKind

The ExecutionKind enumeration defines the execution semantics (see OMG RTC Specification section 2.3) of the RTCs that participate in an execution context.
PERIODIC The participant RTCs are executing according to periodic sampled data semantics (see OMG RTC Specification section 2.3.1).
EVENT_DRIVEN The participant RTCs are executing according to stimulus response semantics (see OMG RTC Specification section 2.3.2).
OTHER The participant RTCs are executing according to some semantics not defined by this specification.

Reimplemented from RTC::ExecutionContextBase.

virtual ExecutionContextProfile* RTC::PeriodicExecutionContext::get_profile  )  [virtual]
 

Get the ExecutionContextProfile.

Description

This operation provides a profile descriptor for the execution context.

Reimplemented from RTC::ExecutionContextBase.

virtual CORBA::Double RTC::PeriodicExecutionContext::get_rate  )  [virtual]
 

Get executionrate(Hz).

Description

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

Semantics

An implementation is permitted to perform some periodic or quasi-periodic processing within an execution context with an ExecutionKind other than PERIODIC. In such a case, the result of this operation is implementation-defined. If no periodic processing of any kind is taking place within the context, this operation shall fail as described in section 2.2.1 above.

Constraints

Returns:
If the context has an ExecutionKind of PERIODIC, this operation shall return a rate greater than zero.

Reimplemented from RTC::ExecutionContextBase.

ExecutionContextService_ptr RTC::PeriodicExecutionContext::getRef  )  [inline]
 

virtual CORBA::Boolean RTC::PeriodicExecutionContext::is_running  )  [virtual]
 

Test for ExecutionContext running state.

Description

This operation shall return true if the context is in the Running state.

Semantics

While the context is Running, all Active RTCs participating in the context shall be executed according to the context's execution kind.

Returns:
If the ExecutionContext is running, it returns true.

Reimplemented from RTC::ExecutionContextBase.

virtual int RTC::PeriodicExecutionContext::open void *  args  )  [virtual]
 

Create internal activity thread.

Create internal activity thread. This is ACE_Task class method over ride.

Parameters:
args usually give 0

virtual ReturnCode_t RTC::PeriodicExecutionContext::remove LightweightRTObject_ptr  comp  )  [virtual]
 

Remove the component from component list.

Description

This operation causes a participant RTC to stop participating in the execution context.

Constraints

  • If the given RTC is not currently participating in the execution context, this operation shall fail with BAD_PARAMETER.
  • An RTC must be deactivated before it can be removed from an execution context. If the given RTC is participating in the execution context but is still in the Active state, this operation shall fail with PRECONDITION_NOT_MET.

Reimplemented from RTC::ExecutionContextBase.

virtual ReturnCode_t RTC::PeriodicExecutionContext::reset_component LightweightRTObject_ptr  comp  )  [virtual]
 

Deactivate a component.

Description

The given RTC is Error or 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.

Constraints

  • An execution context can only deactivate its participant components. If the given RTC is not participating in the execution context, this operation shall fail with BAD_PARAMETER.
Returns:
This operation returns OK or BAD_PARAMETER.

Reimplemented from RTC::ExecutionContextBase.

virtual ReturnCode_t RTC::PeriodicExecutionContext::set_rate CORBA::Double  rate  )  [virtual]
 

Set rate (Hz).

Description

This operation shall set the rate (in hertz) at which this context's Active participating RTCs are being called.

Semantics

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. An implementation is permitted to perform some periodic or quasi-periodic processing within an execution context with an ExecutionKind other than PERIODIC. If such is the case, and the implementation reports a rate from get_rate, this operation shall set that rate successfully provided that the given rate is valid. If no periodic processing of any kind is taking place within the context, this operation shall fail with ReturnCode_t::UNSUPPORTED.

Constraints

Returns:
The given rate must be greater than zero. Otherwise, this operation shall fail with ReturnCode_t::BAD_PARAMETER.

Reimplemented from RTC::ExecutionContextBase.

virtual ReturnCode_t RTC::PeriodicExecutionContext::start  )  [virtual]
 

Start the ExecutionContext.

Description

Request that the context enter the Running state. Once the state transition occurs, the ComponentAction::on_startup operation (see OMG RTC Specification section 2.2.2.5.2) will be invoked.

Semantics

An execution context may be started and stopped multiple times.

Constraints

Returns:
This operation shall fail with PRECONDITION_NOT_MET if the context is not in the Stopped state.

Reimplemented from RTC::ExecutionContextBase.

virtual ReturnCode_t RTC::PeriodicExecutionContext::stop  )  [virtual]
 

Stop the ExecutionContext.

Description

Request that the context enter the Stopped state. Once the transition occurs, the ComponentAction::on_shutdown operation (see OMG RTC Specification section 2.2.2.5.4) will be invoked.

Semantics

An execution context may be started and stopped multiple times.

Constraints

Returns:
This operation shall fail with PRECONDITION_NOT_MET if the context is not in the Stopped state.

Reimplemented from RTC::ExecutionContextBase.

virtual int RTC::PeriodicExecutionContext::svc void   )  [virtual]
 

Create internal activity thread.

Run by a daemon thread to handle deferred processing. ACE_Task class method override.


Member Data Documentation

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

bool RTC::PeriodicExecutionContext::m_nowait [protected]
 

ExecutionContextProfile RTC::PeriodicExecutionContext::m_profile [protected]
 

Reimplemented from RTC::ExecutionContextBase.

ExecutionContextService_var RTC::PeriodicExecutionContext::m_ref [protected]
 

bool RTC::PeriodicExecutionContext::m_running [protected]
 

Reimplemented from RTC::ExecutionContextBase.

long int RTC::PeriodicExecutionContext::m_usec [protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Oct 5 05:16:04 2007 for OpenRTM by  doxygen 1.4.1