RTT::scripting::FunctionGraphBuilder Class Reference

This class builds a program consisting of data contained in a program graph tree, based on the Boost Graph Library. More...

#include <FunctionGraphBuilder.hpp>

List of all members.

Public Types

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

Public Member Functions

CommandNode addCommand (ConditionInterface *cond, base::ActionInterface *com)
CommandNode addCommand (ConditionInterface *cond, base::ActionInterface *com)
void addConditionEdge (ConditionInterface *cond, CommandNode vert)
void addConditionEdge (ConditionInterface *cond, CommandNode vert)
CommandNode appendFunction (ConditionInterface *cond, FunctionGraphPtr fn, std::vector< base::DataSourceBase::shared_ptr > fnargs)
CommandNode appendFunction (ConditionInterface *cond, FunctionGraphPtr fn, std::vector< base::DataSourceBase::shared_ptr > fnargs)
bool breakLoop ()
bool breakLoop ()
size_t buildEdges () const
size_t buildEdges () const
CommandNode buildNode () const
CommandNode buildNode () const
void closeConditionEdge (CommandNode vert, ConditionInterface *cond)
void closeConditionEdge (CommandNode vert, ConditionInterface *cond)
void connectToNext (CommandNode v, ConditionInterface *cond)
void connectToNext (CommandNode v, ConditionInterface *cond)
void endElseBlock (int linenumber)
void endElseBlock (int linenumber)
FunctionGraphPtr endFunction (int line=0)
FunctionGraphPtr endFunction (int line=0)
void endIfBlock (int linenumber)
void endIfBlock (int linenumber)
void endWhileBlock (int linenumber)
void endWhileBlock (int linenumber)
 FunctionGraphBuilder ()
 FunctionGraphBuilder ()
base::ActionInterfacegetCommand (CommandNode cn)
base::ActionInterfacegetCommand (CommandNode cn)
FunctionGraphPtr getFunction ()
FunctionGraphPtr getFunction ()
bool inLoop ()
bool inLoop ()
CommandNode moveTo (CommandNode _build, CommandNode _next, int linenr)
CommandNode moveTo (CommandNode _build, CommandNode _next, int linenr)
CommandNode nextNode () const
CommandNode nextNode () const
CommandNode proceedToNext (ConditionInterface *cond, int line_nr=0)
CommandNode proceedToNext (int line_nr=0)
CommandNode proceedToNext (ConditionInterface *cond, int line_nr=0)
CommandNode proceedToNext (int line_nr=0)
void returnFunction (ConditionInterface *cond, int line)
void returnFunction (ConditionInterface *cond, int line)
void setCommand (CommandNode vert, base::ActionInterface *comm)
void setCommand (base::ActionInterface *comm)
void setCommand (CommandNode vert, base::ActionInterface *comm)
void setCommand (base::ActionInterface *comm)
CommandNode setFunction (FunctionGraphPtr fn, std::vector< base::DataSourceBase::shared_ptr > fnargs)
CommandNode setFunction (FunctionGraphPtr fn, std::vector< base::DataSourceBase::shared_ptr > fnargs)
void setLineNumber (int ln)
void setLineNumber (int ln)
void setName (const std::string &_name)
void setName (const std::string &_name)
FunctionGraphPtr startFunction (const std::string &fname)
FunctionGraphPtr startFunction (const std::string &fname)
void startIfStatement (ConditionInterface *cond, int linenumber)
void startIfStatement (ConditionInterface *cond, int linenumber)
void startWhileStatement (ConditionInterface *cond, int linenumber)
void startWhileStatement (ConditionInterface *cond, int linenumber)
 ~FunctionGraphBuilder ()
 ~FunctionGraphBuilder ()

Public Attributes

CommandNode build
CommandNode next

Private Attributes

std::stack< CommandNodebranch_stack
 A stack which keeps track of branch points.
std::stack< CommandNodebreak_stack
FunctionGraphPtr func
Graphgraph

Detailed Description

This class builds a program consisting of data contained in a program graph tree, based on the Boost Graph Library.

Definition at line 50 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.


Member Typedef Documentation

A CommandNode serves as a token to construct a vertex or node, containing a command.

Definition at line 74 of file rtt/scripting/FunctionGraphBuilder.hpp.

A CommandNode serves as a token to construct a vertex or node, containing a command.

Definition at line 56 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

A ConditionEdge serves as a token to construct an edge, containing a condition.

Definition at line 80 of file rtt/scripting/FunctionGraphBuilder.hpp.

A ConditionEdge serves as a token to construct an edge, containing a condition.

Definition at line 62 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

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

Definition at line 68 of file rtt/scripting/FunctionGraphBuilder.hpp.

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

Definition at line 63 of file rtt/scripting/FunctionGraphBuilder.hpp.

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

Definition at line 66 of file rtt/scripting/FunctionGraphBuilder.hpp.

typedef boost::adjacency_list<boost::vecS, boost::listS, boost::directedS, VertProperty, EdgeProperty> RTT::scripting::FunctionGraphBuilder::Graph
typedef boost::graph_traits<Graph>::vertex_descriptor RTT::scripting::FunctionGraphBuilder::Vertex

Definition at line 67 of file rtt/scripting/FunctionGraphBuilder.hpp.

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

Definition at line 64 of file rtt/scripting/FunctionGraphBuilder.hpp.


Constructor & Destructor Documentation

RTT::FunctionGraphBuilder::FunctionGraphBuilder (  ) 

Constructs a Function graph builder.

Definition at line 49 of file FunctionGraphBuilder.cpp.

RTT::FunctionGraphBuilder::~FunctionGraphBuilder (  ) 

Definition at line 54 of file FunctionGraphBuilder.cpp.

RTT::scripting::FunctionGraphBuilder::FunctionGraphBuilder (  ) 

Constructs a Function graph builder.

RTT::scripting::FunctionGraphBuilder::~FunctionGraphBuilder (  ) 

Member Function Documentation

CommandNode RTT::scripting::FunctionGraphBuilder::addCommand ( ConditionInterface cond,
base::ActionInterface com 
)

Add a new command from the build CommandNode under a condition.

Returns:
the 'new' build CommandNode.
FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::addCommand ( ConditionInterface cond,
base::ActionInterface com 
)

Add a new command from the build CommandNode under a condition.

Returns:
the 'new' build CommandNode.

Definition at line 104 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::addConditionEdge ( ConditionInterface cond,
CommandNode  vert 
)

Add an edge from the build CommandNode to the given CommandNode without changing the build CommandNode.

void RTT::FunctionGraphBuilder::addConditionEdge ( ConditionInterface cond,
CommandNode  vert 
)

Add an edge from the build CommandNode to the given CommandNode without changing the build CommandNode.

Definition at line 114 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::appendFunction ( ConditionInterface cond,
FunctionGraphPtr  fn,
std::vector< base::DataSourceBase::shared_ptr fnargs 
)

Append a function to the build CommandNode.

Parameters:
fn The Function to append from the build CommandNode
cond The 'enter' condition
Returns:
the last CommandNode of the appended function.
CommandNode RTT::scripting::FunctionGraphBuilder::appendFunction ( ConditionInterface cond,
FunctionGraphPtr  fn,
std::vector< base::DataSourceBase::shared_ptr fnargs 
)

Append a function to the build CommandNode.

Parameters:
fn The Function to append from the build CommandNode
cond The 'enter' condition
Returns:
the last CommandNode of the appended function.
bool RTT::scripting::FunctionGraphBuilder::breakLoop (  ) 
bool RTT::FunctionGraphBuilder::breakLoop (  ) 

Definition at line 448 of file FunctionGraphBuilder.cpp.

size_t RTT::scripting::FunctionGraphBuilder::buildEdges (  )  const

Return the number of edges of the build CommandNode.

size_t RTT::FunctionGraphBuilder::buildEdges (  )  const

Return the number of edges of the build CommandNode.

Definition at line 186 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::buildNode (  )  const

Return the build CommandNode.

FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::buildNode (  )  const

Return the build CommandNode.

Definition at line 181 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::closeConditionEdge ( CommandNode  vert,
ConditionInterface cond 
)

Add an edge between the given CommandNode and the build CommandNode.

void RTT::FunctionGraphBuilder::closeConditionEdge ( CommandNode  vert,
ConditionInterface cond 
)

Add an edge between the given CommandNode and the build CommandNode.

Definition at line 119 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::connectToNext ( CommandNode  v,
ConditionInterface cond 
)

Connect the given CommandNode to the 'next' CommandNode.

void RTT::FunctionGraphBuilder::connectToNext ( CommandNode  v,
ConditionInterface cond 
)

Connect the given CommandNode to the 'next' CommandNode.

Definition at line 176 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::endElseBlock ( int  linenumber  ) 
void RTT::FunctionGraphBuilder::endElseBlock ( int  linenumber  ) 

Definition at line 406 of file FunctionGraphBuilder.cpp.

FunctionGraphPtr RTT::scripting::FunctionGraphBuilder::endFunction ( int  line = 0  ) 

Finish building the function and return the result.

Returns:
the finished function.
FunctionGraphPtr RTT::FunctionGraphBuilder::endFunction ( int  line = 0  ) 

Finish building the function and return the result.

Returns:
the finished function.

Definition at line 82 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::endIfBlock ( int  linenumber  ) 
void RTT::FunctionGraphBuilder::endIfBlock ( int  linenumber  ) 

Definition at line 391 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::endWhileBlock ( int  linenumber  ) 
void RTT::FunctionGraphBuilder::endWhileBlock ( int  linenumber  ) 

Definition at line 431 of file FunctionGraphBuilder.cpp.

base::ActionInterface* RTT::scripting::FunctionGraphBuilder::getCommand ( CommandNode  cn  ) 

Get the Command on a given CommandNode.

ActionInterface * RTT::FunctionGraphBuilder::getCommand ( CommandNode  cn  ) 

Get the Command on a given CommandNode.

Definition at line 133 of file FunctionGraphBuilder.cpp.

FunctionGraphPtr RTT::scripting::FunctionGraphBuilder::getFunction (  ) 

Return a pointer to the function being built, zero if none.

FunctionGraphPtr RTT::FunctionGraphBuilder::getFunction (  ) 

Return a pointer to the function being built, zero if none.

Definition at line 77 of file FunctionGraphBuilder.cpp.

bool RTT::scripting::FunctionGraphBuilder::inLoop (  ) 
bool RTT::FunctionGraphBuilder::inLoop (  ) 

Definition at line 443 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::moveTo ( CommandNode  _build,
CommandNode  _next,
int  linenr 
)

Select an already added CommandNode.

Returns:
the previous CommandNode.
FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::moveTo ( CommandNode  _build,
CommandNode  _next,
int  linenr 
)

Select an already added CommandNode.

Returns:
the previous CommandNode.

Definition at line 124 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::nextNode (  )  const

Return the next CommandNode.

FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::nextNode (  )  const

Return the next CommandNode.

Definition at line 191 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::proceedToNext ( ConditionInterface cond,
int  line_nr = 0 
)

Proceed to the 'next' CommandNode and add an edge with a condition.

Parameters:
cond The condition under which to proceed to the next node.
line_nr The line number of the 'build' command.
Returns:
The new build CommandNode.
CommandNode RTT::scripting::FunctionGraphBuilder::proceedToNext ( int  line_nr = 0  ) 

Proceed to the 'next' CommandNode.

Parameters:
line_nr The line number of the 'build' command.
Returns:
The new build CommandNode.
FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::proceedToNext ( ConditionInterface cond,
int  line_nr = 0 
)

Proceed to the 'next' CommandNode and add an edge with a condition.

Parameters:
cond The condition under which to proceed to the next node.
line_nr The line number of the 'build' command.
Returns:
The new build CommandNode.

Definition at line 160 of file FunctionGraphBuilder.cpp.

FunctionGraphBuilder::CommandNode RTT::FunctionGraphBuilder::proceedToNext ( int  line_nr = 0  ) 

Proceed to the 'next' CommandNode.

Parameters:
line_nr The line number of the 'build' command.
Returns:
The new build CommandNode.

Definition at line 166 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::returnFunction ( ConditionInterface cond,
int  line 
)

Function return is detected inside the function. Do not confuse with endFunction().

Parameters:
cond The Condition under which to return.
line The line number of that line in the function.
void RTT::FunctionGraphBuilder::returnFunction ( ConditionInterface cond,
int  line 
)

Function return is detected inside the function. Do not confuse with endFunction().

Parameters:
cond The Condition under which to return.
line The line number of that line in the function.

Definition at line 70 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::setCommand ( CommandNode  vert,
base::ActionInterface comm 
)

Sets a (new) command on a given CommandNode.

Parameters:
vert The CommandNode to be adapted
comm The new Command to be executed in that node.
void RTT::scripting::FunctionGraphBuilder::setCommand ( base::ActionInterface comm  ) 

Sets a new Command on the build CommandNode.

void RTT::FunctionGraphBuilder::setCommand ( CommandNode  vert,
base::ActionInterface comm 
)

Sets a (new) command on a given CommandNode.

Parameters:
vert The CommandNode to be adapted
comm The new Command to be executed in that node.

Definition at line 147 of file FunctionGraphBuilder.cpp.

void RTT::FunctionGraphBuilder::setCommand ( base::ActionInterface comm  ) 

Sets a new Command on the build CommandNode.

Definition at line 142 of file FunctionGraphBuilder.cpp.

CommandNode RTT::scripting::FunctionGraphBuilder::setFunction ( FunctionGraphPtr  fn,
std::vector< base::DataSourceBase::shared_ptr fnargs 
)

Put a function in the build CommandNode.

Parameters:
fn The Function to append from the build CommandNode
Returns:
the last CommandNode of the appended function.
CommandNode RTT::scripting::FunctionGraphBuilder::setFunction ( FunctionGraphPtr  fn,
std::vector< base::DataSourceBase::shared_ptr fnargs 
)

Put a function in the build CommandNode.

Parameters:
fn The Function to append from the build CommandNode
Returns:
the last CommandNode of the appended function.
void RTT::scripting::FunctionGraphBuilder::setLineNumber ( int  ln  ) 

Set the line number of the build command node.

Parameters:
ln The line number.
void RTT::FunctionGraphBuilder::setLineNumber ( int  ln  ) 

Set the line number of the build command node.

Parameters:
ln The line number.

Definition at line 196 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::setName ( const std::string &  _name  ) 
void RTT::FunctionGraphBuilder::setName ( const std::string &  _name  ) 

Definition at line 156 of file FunctionGraphBuilder.cpp.

FunctionGraphPtr RTT::scripting::FunctionGraphBuilder::startFunction ( const std::string &  fname  ) 

Start building a new function.

FunctionGraphPtr RTT::FunctionGraphBuilder::startFunction ( const std::string &  fname  ) 

Start building a new function.

Definition at line 58 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::startIfStatement ( ConditionInterface cond,
int  linenumber 
)
void RTT::FunctionGraphBuilder::startIfStatement ( ConditionInterface cond,
int  linenumber 
)

Definition at line 367 of file FunctionGraphBuilder.cpp.

void RTT::scripting::FunctionGraphBuilder::startWhileStatement ( ConditionInterface cond,
int  linenumber 
)
void RTT::FunctionGraphBuilder::startWhileStatement ( ConditionInterface cond,
int  linenumber 
)

Definition at line 415 of file FunctionGraphBuilder.cpp.


Member Data Documentation

A stack which keeps track of branch points.

Each if statement pushes three nodes on the stack : 1st: next, 2nd: else, 3rd: build. Each consequtive if statement places these three and they are popped on endIfBlock and endElseBlock.

Definition at line 246 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

Save the after-while nodes in a break stack to support the break statement.

Definition at line 252 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

The node which will be built next.

Definition at line 222 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

The graph currently working on.

Definition at line 236 of file install/include/rtt/scripting/FunctionGraphBuilder.hpp.

The node which will be built next.

Definition at line 227 of file install/include/rtt/scripting/FunctionGraphBuilder.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:50:14 2013