#include <ExecutionContext.h>
Inheritance diagram for RTC::ExecutionContextBase:
Public Member Functions | |
ExecutionContextBase () | |
Constructor. | |
ExecutionContextBase (RTObject_ptr owner) | |
virtual | ~ExecutionContextBase () |
Destructor. | |
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 Attributes | |
ExecutionContextProfile | m_profile |
CORBA::Boolean | m_running |
Classes | |
struct | find_objref |
An ExecutionContext allows the business logic of an RTC to be decoupled from the thread of control in which it is executed. The context represents a logical thread of control and is provided to RTCs at runtime as an argument to various operations, allowing them to query and modify their own state, and that of other RTCs executing within the same context, in the lifecycle. This separation of concerns is important for two primary reasons:
Ownership and Participation
Each execution context is owned by a single RTC and may be used to execute that RTC and the RTCs contained within it, directly or indirectly. An RTC that owns one or more execution contexts is known as an autonomous RTC. An autonomous RTC and some subset of the RTCs within it (to be defined by the application developer) shall be executed by the infrastructure according to the context's execution kind, which defines when each RTC's operations will be invoked when and in which order. These RTCs are said to participate in the context. The available execution kinds are described below. The relationship between RTCs and execution contexts may be many-to-many in the general case: multiple RTCs may be invoked from the same execution context, and a single RTC may be invoked from multiple contexts. In the case where multiple RTCs are invoked from the same context, starting or stopping the context shall result in the corresponding lifecycle transitions for all of those components.
Logical and Physical Threads
Although an execution context represents a logical thread of control, the choice of how it maps to a physical thread shall be left to the application”Ēs deployment environment. Implementations may elect to associate contexts with threads with a one-to-one mapping, to serve multiple contexts from a single thread, or by any other means. In the case where a given RTC may be invoked from multiple contexts, concurrency management is implementation-dependent.
|
Constructor.
|
|
|
|
Destructor.
|
|
Activate a component.
DescriptionThe 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
Reimplemented in RTC::PeriodicExecutionContext. |
|
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
Reimplemented in RTC::PeriodicExecutionContext. |
|
Deactivate a component.
DescriptionThe 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
Reimplemented in RTC::PeriodicExecutionContext. |
|
Get component's state.
DescriptionThis operation shall report the LifeCycleState of the given participant RTC.
Constraints
Reimplemented in RTC::PeriodicExecutionContext. |
|
Get the ExecutionKind.
DescriptionThis operation shall report the execution kind of the execution context.
ExecutionKindThe ExecutionKind enumeration defines the execution semantics (see OMG RTC Specification section 2.3) of the RTCs that participate in an execution context.
Reimplemented in RTC::PeriodicExecutionContext. |
|
Get the ExecutionContextProfile.
DescriptionThis operation provides a profile descriptor for the execution context. Reimplemented in RTC::PeriodicExecutionContext. |
|
Get executionrate(Hz).
DescriptionThis operation shall return the rate (in hertz) at which its Active participating RTCs are being invoked.
SemanticsAn 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
Reimplemented in RTC::PeriodicExecutionContext. |
|
Test for ExecutionContext running state.
DescriptionThis operation shall return true if the context is in the Running state.
SemanticsWhile the context is Running, all Active RTCs participating in the context shall be executed according to the context's execution kind.
Reimplemented in RTC::PeriodicExecutionContext. |
|
Remove the component from component list.
DescriptionThis operation causes a participant RTC to stop participating in the execution context.
Constraints
Reimplemented in RTC::PeriodicExecutionContext. |
|
Deactivate a component.
DescriptionThe 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
Reimplemented in RTC::PeriodicExecutionContext. |
|
Set rate (Hz).
DescriptionThis operation shall set the rate (in hertz) at which this context's Active participating RTCs are being called.
SemanticsIf 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
Reimplemented in RTC::PeriodicExecutionContext. |
|
Start the ExecutionContext.
DescriptionRequest 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.
SemanticsAn execution context may be started and stopped multiple times.
Constraints
Reimplemented in RTC::PeriodicExecutionContext. |
|
Stop the ExecutionContext.
DescriptionRequest 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.
SemanticsAn execution context may be started and stopped multiple times.
Constraints
Reimplemented in RTC::PeriodicExecutionContext. |
|
Reimplemented in RTC::PeriodicExecutionContext. |
|
Reimplemented in RTC::PeriodicExecutionContext. |