RTT::base::TaskCore Class Reference

#include <TaskCore.hpp>

Inheritance diagram for RTT::base::TaskCore:
Inheritance graph
[legend]

List of all members.

Public Types

enum  TaskState {
  Init, PreOperational, FatalError, Exception,
  Stopped, Running, RunTimeError, Init,
  PreOperational, FatalError, Exception, Stopped,
  Running, RunTimeError
}
enum  TaskState {
  Init, PreOperational, FatalError, Exception,
  Stopped, Running, RunTimeError, Init,
  PreOperational, FatalError, Exception, Stopped,
  Running, RunTimeError
}

Public Member Functions

ExecutionEngineengine ()
const ExecutionEngineengine () const
ExecutionEngineengine ()
const ExecutionEngineengine () const
virtual TaskState getTargetState () const
virtual TaskState getTargetState () const
virtual TaskState getTaskState () const
virtual TaskState getTaskState () const
void setExecutionEngine (ExecutionEngine *engine)
void setExecutionEngine (ExecutionEngine *engine)
 TaskCore (ExecutionEngine *parent, TaskState initial_state=Stopped)
 TaskCore (TaskState initial_state=Stopped)
 TaskCore (ExecutionEngine *parent, TaskState initial_state=Stopped)
 TaskCore (TaskState initial_state=Stopped)
virtual ~TaskCore ()
virtual ~TaskCore ()
Operations

These TaskCore functions are exported in a TaskContext as script methods and are for configuration, starting and stopping its ExecutionEngine.

virtual bool activate ()
virtual bool activate ()
virtual bool cleanup ()
virtual bool cleanup ()
virtual bool configure ()
virtual bool configure ()
virtual void error ()
virtual void error ()
virtual unsigned getCpuAffinity () const
virtual unsigned getCpuAffinity () const
virtual Seconds getPeriod () const
virtual Seconds getPeriod () const
virtual bool inException () const
virtual bool inException () const
virtual bool inFatalError () const
virtual bool inFatalError () const
virtual bool inRunTimeError () const
virtual bool inRunTimeError () const
virtual bool isActive () const
virtual bool isActive () const
virtual bool isConfigured () const
virtual bool isConfigured () const
virtual bool isRunning () const
virtual bool isRunning () const
virtual bool recover ()
virtual bool recover ()
virtual bool setCpuAffinity (unsigned cpu)
virtual bool setCpuAffinity (unsigned cpu)
virtual bool setPeriod (Seconds s)
virtual bool setPeriod (Seconds s)
virtual bool start ()
virtual bool start ()
virtual bool stop ()
virtual bool stop ()
virtual bool trigger ()
virtual bool trigger ()
virtual bool update ()
virtual bool update ()

Protected Member Functions

virtual bool breakUpdateHook ()
virtual bool breakUpdateHook ()
virtual void cleanupHook ()
virtual void cleanupHook ()
virtual bool configureHook ()
virtual bool configureHook ()
virtual void errorHook ()
virtual void errorHook ()
virtual void exception ()
virtual void exception ()
virtual void exceptionHook ()
virtual void exceptionHook ()
virtual void fatal ()
virtual void fatal ()
virtual bool startHook ()
virtual bool startHook ()
virtual void stopHook ()
virtual void stopHook ()
virtual void updateHook ()
virtual void updateHook ()

Protected Attributes

ExecutionEngineee
TaskState mTaskState

Private Member Functions

virtual void prepareUpdateHook ()
virtual void prepareUpdateHook ()
 TaskCore (TaskCore &)
 TaskCore (TaskCore &)

Private Attributes

TaskState const mInitialState
TaskState mTargetState

Friends

class ::RTT::ExecutionEngine
class TaskContext

Detailed Description

The minimal Orocos task. It has a state and an ExecutionEngine to process messages and user functions.

Definition at line 54 of file install/include/rtt/base/TaskCore.hpp.


Member Enumeration Documentation

Describes the different states a component can have. When a TaskContext is being constructed, it is in the Init state. After the construction ends, the component arrives in the PreOperational (additional configuration required) or the Stopped (ready to run) state. Invoking start() will make a transition to the Running state and stop() back to the Stopped state. The Running state executes updateHook(). Finally, there is an FatalError state, in which the component can enter by calling the protected method fatal(). In this state, the ExecutionEngine is stopped and updateHook() is no longer called. The object should then be disposed by a supervision system.

Next to the fatal error, one run-time error level is available in the Running state as well. This level allows 'automatic' recovery by the component in case the problem is temporal. In case of problems, one may call the protected method error() when the component is Running. The component will enter the RunTimeError state and will cause the errorHook() to be called instead of updateHook(). When recover() is called, this run-time error state is left and the nominal Running state is entered again.

In order to check if these transitions are allowed, hook functions are executed, which can be filled in by the component builder.

  • A transition from PreOperational to Stopped is checked by calling the configureHook() method. If this method returns true, the transition is made, otherwise, the state remains PreOperational.
  • A transition from Stopped to Running is checked by calling the startHook() method. If this method returns true, the transition is made, otherwise, the state remains Stopped.
  • A transition from Running to Stopped is always allowed and the stopHook() method is called to inform the component of this transtion.
  • A transition from Stopped to PreOperational is always allowed and the cleanupHook() method is called to inform the component of this transtion.
Enumerator:
Init 
PreOperational 

The state during component construction.

FatalError 

The state indicating additional configuration is required.

Exception 

The state indicating the component encountered a fatal error and is unable to execute.

Stopped 

The state indicating the component encountered a C++ exception.

Running 

The state indicating the component is ready to run.

RunTimeError 

The state indicating the component is running [green].

The state indicating that a run-time error has occured [red] and needs attention.

Init 
PreOperational 

The state during component construction.

FatalError 

The state indicating additional configuration is required.

Exception 

The state indicating the component encountered a fatal error and is unable to execute.

Stopped 

The state indicating the component encountered a C++ exception.

Running 

The state indicating the component is ready to run.

RunTimeError 

The state indicating the component is running [green].

The state indicating that a run-time error has occured [red] and needs attention.

Definition at line 99 of file rtt/base/TaskCore.hpp.

Describes the different states a component can have. When a TaskContext is being constructed, it is in the Init state. After the construction ends, the component arrives in the PreOperational (additional configuration required) or the Stopped (ready to run) state. Invoking start() will make a transition to the Running state and stop() back to the Stopped state. The Running state executes updateHook(). Finally, there is an FatalError state, in which the component can enter by calling the protected method fatal(). In this state, the ExecutionEngine is stopped and updateHook() is no longer called. The object should then be disposed by a supervision system.

Next to the fatal error, one run-time error level is available in the Running state as well. This level allows 'automatic' recovery by the component in case the problem is temporal. In case of problems, one may call the protected method error() when the component is Running. The component will enter the RunTimeError state and will cause the errorHook() to be called instead of updateHook(). When recover() is called, this run-time error state is left and the nominal Running state is entered again.

In order to check if these transitions are allowed, hook functions are executed, which can be filled in by the component builder.

  • A transition from PreOperational to Stopped is checked by calling the configureHook() method. If this method returns true, the transition is made, otherwise, the state remains PreOperational.
  • A transition from Stopped to Running is checked by calling the startHook() method. If this method returns true, the transition is made, otherwise, the state remains Stopped.
  • A transition from Running to Stopped is always allowed and the stopHook() method is called to inform the component of this transtion.
  • A transition from Stopped to PreOperational is always allowed and the cleanupHook() method is called to inform the component of this transtion.
Enumerator:
Init 
PreOperational 

The state during component construction.

FatalError 

The state indicating additional configuration is required.

Exception 

The state indicating the component encountered a fatal error and is unable to execute.

Stopped 

The state indicating the component encountered a C++ exception.

Running 

The state indicating the component is ready to run.

RunTimeError 

The state indicating the component is running [green].

The state indicating that a run-time error has occured [red] and needs attention.

Init 
PreOperational 

The state during component construction.

FatalError 

The state indicating additional configuration is required.

Exception 

The state indicating the component encountered a fatal error and is unable to execute.

Stopped 

The state indicating the component encountered a C++ exception.

