Orocos Real-Time Toolkit  2.8.3
Classes | Public Member Functions | Protected Attributes | List of all members
RTT::scripting::ProgramInterface Class Referenceabstract

A Program represents a collection of instructions that can be stepwise executed. More...

#include <rtt/scripting/ProgramInterface.hpp>

Inheritance diagram for RTT::scripting::ProgramInterface:
RTT::base::ExecutableInterface RTT::scripting::FunctionGraph

Classes

struct  Status
 Placeholder of the ProgramStatus. More...
 

Public Member Functions

 ProgramInterface ()
 
virtual ~ProgramInterface ()
 
virtual bool start ()=0
 Start the execution of this program. More...
 
virtual bool pause ()=0
 Pause or start-and-pause the execution of this program. More...
 
virtual bool step ()=0
 Execute a single action when paused. More...
 
virtual bool stop ()=0
 Stop the execution of this program. More...
 
virtual bool execute ()=0
 Execute as much actions until the program needs to wait on a condition to become true. More...
 
virtual void reset ()=0
 Reset the execution point to the beginning of this program interface. More...
 
bool isRunning () const
 Returns true if the program is running. More...
 
bool isPaused () const
 Returns true if the program is paused. More...
 
bool isStopped () const
 Returns true if the program is not executing (stopped) or not loaded. More...
 
bool inError () const
 Returns true if the program is in error. More...
 
virtual bool stepDone () const =0
 
virtual int getLineNumber () const =0
 Return the current 'line number' of the program. More...
 
Status::ProgramStatus getStatus () const
 Return the current status of the program. More...
 
virtual std::string getText () const =0
 Return the program text to which getLineNumber() refers. More...
 
virtual const std::string & getName () const =0
 Programs can be refered to by name. More...
 
virtual std::vector< base::AttributeBase * > getArguments () const =0
 Get the argument list of this program. More...
 
virtual base::AttributeBasegetResult () const =0
 Get the return value of this program. More...
 
virtual ProgramInterfacecopy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacementdss) const =0
 Clone this Program. More...
 
virtual ProgramInterfaceclone () const =0
 
virtual bool needsStart () const =0
 Returns true if a start() is necessary after this function is loaded with ExecutionEngine::runFunction(). More...
 
void loaded (ExecutionEngine *ee)
 Called by the ExecutionEngine ee to tell this object it is being loaded. More...
 
void unloaded ()
 Called by the ExecutionEngine ee to tell this object it is being unloaded. More...
 
virtual void loading ()
 Informs this object that it got loaded in an ExecutionEngine. More...
 
bool isLoaded ()
 Returns true if this object is loaded in an ExecutionEngine. More...
 
ExecutionEnginegetEngine ()
 Returns the ExecutionEngine this object is loaded into or null otherwise. More...
 
virtual void unloading ()
 Informs this object that it got unloaded from an ExecutionEngine. More...
 

Protected Attributes

Status::ProgramStatus pStatus
 
ExecutionEngineengine
 

Detailed Description

A Program represents a collection of instructions that can be stepwise executed.

Definition at line 60 of file ProgramInterface.hpp.

Constructor & Destructor Documentation

RTT::ProgramInterface::ProgramInterface ( )

Definition at line 46 of file ProgramInterface.cpp.

RTT::ProgramInterface::~ProgramInterface ( )
virtual

Definition at line 48 of file ProgramInterface.cpp.

Member Function Documentation

virtual ProgramInterface* RTT::scripting::ProgramInterface::clone ( ) const
pure virtual
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.

Parameters
alreadyMappedDataA 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.

Returns
false if a program error occured.

Implements RTT::base::ExecutableInterface.

Implemented in RTT::scripting::FunctionGraph.

Referenced by RTT::scripting::StateMachine::executeProgram(), and RTT::scripting::StateMachine::pause().

virtual std::vector<base::AttributeBase*> RTT::scripting::ProgramInterface::getArguments ( ) const
pure virtual

Get the argument list of this program.

Implemented in RTT::scripting::FunctionGraph.

