Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
RTT::scripting::FunctionGraph Class Reference

#include <FunctionGraph.hpp>

Inheritance diagram for RTT::scripting::FunctionGraph:
Inheritance graph
[legend]

Public Types

typedef boost::graph_traits< Graph >::edge_descriptor Edge
 
typedef EdgeCondition::EdgeProperty EdgeProperty
 
typedef boost::adjacency_list< boost::vecS, boost::listS, boost::directedS, VertProperty, EdgePropertyGraph
 
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex
 
typedef VertexNode::VertProperty VertProperty
 

Public Member Functions

void addArgument (base::AttributeBase *a)
 
void clearArguments ()
 
virtual FunctionGraphclone () const
 
virtual FunctionGraphcopy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacementdss) const
 
Vertex currentNode () const
 
void debugPrintout () const
 
virtual bool execute ()
 
Vertex exitNode () const
 
void finish ()
 
 FunctionGraph (const std::string &name, bool unload_on_stop)
 
 FunctionGraph (const FunctionGraph &orig)
 
std::vector< base::AttributeBase * > getArguments () const
 
const GraphgetGraph () const
 
GraphgetGraph ()
 
virtual int getLineNumber () const
 
virtual const std::string & getName () const
 
base::AttributeBasegetResult () const
 
std::string getText () const
 
virtual void loading ()
 
virtual bool needsStart () const
 
virtual bool pause ()
 
Vertex previousNode () const
 
virtual void reset ()
 
void setName (const std::string &_name)
 
void setProgramService (ServicePtr myservice)
 
void setResult (base::AttributeBase *r)
 
void setText (const std::string &t)
 
void setUnloadOnStop (bool unload_on_stop)
 
virtual bool start ()
 
Vertex startNode () const
 
virtual bool step ()
 
virtual bool stepDone () const
 
virtual bool stop ()
 
virtual void unloading ()
 
 ~FunctionGraph ()
 
- Public Member Functions inherited from RTT::scripting::ProgramInterface
Status::ProgramStatus getStatus () const
 
bool inError () const
 
bool isPaused () const
 
bool isRunning () const
 
bool isStopped () const
 
 ProgramInterface ()
 
virtual ~ProgramInterface ()
 
- Public Member Functions inherited from RTT::base::ExecutableInterface
 ExecutableInterface ()
 
ExecutionEnginegetEngine ()
 
bool isLoaded ()
 
void loaded (ExecutionEngine *ee)
 
void unloaded ()
 
virtual ~ExecutableInterface ()
 

Protected Member Functions

bool executeStep ()
 
bool executeUntil ()
 

Protected Attributes

std::string _text
 
std::vector< base::AttributeBase * > args
 
ServicePtr context
 
Vertex exitv
 
bool mstep
 
bool munload_on_stop
 
std::string myName
 
bool pausing
 
Graph program
 
base::AttributeBaseretn
 
Vertex startv
 
- Protected Attributes inherited from RTT::scripting::ProgramInterface
Status::ProgramStatus pStatus
 
- Protected Attributes inherited from RTT::base::ExecutableInterface
ExecutionEngineengine
 

Private Attributes

Vertex current
 
Vertex previous
 

Detailed Description

This class represents a function. It has much in common with a program but is only used for storing a Graph.

Definition at line 59 of file FunctionGraph.hpp.

Member Typedef Documentation

typedef boost::graph_traits<Graph>::edge_descriptor RTT::scripting::FunctionGraph::Edge

Definition at line 72 of file FunctionGraph.hpp.

Definition at line 63 of file FunctionGraph.hpp.

typedef boost::adjacency_list<boost::vecS, boost::listS, boost::directedS, VertProperty, EdgeProperty> RTT::scripting::FunctionGraph::Graph

Definition at line 70 of file FunctionGraph.hpp.

typedef boost::graph_traits<Graph>::vertex_descriptor RTT::scripting::FunctionGraph::Vertex

Definition at line 71 of file FunctionGraph.hpp.

Definition at line 64 of file FunctionGraph.hpp.

Constructor & Destructor Documentation

RTT::FunctionGraph::FunctionGraph ( const std::string &  name,
bool  unload_on_stop 
)

Create a FunctionGraph with a given name.