Running 

The state indicating the component is ready to run.

RunTimeError 

The state indicating the component is running [green].

The state indicating that a run-time error has occured [red] and needs attention.

Definition at line 99 of file install/include/rtt/base/TaskCore.hpp.


Constructor & Destructor Documentation

RTT::TaskCore::TaskCore ( TaskState  initial_state = Stopped  ) 

Create a TaskCore. It's ExecutionEngine will be newly constructed with private processing of commands, events, programs and state machines.

Parameters:
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().

Definition at line 47 of file TaskCore.cpp.

RTT::TaskCore::TaskCore ( ExecutionEngine parent,
TaskState  initial_state = Stopped 
)

Create a TaskCore. Its commands programs and state machines are processed by parent. Use this constructor to share execution engines among task contexts, such that the execution of their functionality is serialised (executed in the same thread).

Parameters:
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().

Definition at line 55 of file TaskCore.cpp.

RTT::TaskCore::~TaskCore (  )  [virtual]

Definition at line 65 of file TaskCore.cpp.

RTT::base::TaskCore::TaskCore ( TaskCore  )  [private]
RTT::base::TaskCore::TaskCore ( TaskState  initial_state = Stopped  ) 

Create a TaskCore. It's ExecutionEngine will be newly constructed with private processing of commands, events, programs and state machines.

Parameters:
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().
RTT::base::TaskCore::TaskCore ( ExecutionEngine parent,
TaskState  initial_state = Stopped 
)

Create a TaskCore. Its commands programs and state machines are processed by parent. Use this constructor to share execution engines among task contexts, such that the execution of their functionality is serialised (executed in the same thread).

Parameters:
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().
virtual RTT::base::TaskCore::~TaskCore (  )  [virtual]
RTT::base::TaskCore::TaskCore ( TaskCore  )  [private]

Member Function Documentation

virtual bool RTT::base::TaskCore::activate (  )  [virtual]

This method starts the ExecutionEngine of this component in case it was not running. Normally, it is always running. There is no way to deactivate it from the public interface.

Returns:
true if the ExecutionEngine is running (again) and false if it could not be started.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::activate (  )  [virtual]

This method starts the ExecutionEngine of this component in case it was not running. Normally, it is always running. There is no way to deactivate it from the public interface.

Returns:
true if the ExecutionEngine is running (again) and false if it could not be started.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 236 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::breakUpdateHook (  )  [protected, virtual]

Implement this function if your code might block for long times inside the updateHook() function. Insert in this hook the code to wake up that code or signal it otherwise that updateHook() is requested to return (for example by setting a flag). The method returns false by default.

Returns:
true if well received and updateHook() will soon return. False otherwise.

Reimplemented in StatesTC.

bool RTT::TaskCore::breakUpdateHook (  )  [protected, virtual]

Implement this function if your code might block for long times inside the updateHook() function. Insert in this hook the code to wake up that code or signal it otherwise that updateHook() is requested to return (for example by setting a flag). The method returns false by default.

Returns:
true if well received and updateHook() will soon return. False otherwise.

Reimplemented in StatesTC.

Definition at line 308 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::cleanup (  )  [virtual]

This method instructs a stopped component to enter the pre-operational state again. It calls cleanupHook().

Returns:
true if the component was in the Stopped state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::cleanup (  )  [virtual]

This method instructs a stopped component to enter the pre-operational state again. It calls cleanupHook().

Returns:
true if the component was in the Stopped state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 123 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::cleanupHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when cleanup() is called. The default implementation is an empty function.

Reimplemented in StatesTC.

void RTT::TaskCore::cleanupHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when cleanup() is called. The default implementation is an empty function.

Reimplemented in StatesTC.

Definition at line 241 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::configure (  )  [virtual]

This method instructs the component to (re-)read configuration data and try to enter the Stopped state. This can only succeed if the component is not running and configureHook() returns true.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::configure (  )  [virtual]

This method instructs the component to (re-)read configuration data and try to enter the Stopped state. This can only succeed if the component is not running and configureHook() returns true.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 100 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::configureHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when configure() is called. The default implementation is an empty function which returns true.

