jp.go.aist.rtm.RTC.executionContext
Class ExecutionContextWorker

java.lang.Object
  extended by jp.go.aist.rtm.RTC.executionContext.ExecutionContextWorker

public class ExecutionContextWorker
extends java.lang.Object

PeriodicExecutionContext class

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


Field Summary
protected  java.util.ArrayList<RTObjectStateMachine> m_addedComps
           
protected  java.lang.String m_addedMutex
           
protected  java.util.ArrayList<RTObjectStateMachine> m_comps
           List of the participating component
protected  java.lang.String m_mutex
           
protected  ExecutionContextService m_ref
           
protected  java.util.ArrayList<RTObjectStateMachine> m_removedComps
           
protected  java.lang.String m_removedMutex
           
protected  boolean m_running
           The running state of ExecutionContext true: running, false: stopped
protected  Logbuf rtcout
           Logger stream
protected  boolean running_
           
protected  boolean ticked_
           
 
Constructor Summary
ExecutionContextWorker()
           Default Constructor
 
Method Summary
 ReturnCode_t activateComponent(LightweightRTObject comp, RTObjectStateMachineHolder rtobjhldr)
           Activate an RT-component
 ReturnCode_t addComponent(LightweightRTObject comp)
           Add an RT-component
 ReturnCode_t bindComponent(RTObject_impl rtc)
           Bind the component.
 ReturnCode_t deactivateComponent(LightweightRTObject comp, RTObjectStateMachineHolder rtobjhldr)
           Deactivate an RT-component
 RTObjectStateMachine findComponent(LightweightRTObject comp)
           
 LifeCycleState getComponentState(LightweightRTObject comp)
           Get RT-component's state
 ExecutionContextService getECRef()
           
 java.lang.String getStateString(LifeCycleState state)
           
 void invokeWorker()
           
 void invokeWorkerDo()
           
 void invokeWorkerPostDo()
           
 void invokeWorkerPreDo()
           
 boolean isAllCurrentState(LifeCycleState state)
           
 boolean isAllNextState(LifeCycleState state)
           
 boolean isOneOfCurrentState(LifeCycleState state)
           
 boolean isOneOfNextState(LifeCycleState state)
           
 boolean isRunning()
           Check for ExecutionContext running state
 ReturnCode_t removeComponent(LightweightRTObject comp)
           Remove the RT-Component from participant list
 ReturnCode_t resetComponent(LightweightRTObject comp, RTObjectStateMachineHolder rtobjhldr)
           Reset the RT-component
 void setECRef(ExecutionContextService ref)
           
 ReturnCode_t start()
           Start the ExecutionContext
 ReturnCode_t stop()
           Stop the ExecutionContext
 void updateComponentList()
           
 ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj)
           
 ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj, long cycle)
           
 ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj, TimeValue timeout)
           
 ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj, TimeValue timeout, long cycle)
           
 ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj)
           
 ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj, long cycle)
           
 ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj, TimeValue timeout)
           
 ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj, TimeValue timeout, long cycle)
           
 ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj)
           
 ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj, long cycle)
           
 ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj, TimeValue timeout)
           
 ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj, TimeValue timeout, long cycle)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rtcout

protected Logbuf rtcout
Logger stream


m_ref

protected ExecutionContextService m_ref

m_running

protected boolean m_running
The running state of ExecutionContext true: running, false: stopped


ticked_

protected boolean ticked_

running_

protected boolean running_

m_comps

protected java.util.ArrayList<RTObjectStateMachine> m_comps
List of the participating component


m_mutex

protected java.lang.String m_mutex

m_addedComps

protected java.util.ArrayList<RTObjectStateMachine> m_addedComps

m_addedMutex

protected java.lang.String m_addedMutex

m_removedComps

protected java.util.ArrayList<RTObjectStateMachine> m_removedComps

m_removedMutex

protected java.lang.String m_removedMutex
Constructor Detail

ExecutionContextWorker

public ExecutionContextWorker()
Default Constructor

Default Constructor Set the following items to profile. - kind : PERIODIC - rate : 0.0

Method Detail

setECRef

public void setECRef(ExecutionContextService ref)

getECRef

public ExecutionContextService getECRef()

isRunning

public boolean isRunning()
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)

start

public ReturnCode_t start()
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

stop

public ReturnCode_t stop()
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

activateComponent

public ReturnCode_t activateComponent(LightweightRTObject comp,
                                      RTObjectStateMachineHolder rtobjhldr)
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:
comp - The target RT-Component holder for activation
Returns:
The return code of ReturnCode_t type

waitActivateComplete

public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
                                         TimeValue timeout,
                                         long cycle)

waitActivateComplete

public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj)

waitActivateComplete

public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
                                         TimeValue timeout)

waitActivateComplete

public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
                                         long cycle)

deactivateComponent

public ReturnCode_t deactivateComponent(LightweightRTObject comp,
                                        RTObjectStateMachineHolder rtobjhldr)
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:
comp - The target RT-Component holder for deactivate
Returns:
The return code of ReturnCode_t type

waitDeactivateComplete

public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
                                           TimeValue timeout,
                                           long cycle)

waitDeactivateComplete

public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
                                           TimeValue timeout)

waitDeactivateComplete

public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
                                           long cycle)

waitDeactivateComplete

public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj)

resetComponent

public ReturnCode_t resetComponent(LightweightRTObject comp,
                                   RTObjectStateMachineHolder rtobjhldr)
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:
comp - The target RT-Component holder for reset
Returns:
The return code of ReturnCode_t type

waitResetComplete

public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
                                      TimeValue timeout,
                                      long cycle)

waitResetComplete

public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
                                      TimeValue timeout)

waitResetComplete

public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
                                      long cycle)

waitResetComplete

public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj)

getComponentState

public LifeCycleState getComponentState(LightweightRTObject 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:
comp - The target RT-Component to get the state
Returns:
The current state of the target RT-Component(LifeCycleState)

getStateString

public final java.lang.String getStateString(LifeCycleState state)

addComponent

public ReturnCode_t addComponent(LightweightRTObject 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:
comp - The target RT-Component for add
Returns:
The return code of ReturnCode_t type

bindComponent

public ReturnCode_t bindComponent(RTObject_impl rtc)
Bind the component.

Bind the component.

Parameters:
rtc - RT-Component's instances
Returns:
The return code of ReturnCode_t type

removeComponent

public ReturnCode_t removeComponent(LightweightRTObject 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:
comp - The target RT-Component for delete
Returns:
The return code of ReturnCode_t type

findComponent

public RTObjectStateMachine findComponent(LightweightRTObject comp)

isAllCurrentState

public boolean isAllCurrentState(LifeCycleState state)

isAllNextState

public boolean isAllNextState(LifeCycleState state)

isOneOfCurrentState

public boolean isOneOfCurrentState(LifeCycleState state)

isOneOfNextState

public boolean isOneOfNextState(LifeCycleState state)

invokeWorker

public void invokeWorker()

invokeWorkerPreDo

public void invokeWorkerPreDo()

invokeWorkerDo

public void invokeWorkerDo()

invokeWorkerPostDo

public void invokeWorkerPostDo()

updateComponentList

public void updateComponentList()