Parameters
nameThe name of this script.
unload_on_stopSet to true to force an unload when the script stops or an error is encountered. The unload is forced by returning false in execute(), as defined in the ExecutableInterface. This flag should only be set to true for scripts that don't have a service associated (see setProgramService() ), since the service is destroyed when the function is unloaded. You can override this behavior after construction by using setUnloadOnStop().

Definition at line 59 of file FunctionGraph.cpp.

RTT::FunctionGraph::FunctionGraph ( const FunctionGraph orig)

Copy a FunctionGraph.

Definition at line 69 of file FunctionGraph.cpp.

RTT::FunctionGraph::~FunctionGraph ( )

Definition at line 114 of file FunctionGraph.cpp.

Member Function Documentation

void RTT::scripting::FunctionGraph::addArgument ( base::AttributeBase a)
inline

Definition at line 248 of file FunctionGraph.hpp.

void RTT::FunctionGraph::clearArguments ( )

Clear the arguments vector and release all base::AttributeBase resources.

Definition at line 459 of file FunctionGraph.cpp.

FunctionGraph * RTT::FunctionGraph::clone ( ) const
virtual

Implements RTT::scripting::ProgramInterface.

Definition at line 432 of file FunctionGraph.cpp.

FunctionGraph * RTT::FunctionGraph::copy ( std::map< const base::DataSourceBase *, base::DataSourceBase * > &  replacementdss) const
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.

Implements RTT::scripting::ProgramInterface.

Definition at line 383 of file FunctionGraph.cpp.

Vertex RTT::scripting::FunctionGraph::currentNode ( ) const
inline

Definition at line 212 of file FunctionGraph.hpp.

void RTT::FunctionGraph::debugPrintout ( ) const

Definition at line 437 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::execute ( )
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::scripting::ProgramInterface.

Definition at line 199 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::executeStep ( )
protected

Definition at line 290 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::executeUntil ( )
protected

Definition at line 228 of file FunctionGraph.cpp.

Vertex RTT::scripting::FunctionGraph::exitNode ( ) const
inline

Definition at line 222 of file FunctionGraph.hpp.

void RTT::FunctionGraph::finish ( )

To be called after a function is constructed.

Definition at line 94 of file FunctionGraph.cpp.

std::vector<base::AttributeBase*> RTT::scripting::FunctionGraph::getArguments ( ) const
inlinevirtual

Return an ordered list of this funcion's arguments.

Implements RTT::scripting::ProgramInterface.

Definition at line 240 of file FunctionGraph.hpp.

const Graph& RTT::scripting::FunctionGraph::getGraph ( ) const
inline

Definition at line 227 of file FunctionGraph.hpp.

Graph& RTT::scripting::FunctionGraph::getGraph ( )
inline

Definition at line 232 of file FunctionGraph.hpp.

int RTT::FunctionGraph::getLineNumber ( ) const
virtual

Return the current 'line number' of the program.

Implements RTT::scripting::ProgramInterface.

Definition at line 378 of file FunctionGraph.cpp.

const std::string & RTT::FunctionGraph::getName ( ) const
virtual

Programs can be refered to by name.

Implements RTT::scripting::ProgramInterface.

Definition at line 358 of file FunctionGraph.cpp.

base::AttributeBase* RTT::scripting::FunctionGraph::getResult ( ) const
inlinevirtual

Get the return value of this program.

Implements RTT::scripting::ProgramInterface.

Definition at line 244 of file FunctionGraph.hpp.

std::string RTT::FunctionGraph::getText ( ) const
virtual

Return the program text to which getLineNumber() refers.

Implements RTT::scripting::ProgramInterface.

Definition at line 368 of file FunctionGraph.cpp.

void RTT::FunctionGraph::loading ( )
virtual

Informs this object that it got loaded in an ExecutionEngine. Called by load() after the engine pointer is set.

Reimplemented from RTT::base::ExecutableInterface.

Definition at line 136 of file FunctionGraph.cpp.

virtual bool RTT::scripting::FunctionGraph::needsStart ( ) const
inlinevirtual

Returns true if a start() is necessary when this function is loaded with ExecutionEngine::runFunction(). Functions that unload_on_stop == true don't need to be started since they will start themselves when loaded in the EE.

Implements RTT::scripting::ProgramInterface.

Definition at line 156 of file FunctionGraph.hpp.