Return values:
true to indicate that configuration succeeded and the Stopped state may be entered.
false to indicate that configuration failed and the Preoperational state is entered.

Reimplemented in StatesTC.

bool RTT::TaskCore::configureHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when configure() is called. The default implementation is an empty function which returns true.

Return values:
true to indicate that configuration succeeded and the Stopped state may be entered.
false to indicate that configuration failed and the Preoperational state is entered.

Reimplemented in StatesTC.

Definition at line 289 of file TaskCore.cpp.

ExecutionEngine* RTT::base::TaskCore::engine (  )  [inline]

Get a pointer to the ExecutionEngine of this Task.

Definition at line 334 of file rtt/base/TaskCore.hpp.

const ExecutionEngine* RTT::base::TaskCore::engine (  )  const [inline]

Get a const pointer to the ExecutionEngine of this Task.

Definition at line 326 of file rtt/base/TaskCore.hpp.

ExecutionEngine* RTT::base::TaskCore::engine (  )  [inline]

Get a pointer to the ExecutionEngine of this Task.

Definition at line 334 of file install/include/rtt/base/TaskCore.hpp.

const ExecutionEngine* RTT::base::TaskCore::engine (  )  const [inline]

Get a const pointer to the ExecutionEngine of this Task.

Definition at line 326 of file install/include/rtt/base/TaskCore.hpp.

virtual void RTT::base::TaskCore::error (  )  [virtual]

Call this method in a Running state to indicate a run-time error condition. errorHook() will be called instead of updateHook(). If the error condition is solved, call recover().

void RTT::TaskCore::error (  )  [virtual]

Call this method in a Running state to indicate a run-time error condition. errorHook() will be called instead of updateHook(). If the error condition is solved, call recover().

Definition at line 148 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::errorHook (  )  [protected, virtual]

Implement this method to contain code that must be executed in the RunTimeError state, instead of updateHook(). This allows you to specify the behaviour in an erroneous component. errorHook() is called as long as the component is not recover()'ed. After recover()'ed, the updateHook() is called again.

Reimplemented in StatesTC.

void RTT::TaskCore::errorHook (  )  [protected, virtual]

Implement this method to contain code that must be executed in the RunTimeError state, instead of updateHook(). This allows you to specify the behaviour in an erroneous component. errorHook() is called as long as the component is not recover()'ed. After recover()'ed, the updateHook() is called again.

Reimplemented in StatesTC.

Definition at line 298 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::exception (  )  [protected, virtual]

Call this method to indicate a run-time exception happend. First the TaskState is set to Exception. Next, if the taskstate was >= Running, stopHook() is called. Next, if the taskstate was >= Stopped, cleanupHook() is called. Finally, exceptionHook() is called. If any exception happens in exceptionHook(), fatal() is called.

void RTT::TaskCore::exception (  )  [protected, virtual]

Call this method to indicate a run-time exception happend. First the TaskState is set to Exception. Next, if the taskstate was >= Running, stopHook() is called. Next, if the taskstate was >= Stopped, cleanupHook() is called. Finally, exceptionHook() is called. If any exception happens in exceptionHook(), fatal() is called.

Definition at line 155 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::exceptionHook (  )  [protected, virtual]

Implement this method to contain code that must be executed when transitioning to the Exception state. This allows you to specify the last actions in an erroneous component, after stopHook() and cleanupHook() were called.

See also:
recover() to leave the Exception state.

Reimplemented in StatesTC.

void RTT::TaskCore::exceptionHook (  )  [protected, virtual]

Implement this method to contain code that must be executed when transitioning to the Exception state. This allows you to specify the last actions in an erroneous component, after stopHook() and cleanupHook() were called.

See also:
recover() to leave the Exception state.

Reimplemented in StatesTC.

Definition at line 313 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::fatal (  )  [protected, virtual]

Call this method from any place to indicate that this component encountered a fatal error. It calls no hooks, the ExecutionEngine is stopped and the component waits destruction.

void RTT::TaskCore::fatal (  )  [protected, virtual]

Call this method from any place to indicate that this component encountered a fatal error. It calls no hooks, the ExecutionEngine is stopped and the component waits destruction.

Definition at line 142 of file TaskCore.cpp.

virtual unsigned RTT::base::TaskCore::getCpuAffinity (  )  const [virtual]

Get the configured cpu affinity of this component.

See also:
ActivityInterface::getCpuAffinity()
unsigned RTT::TaskCore::getCpuAffinity (  )  const [virtual]

Get the configured cpu affinity of this component.

See also:
ActivityInterface::getCpuAffinity()

Definition at line 279 of file TaskCore.cpp.

virtual Seconds RTT::base::TaskCore::getPeriod (  )  const [virtual]

Get the configured execution period of this component. Note that this value only is used when the component isActive() or isRunning().

Return values:
0.0 if the component is non-periodic (event based).
a negative number when the component is not executable.
a positive value when the component is periodic. The period is expressed in seconds.
Todo:
: add a bool setPeriod(double) function to allow changing the period at run-time.
Seconds RTT::TaskCore::getPeriod (  )  const [virtual]

Get the configured execution period of this component. Note that this value only is used when the component isActive() or isRunning().

Return values:
0.0 if the component is non-periodic (event based).
a negative number when the component is not executable.
a positive value when the component is periodic. The period is expressed in seconds.
Todo:
: add a bool setPeriod(double) function to allow changing the period at run-time.

Definition at line 269 of file TaskCore.cpp.

virtual TaskState RTT::base::TaskCore::getTargetState (  )  const [virtual]

Returns the state this TaskCore is going to, or in case no transition is taking place, returns getTaskState(). For example, before start(), this function returns Stopped. During startHook(), it returns Running and after start() it also returns Running.

If getTaskState() != getTargetState, a transition is taking place.

See also:
getTaskState()
TaskCore::TaskState RTT::TaskCore::getTargetState (  )  const [virtual]

Returns the state this TaskCore is going to, or in case no transition is taking place, returns getTaskState(). For example, before start(), this function returns Stopped. During startHook(), it returns Running and after start() it also returns Running.

If getTaskState() != getTargetState, a transition is taking place.

See also:
getTaskState()

Definition at line 82 of file TaskCore.cpp.

virtual TaskState RTT::base::TaskCore::getTaskState (  )  const [virtual]

Returns the current state of the TaskCore. For example, before start(), this function returns Stopped. During startHook() it returns Stopped, and after start() it returns Running.

See also:
getTargetState()

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

TaskCore::TaskState RTT::TaskCore::getTaskState (  )  const [virtual]

Returns the current state of the TaskCore. For example, before start(), this function returns Stopped. During startHook() it returns Stopped, and after start() it returns Running.

See also:
getTargetState()

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 78 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::inException (  )  const [virtual]

Inspect if the component is in the Exception state.

bool RTT::TaskCore::inException (  )  const [virtual]

Inspect if the component is in the Exception state.

Definition at line 256 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::inFatalError (  )  const [virtual]

Inspect if the component is in the FatalError state. There is no possibility to recover from this state. You need to destroy and recreate your component.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::inFatalError (  )  const [virtual]

Inspect if the component is in the FatalError state. There is no possibility to recover from this state. You need to destroy and recreate your component.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 252 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::inRunTimeError (  )  const [virtual]

Inspect if the component is in the RunTimeError state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::inRunTimeError (  )  const [virtual]

Inspect if the component is in the RunTimeError state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 260 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::isActive (  )  const [virtual]

Inspect if the component's ExecutionEngine is processing requests. Normally this is always the case, but user code could stop the ExecutionEngine manually.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::isActive (  )  const [virtual]

Inspect if the component's ExecutionEngine is processing requests. Normally this is always the case, but user code could stop the ExecutionEngine manually.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 264 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::isConfigured (  )  const [virtual]

Inspect if the component is configured, i.e. in the Stopped, Active or Running state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::isConfigured (  )  const [virtual]

Inspect if the component is configured, i.e. in the Stopped, Active or Running state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 248 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::isRunning (  )  const [virtual]