ExecutionEngine* RTT::base::ExecutableInterface::getEngine ( )
inlineinherited
virtual int RTT::scripting::ProgramInterface::getLineNumber ( ) const
pure virtual

Return the current 'line number' of the program.

Implemented in RTT::scripting::FunctionGraph.

Referenced by RTT::scripting::StateMachine::getLineNumber().

virtual const std::string& RTT::scripting::ProgramInterface::getName ( ) const
pure virtual

Programs can be refered to by name.

Implemented in RTT::scripting::FunctionGraph.

virtual base::AttributeBase* RTT::scripting::ProgramInterface::getResult ( ) const
pure virtual

Get the return value of this program.

Implemented in RTT::scripting::FunctionGraph.

Status::ProgramStatus RTT::scripting::ProgramInterface::getStatus ( ) const
inline

Return the current status of the program.

Definition at line 149 of file ProgramInterface.hpp.

virtual std::string RTT::scripting::ProgramInterface::getText ( ) const
pure virtual

Return the program text to which getLineNumber() refers.

Implemented in RTT::scripting::FunctionGraph.

bool RTT::scripting::ProgramInterface::inError ( ) const
inline
bool RTT::base::ExecutableInterface::isLoaded ( )
inlineinherited
bool RTT::scripting::ProgramInterface::isPaused ( ) const
inline

Returns true if the program is paused.

Definition at line 127 of file ProgramInterface.hpp.

Referenced by RTT::scripting::ProgramService::ProgramService().

bool RTT::scripting::ProgramInterface::isRunning ( ) const
inline

Returns true if the program is running.

Definition at line 122 of file ProgramInterface.hpp.

Referenced by RTT::scripting::ProgramService::ProgramService().

bool RTT::scripting::ProgramInterface::isStopped ( ) const
inline

Returns true if the program is not executing (stopped) or not loaded.

Definition at line 132 of file ProgramInterface.hpp.

Referenced by RTT::scripting::StateMachine::executeProgram().

void RTT::base::ExecutableInterface::loaded ( ExecutionEngine ee)
inlineinherited

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.

Parameters
eeThe pointer to the engine calling us.

Definition at line 70 of file ExecutableInterface.hpp.

Referenced by RTT::scripting::StateInterface::loaded(), and RTT::ExecutionEngine::runFunction().

virtual void RTT::base::ExecutableInterface::loading ( )
inlinevirtualinherited

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.

virtual bool RTT::scripting::ProgramInterface::needsStart ( ) const
pure virtual

Returns true if a start() is necessary after this function is loaded with ExecutionEngine::runFunction().

Implemented in RTT::scripting::FunctionGraph.

virtual bool RTT::scripting::ProgramInterface::pause ( )
pure virtual

Pause or start-and-pause the execution of this program.

Implemented in RTT::scripting::FunctionGraph.

Referenced by RTT::scripting::StateMachine::pause(), and RTT::scripting::ProgramService::ProgramService().

virtual void RTT::scripting::ProgramInterface::reset ( )
pure virtual
virtual bool RTT::scripting::ProgramInterface::start ( )
pure virtual
virtual bool RTT::scripting::ProgramInterface::step ( )
pure virtual
virtual bool RTT::scripting::ProgramInterface::stepDone ( ) const
pure virtual
virtual bool RTT::scripting::ProgramInterface::stop ( )
pure virtual

Stop the execution of this program.

Implemented in RTT::scripting::FunctionGraph.

Referenced by RTT::scripting::ProgramService::ProgramService().

void RTT::base::ExecutableInterface::unloaded ( )
inlineinherited

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::processFunctions(), RTT::ExecutionEngine::removeFunction(), and RTT::ExecutionEngine::~ExecutionEngine().

virtual void RTT::base::ExecutableInterface::unloading ( )
inlinevirtualinherited

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.

Member Data Documentation

ExecutionEngine* RTT::base::ExecutableInterface::engine
protectedinherited

Definition at line 61 of file ExecutableInterface.hpp.

Status::ProgramStatus RTT::scripting::ProgramInterface::pStatus
protected

The documentation for this class was generated from the following files: