#include </home/sspr/src/www/orocos-1.0/export/build/orocos-rtt-1.2.2/build/rtt/TaskCore.hpp>
Inheritance diagram for TaskCore:

It has a name and an ExecutionEngine to process events,commands, programs, statemachines and run a user function. It is useful for in embedded systems, where communication between tasks may be hard coded and hence, no interface browsing or task browsing is required (for every task).
Public Types | |
| enum | TaskState { Init, PreOperational, Stopped, Running } |
| Describes the different states a component can have. More... | |
Public Member Functions | |
| TaskCore (const std::string &name, TaskState initial_state=Stopped) | |
| Create a TaskCore. | |
| TaskCore (const std::string &name, ExecutionEngine *parent, TaskState initial_state=Stopped) | |
| Create a TaskCore. | |
| TaskState | getTaskState () const |
| Returns the current state of the TaskContext. | |
| virtual bool | configureHook () |
| Implement this method such that it contains the code which will be executed when configure() is called. | |
| virtual void | cleanupHook () |
| Implement this method such that it contains the code which will be executed when cleanup() is called. | |
| virtual bool | startHook () |
| Implement this method such that it contains the code which will be executed when start() is called. | |
| virtual bool | startup () |
| Function where the user must insert his 'startup' code. | |
| virtual void | updateHook () |
| Function where the user must insert his 'application' code. | |
| virtual void | update () |
| Function where the user must insert his 'application' code. | |
| virtual void | stopHook () |
| Implement this method such that it contains the code which will be executed when stop() is called. | |
| virtual void | shutdown () |
| Function where the user must insert his 'shutdown' code. | |
| const std::string & | getName () const |
| Get the name of this TaskCore. | |
| void | setName (const std::string &n) |
| Change the name of this TaskCore. | |
| void | setExecutionEngine (ExecutionEngine *engine) |
| Use this method to re-set the execution engine of this task core. | |
| const ExecutionEngine * | engine () const |
| Get a const pointer to the ExecutionEngine of this Task. | |
| ExecutionEngine * | engine () |
| Get a pointer to the ExecutionEngine of this Task. | |
Script Methods | |
These TaskCore functions are exported in a TaskContext as script methods and are for configuration, starting and stopping its ExecutionEngine. | |
| virtual bool | configure () |
| This method instructs the component to (re-)read configuration data and try to enter the Stopped state. | |
| virtual bool | start () |
| This method starts the execution engine of this component. | |
| virtual bool | stop () |
| This method stops the execution engine of this component. | |
| virtual bool | cleanup () |
| This method instructs a stopped component to enter the pre-operational state again. | |
| virtual bool | isRunning () const |
| Inspect if the component is in the Running state. | |
| virtual bool | isConfigured () const |
| Inspect if the component is configured, i.e. | |
| virtual bool | doUpdate () |
| Invoke this method to execute the ExecutionEngine and the update() method. | |
| virtual bool | doTrigger () |
| Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method. | |
Protected Attributes | |
| std::string | mtask_name |
| ExecutionEngine * | ee |
| The execution engine which calls update() and processes our commands, events etc. | |
| TaskState | mTaskState |
Friends | |
| class | ExecutionEngine |
| enum TaskState |
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.
In order to check if these transitions are allowed, hook functions are executed, which can be filled in by the component builder.
Create a TaskCore.
It's ExecutionEngine will be newly constructed with private processing of commands, events, programs and state machines.
| name | The name of this component. | |
| initial_state | Provide the PreOperational parameter flag here to force users in calling configure(), before they call start(). |
| TaskCore | ( | const std::string & | name, | |
| 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).
| name | The name of this component. | |
| initial_state | Provide the PreOperational parameter flag here to force users in calling configure(), before they call start(). |
| virtual bool 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 ControlTaskProxy.
| virtual bool start | ( | ) | [virtual] |
This method starts the execution engine of this component.
This function calls startHook(), which must return true in order to allow this component to run. You can override this method to do something else or in addition to starting the ExecutionEngine.
Reimplemented in ControlTaskProxy.
| virtual bool stop | ( | ) | [virtual] |
This method stops the execution engine of this component.
You can override this method to do something else or in addition to stopping the engine. This function calls cleanupHook() as well.
Reimplemented in ControlTaskProxy.
| virtual bool cleanup | ( | ) | [virtual] |
This method instructs a stopped component to enter the pre-operational state again.
It calls cleanupHook().
Reimplemented in ControlTaskProxy.
| virtual bool isConfigured | ( | ) | const [virtual] |
Inspect if the component is configured, i.e.
in the Stopped or Running state.
Reimplemented in ControlTaskProxy.
| virtual bool doUpdate | ( | ) | [virtual] |
Invoke this method to execute the ExecutionEngine and the update() method.
This method maps to the 'update()' method in the scripting language.
| false | if this->engine()->getActivity()->execute() == false | |
| true | otherwise. |
| virtual bool doTrigger | ( | ) | [virtual] |
Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method.
This method maps to the 'trigger()' method in the scripting language.
| false | if this->engine()->getActivity()->trigger() == false | |
| true | otherwise. |
| virtual bool configureHook | ( | ) | [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.
| 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. |
| virtual void cleanupHook | ( | ) | [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.
| virtual bool startHook | ( | ) | [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.
| 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. |
| virtual bool startup | ( | ) | [virtual] |
Function where the user must insert his 'startup' code.
This function is called by the ExecutionEngine before it starts its processors. If it returns false, the startup of the TaskCore is aborted. The default implementation is an empty function which returns true.
| virtual void updateHook | ( | ) | [virtual] |
Function where the user must insert his 'application' code.
When the ExecutionEngine's Activity is a PeriodicActivity, this function is called by the ExecutionEngine in each periodic step after all command, event,... are processed. When it is executed by a NonPeriodicActivity, this function is called after an Event or Command 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.
| virtual void update | ( | ) | [virtual] |
Function where the user must insert his 'application' code.
When the ExecutionEngine's Activity is a PeriodicActivity, this function is called by the ExecutionEngine in each periodic step after all command, event,... processors. When it's Task is a NonPeriodicActivity, this function is called after an Event or Command 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.
| virtual void stopHook | ( | ) | [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.
| virtual void shutdown | ( | ) | [virtual] |
Function where the user must insert his 'shutdown' code.
This function is called by the ExecutionEngine after it stops its processors. The default implementation is an empty function.
| void setExecutionEngine | ( | ExecutionEngine * | engine | ) |
Use this method to re-set the execution engine of this task core.
| 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). |
1.5.1