Inspect if the component is in the Running or RunTimeError state. As RunTimeError is a substate of Running, this method also returns true when the component is in one of these states. See inRunTimeError() or testing the run-time error state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::isRunning (  )  const [virtual]

Inspect if the component is in the Running or RunTimeError state. As RunTimeError is a substate of Running, this method also returns true when the component is in one of these states. See inRunTimeError() or testing the run-time error state.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 244 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::prepareUpdateHook (  )  [private, virtual]

This is how the EE informs the TaskContext that it is about to run updateHook. This function might be replaced by another mechanism in the future and currently serves to handle event ports callbacks.

Reimplemented in RTT::TaskContext, and RTT::TaskContext.

void RTT::TaskCore::prepareUpdateHook (  )  [private, virtual]

This is how the EE informs the TaskContext that it is about to run updateHook. This function might be replaced by another mechanism in the future and currently serves to handle event ports callbacks.

Reimplemented in RTT::TaskContext, and RTT::TaskContext.

Definition at line 301 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::recover (  )  [virtual]

Call this method in a RunTimeError or Exception state to indicate that the run-time error conditions are gone and nominal operation is resumed. Makes transition to Running or PreOperational, depending on the state it was in.

Returns:
false if not applicable in the current state.
bool RTT::TaskCore::recover (  )  [virtual]

Call this method in a RunTimeError or Exception state to indicate that the run-time error conditions are gone and nominal operation is resumed. Makes transition to Running or PreOperational, depending on the state it was in.

Returns:
false if not applicable in the current state.

Definition at line 177 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::setCpuAffinity ( unsigned  cpu  )  [virtual]

Sets the cpu affinity of this component.

Returns:
false if not allowed by the component's activity.
See also:
ActivityInterface::setCpuAffinity()
bool RTT::TaskCore::setCpuAffinity ( unsigned  cpu  )  [virtual]

Sets the cpu affinity of this component.

Returns:
false if not allowed by the component's activity.
See also:
ActivityInterface::setCpuAffinity()

Definition at line 284 of file TaskCore.cpp.

void RTT::base::TaskCore::setExecutionEngine ( ExecutionEngine engine  ) 

Use this method to re-set the execution engine of this task core.

Parameters:
engine The new execution engine which will execute this TaskCore or null if a new execution engine must be created (the old is deleted in that case).
Postcondition:
The TaskCore is being run by engine or a new execution engine.
void RTT::TaskCore::setExecutionEngine ( ExecutionEngine engine  ) 

Use this method to re-set the execution engine of this task core.

Parameters:
engine The new execution engine which will execute this TaskCore or null if a new execution engine must be created (the old is deleted in that case).
Postcondition:
The TaskCore is being run by engine or a new execution engine.

Definition at line 320 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::setPeriod ( Seconds  s  )  [virtual]

Sets the period of this component. You may call this at any time, it is simply forwarded to the component's activity object.

Returns:
false if not allowed by the component's activity.
See also:
ActivityInterface::setPeriod()
bool RTT::TaskCore::setPeriod ( Seconds  s  )  [virtual]

Sets the period of this component. You may call this at any time, it is simply forwarded to the component's activity object.

Returns:
false if not allowed by the component's activity.
See also:
ActivityInterface::setPeriod()

Definition at line 274 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::start (  )  [virtual]

This method starts the execution of the updateHook() with each trigger or period. This function calls the user function startHook(), which must return true in order to allow this component to run.

Return values:
false 
  • if startHook() returned false
  • if the component was not Stopped
true if the Running state was entered.

Reimplemented in RTT::TaskContext, RTT::corba::TaskContextProxy, RTT::TaskContext, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::start (  )  [virtual]

This method starts the execution of the updateHook() with each trigger or period. This function calls the user function startHook(), which must return true in order to allow this component to run.

Return values:
false 
  • if startHook() returned false
  • if the component was not Stopped
true if the Running state was entered.

Reimplemented in RTT::TaskContext, RTT::corba::TaskContextProxy, RTT::TaskContext, and RTT::corba::TaskContextProxy.

Definition at line 189 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::startHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when start() is called. The default implementation is an empty function which returns true.

Return values:
true to indicate that the component may run and the Running state may be entered.
false to indicate that the component may not run and the Stopped state is entered.