bool RTT::FunctionGraph::pause ( )
virtual

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

Implements RTT::scripting::ProgramInterface.

Definition at line 173 of file FunctionGraph.cpp.

Vertex RTT::scripting::FunctionGraph::previousNode ( ) const
inline

Definition at line 217 of file FunctionGraph.hpp.

void RTT::FunctionGraph::reset ( )
virtual

Identical to stop();

Implements RTT::scripting::ProgramInterface.

Definition at line 345 of file FunctionGraph.cpp.

void RTT::FunctionGraph::setName ( const std::string &  _name)

Set the name of this program. Only valid before endProgram() is called.

Definition at line 363 of file FunctionGraph.cpp.

void RTT::FunctionGraph::setProgramService ( ServicePtr  myservice)

Set a service that manages this script. The service will be destroyed when this function is unloaded.

Definition at line 126 of file FunctionGraph.cpp.

void RTT::scripting::FunctionGraph::setResult ( base::AttributeBase r)
inline

Will store the result in this attribute.

Definition at line 255 of file FunctionGraph.hpp.

void RTT::FunctionGraph::setText ( const std::string &  t)

Set the program text.

Definition at line 373 of file FunctionGraph.cpp.

void RTT::FunctionGraph::setUnloadOnStop ( bool  unload_on_stop)

Sets the unloading policy on stop or error.

Parameters
unload_on_stopSee the description of the constructor of this class.

Definition at line 131 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::start ( )
virtual

Start the execution of this program.

Implements RTT::scripting::ProgramInterface.

Definition at line 159 of file FunctionGraph.cpp.

Vertex RTT::scripting::FunctionGraph::startNode ( ) const
inline

Definition at line 207 of file FunctionGraph.hpp.

bool RTT::FunctionGraph::step ( )
virtual

Execute a single action when paused.

Implements RTT::scripting::ProgramInterface.

Definition at line 185 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::stepDone ( ) const
virtual

Implements RTT::scripting::ProgramInterface.

Definition at line 194 of file FunctionGraph.cpp.

bool RTT::FunctionGraph::stop ( )
virtual

Stop the execution of this program.

Implements RTT::scripting::ProgramInterface.

Definition at line 351 of file FunctionGraph.cpp.

void RTT::FunctionGraph::unloading ( )
virtual

Informs this object that it got unloaded from an ExecutionEngine. Called by unload() before the engine pointer is cleared.

Reimplemented from RTT::base::ExecutableInterface.

Definition at line 143 of file FunctionGraph.cpp.

Member Data Documentation

std::string RTT::scripting::FunctionGraph::_text
protected

Program text.

Definition at line 102 of file FunctionGraph.hpp.

std::vector<base::AttributeBase*> RTT::scripting::FunctionGraph::args
protected

Ordered arguments (are also in the repository).

Definition at line 107 of file FunctionGraph.hpp.

ServicePtr RTT::scripting::FunctionGraph::context
protected

Definition at line 118 of file FunctionGraph.hpp.

Vertex RTT::scripting::FunctionGraph::current
private

The node which is executed now

Definition at line 78 of file FunctionGraph.hpp.

Vertex RTT::scripting::FunctionGraph::exitv
protected

Definition at line 92 of file FunctionGraph.hpp.

bool RTT::scripting::FunctionGraph::mstep
protected

Definition at line 112 of file FunctionGraph.hpp.

bool RTT::scripting::FunctionGraph::munload_on_stop
protected

Definition at line 113 of file FunctionGraph.hpp.

std::string RTT::scripting::FunctionGraph::myName
protected

The (unique) name of this program.

Definition at line 97 of file FunctionGraph.hpp.

bool RTT::scripting::FunctionGraph::pausing
protected

Definition at line 111 of file FunctionGraph.hpp.

Vertex RTT::scripting::FunctionGraph::previous
private

The node that was run before this one.

Definition at line 83 of file FunctionGraph.hpp.

Graph RTT::scripting::FunctionGraph::program
protected

The graph containing this function.

Definition at line 89 of file FunctionGraph.hpp.

base::AttributeBase* RTT::scripting::FunctionGraph::retn
protected

Definition at line 109 of file FunctionGraph.hpp.

Vertex RTT::scripting::FunctionGraph::startv
protected

Definition at line 91 of file FunctionGraph.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:47