Orocos Real-Time Toolkit
2.5.0
|
A Program represents a collection of instructions that can be stepwise executed. More...
#include <rtt/scripting/ProgramInterface.hpp>
Classes | |
struct | Status |
Placeholder of the ProgramStatus. More... | |
Public Member Functions | |
virtual bool | start ()=0 |
Start the execution of this program. | |
virtual bool | pause ()=0 |
Pause or start-and-pause the execution of this program. | |
virtual bool | step ()=0 |
Execute a single action when paused. | |
virtual bool | stop ()=0 |
Stop the execution of this program. | |
virtual bool | execute ()=0 |
Execute as much actions until the program needs to wait on a condition to become true. | |
virtual void | reset ()=0 |
Reset the execution point to the beginning of this program interface. | |
bool | isRunning () const |
Returns true if the program is running. | |
bool | isPaused () const |
Returns true if the program is paused. | |
bool | isStopped () const |
Returns true if the program is not executing (stopped) or not loaded. | |
bool | inError () const |
Returns true if the program is in error. | |
virtual bool | stepDone () const =0 |
virtual int | getLineNumber () const =0 |
Return the current 'line number' of the program. | |
Status::ProgramStatus | getStatus () const |
Return the current status of the program. | |
virtual std::string | getText () const =0 |
Return the program text to which getLineNumber() refers. | |
virtual const std::string & | getName () const =0 |
Programs can be refered to by name. | |
virtual std::vector < base::AttributeBase * > | getArguments () const =0 |
Get the argument list of this program. | |
virtual base::AttributeBase * | getResult () const =0 |
Get the return value of this program. | |
virtual ProgramInterface * | copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacementdss) const =0 |
Clone this Program. | |
virtual ProgramInterface * | clone () const =0 |
virtual bool | needsStart () const =0 |
Returns true if a start() is necessary after this function is loaded with ExecutionEngine::runFunction(). | |
void | loaded (ExecutionEngine *ee) |
Called by the ExecutionEngine ee to tell this object it is being loaded. | |
void | unloaded () |
Called by the ExecutionEngine ee to tell this object it is being unloaded. | |
virtual void | loading () |
Informs this object that it got loaded in an ExecutionEngine. | |
bool | isLoaded () |
Returns true if this object is loaded in an ExecutionEngine. | |
ExecutionEngine * | getEngine () |
Returns the ExecutionEngine this object is loaded into or null otherwise. | |
virtual void | unloading () |
Informs this object that it got unloaded from an ExecutionEngine. | |
Protected Attributes | |
Status::ProgramStatus | pStatus |
ExecutionEngine * | engine |
A Program represents a collection of instructions that can be stepwise executed.
Definition at line 60 of file ProgramInterface.hpp.
virtual ProgramInterface* RTT::scripting::ProgramInterface::copy | ( | std::map< const base::DataSourceBase *, base::DataSourceBase * > & | replacementdss | ) | const [pure virtual] |
Clone this Program.
This will produce a completely new instance, that has nothing in common with this one. It takes care to properly map identical DataSources to identical DataSources.
alreadyMappedData | A map of some DataSources used in this program to new DataSources that should replace them in the new Program. This is provided, because in some cases the outside world also keeps references to datasources used somewhere in this programgraph. It is then important that when this Program is copied, the outside world has a way to get a reference to the corresponding datasources in the new program. We do this by allowing it to map some datasources itself, and simply provide us a list of its mappings. |
Implemented in RTT::scripting::FunctionGraph.
virtual bool RTT::scripting::ProgramInterface::execute | ( | ) | [pure virtual] |
Execute as much actions until the program needs to wait on a condition to become true.
When paused, only execute one action.
Implements RTT::base::ExecutableInterface.
Implemented in RTT::scripting::FunctionGraph.
Referenced by RTT::scripting::StateMachine::pause().
ExecutionEngine* RTT::base::ExecutableInterface::getEngine | ( | ) | [inline, inherited] |
Returns the ExecutionEngine this object is loaded into or null otherwise.
Definition at line 102 of file ExecutableInterface.hpp.
Referenced by RTT::scripting::StateMachine::loading(), and RTT::scripting::StateMachine::~StateMachine().
bool RTT::base::ExecutableInterface::isLoaded | ( | ) | [inline, inherited] |
Returns true if this object is loaded in an ExecutionEngine.
Definition at line 95 of file ExecutableInterface.hpp.
Referenced by RTT::scripting::FunctionGraph::pause(), RTT::ExecutionEngine::removeFunction(), RTT::scripting::FunctionGraph::start(), RTT::scripting::FunctionGraph::step(), and RTT::scripting::StateMachine::~StateMachine().
void RTT::base::ExecutableInterface::loaded | ( | ExecutionEngine * | ee | ) | [inline, inherited] |
Called by the ExecutionEngine ee to tell this object it is being loaded.
The engine pointer is set first and the user's loading() function is called next.
ee | The pointer to the engine calling us. |
Definition at line 70 of file ExecutableInterface.hpp.
Referenced by RTT::ExecutionEngine::runFunction().
virtual void RTT::base::ExecutableInterface::loading | ( | ) | [inline, virtual, inherited] |
Informs this object that it got loaded in an ExecutionEngine.
Called by load() after the engine pointer is set.
Reimplemented in RTT::scripting::StateMachine, and RTT::scripting::FunctionGraph.
Definition at line 89 of file ExecutableInterface.hpp.
void RTT::base::ExecutableInterface::unloaded | ( | ) | [inline, inherited] |
Called by the ExecutionEngine ee to tell this object it is being unloaded.
The user's loading() function is called first and the engine pointer is cleared next.
Definition at line 78 of file ExecutableInterface.hpp.
Referenced by RTT::ExecutionEngine::removeFunction().
virtual void RTT::base::ExecutableInterface::unloading | ( | ) | [inline, virtual, inherited] |
Informs this object that it got unloaded from an ExecutionEngine.
Called by unload() before the engine pointer is cleared.
Reimplemented in RTT::scripting::StateMachine, RTT::scripting::FunctionGraph, and RTT::scripting::ParsedStateMachine.
Definition at line 118 of file ExecutableInterface.hpp.