Reimplemented in StatesTC.

bool RTT::TaskCore::startHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when start() is called. The default implementation is an empty function which returns true.

Return values:
true to indicate that the component may run and the Running state may be entered.
false to indicate that the component may not run and the Stopped state is entered.

Reimplemented in StatesTC.

Definition at line 293 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::stop (  )  [virtual]

This method stops the execution of updateHook() of this component. You can override this method to do something else or in addition. This function calls stopHook() as well.

Returns:
false if the component was not Running or not Active.

Reimplemented in RTT::TaskContext, RTT::corba::TaskContextProxy, RTT::TaskContext, and RTT::corba::TaskContextProxy.

bool RTT::TaskCore::stop (  )  [virtual]

This method stops the execution of updateHook() of this component. You can override this method to do something else or in addition. This function calls stopHook() as well.

Returns:
false if the component was not Running or not Active.

Reimplemented in RTT::TaskContext, RTT::corba::TaskContextProxy, RTT::TaskContext, and RTT::corba::TaskContextProxy.

Definition at line 211 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::stopHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when stop() is called. The default implementation is an empty function.

Reimplemented in StatesTC.

void RTT::TaskCore::stopHook (  )  [protected, virtual]

Implement this method such that it contains the code which will be executed when stop() is called. The default implementation is an empty function.

Reimplemented in StatesTC.

Definition at line 316 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::trigger (  )  [virtual]

Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method.

Return values:
false if this->engine()->getActivity()->trigger() == false
true otherwise.
bool RTT::TaskCore::trigger (  )  [virtual]

Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method.

Return values:
false if this->engine()->getActivity()->trigger() == false
true otherwise.

Definition at line 93 of file TaskCore.cpp.

virtual bool RTT::base::TaskCore::update (  )  [virtual]

Invoke this method to execute the ExecutionEngine and the update() method.

Return values:
false if this->engine()->getActivity()->execute() == false
true otherwise.
bool RTT::TaskCore::update (  )  [virtual]

Invoke this method to execute the ExecutionEngine and the update() method.

Return values:
false if this->engine()->getActivity()->execute() == false
true otherwise.

Definition at line 86 of file TaskCore.cpp.

virtual void RTT::base::TaskCore::updateHook (  )  [protected, virtual]

Function where the user must insert his 'application' code. When the ExecutionEngine's Activity is a periodic, this function is called by the ExecutionEngine in each periodic step after all messages are processed. When it is executed by a non periodic activity, this function is called after a message is received and executed. It should not loop forever, since no commands or events are processed when this function executes. The default implementation is an empty function.

Reimplemented in TheServer, TheServer, EventPortsTC, and StatesTC.

void RTT::TaskCore::updateHook (  )  [protected, virtual]

Function where the user must insert his 'application' code. When the ExecutionEngine's Activity is a periodic, this function is called by the ExecutionEngine in each periodic step after all messages are processed. When it is executed by a non periodic activity, this function is called after a message is received and executed. It should not loop forever, since no commands or events are processed when this function executes. The default implementation is an empty function.

Reimplemented in TheServer, TheServer, EventPortsTC, and StatesTC.

Definition at line 304 of file TaskCore.cpp.


Friends And Related Function Documentation

friend class ::RTT::ExecutionEngine [friend]

Definition at line 439 of file install/include/rtt/base/TaskCore.hpp.

TaskContext [friend]

Definition at line 463 of file install/include/rtt/base/TaskCore.hpp.


Member Data Documentation

The execution engine which calls update() and processes our commands, events etc.

Definition at line 445 of file install/include/rtt/base/TaskCore.hpp.

Store the component's initial state here so that we can transition to it when recovering from Exception

Definition at line 454 of file install/include/rtt/base/TaskCore.hpp.

We need this to be able to detect transitions from mTaskState to mTargetState.

Definition at line 459 of file install/include/rtt/base/TaskCore.hpp.

Definition at line 447 of file install/include/rtt/base/TaskCore.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


rtt
Author(s): RTT Developers
autogenerated on Fri Jan 11 09:49:53 2013