This class builds a program consisting of data contained in a program graph tree, based on the Boost Graph Library. More...
#include <rtt/FunctionGraphBuilder.hpp>
Public Types | |
typedef EdgeCondition::EdgeProperty | EdgeProperty |
typedef VertexNode::VertProperty | VertProperty |
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 >::edge_descriptor | Edge |
typedef FunctionGraph::Vertex | CommandNode |
A CommandNode serves as a token to construct a vertex or node, containing a command. | |
typedef FunctionGraph::Edge | ConditionEdge |
A ConditionEdge serves as a token to construct an edge, containing a condition. | |
Public Member Functions | |
FunctionGraphBuilder () | |
Constructs a Function graph builder. | |
void | setLineNumber (int ln) |
Set the line number of the build command node. | |
void | setName (const std::string &_name) |
FunctionGraphPtr | startFunction (const std::string &fname) |
Start building a new function. | |
void | returnFunction (ConditionInterface *cond, int line) |
Function return is detected inside the function. | |
FunctionGraphPtr | endFunction (int line=0) |
Finish building the function and return the result. | |
FunctionGraphPtr | getFunction () |
Return a pointer to the function being built, zero if none. | |
void | startIfStatement (ConditionInterface *cond, int linenumber) |
void | endIfBlock (int linenumber) |
void | endElseBlock (int linenumber) |
void | startWhileStatement (ConditionInterface *cond, int linenumber) |
void | endWhileBlock (int linenumber) |
bool | inLoop () |
bool | breakLoop () |
CommandNode | addCommand (ConditionInterface *cond, CommandInterface *com) |
Add a new command from the build CommandNode under a condition. | |
void | addConditionEdge (ConditionInterface *cond, CommandNode vert) |
Add an edge from the build CommandNode to the given CommandNode without changing the build CommandNode. | |
void | closeConditionEdge (CommandNode vert, ConditionInterface *cond) |
Add an edge between the given CommandNode and the build CommandNode. | |
CommandNode | moveTo (CommandNode _build, CommandNode _next, int linenr) |
Select an already added CommandNode. | |
void | setCommand (CommandInterface *comm) |
Sets a new Command on the build CommandNode. | |
CommandInterface * | getCommand (CommandNode cn) |
Get the Command on a given CommandNode. | |
void | setCommand (CommandNode vert, CommandInterface *comm) |
Sets a (new) command on a given CommandNode. | |
CommandNode | appendFunction (ConditionInterface *cond, FunctionGraphPtr fn, std::vector< DataSourceBase::shared_ptr > fnargs) |
Append a function to the build CommandNode. | |
CommandNode | setFunction (FunctionGraphPtr fn, std::vector< DataSourceBase::shared_ptr > fnargs) |
Put a function in the build CommandNode. | |
CommandNode | proceedToNext (int line_nr=0) |
Proceed to the 'next' CommandNode. | |
CommandNode | proceedToNext (ConditionInterface *cond, int line_nr=0) |
Proceed to the 'next' CommandNode and add an edge with a condition. | |
void | connectToNext (CommandNode v, ConditionInterface *cond) |
Connect the given CommandNode to the 'next' CommandNode. | |
CommandNode | buildNode () const |
Return the build CommandNode. | |
size_t | buildEdges () const |
Return the number of edges of the build CommandNode. | |
CommandNode | nextNode () const |
Return the next CommandNode. | |
Public Attributes | |
CommandNode | build |
The node which will be built next. | |
CommandNode | next |
The node which will be built next. |
This class builds a program consisting of data contained in a program graph tree, based on the Boost Graph Library.
Definition at line 49 of file FunctionGraphBuilder.hpp.
CommandNode RTT::FunctionGraphBuilder::addCommand | ( | ConditionInterface * | cond, | |
CommandInterface * | com | |||
) |
Add a new command from the build CommandNode under a condition.
CommandNode RTT::FunctionGraphBuilder::appendFunction | ( | ConditionInterface * | cond, | |
FunctionGraphPtr | fn, | |||
std::vector< DataSourceBase::shared_ptr > | fnargs | |||
) |
Append a function to the build CommandNode.
fn | The Function to append from the build CommandNode | |
cond | The 'enter' condition |
FunctionGraphPtr RTT::FunctionGraphBuilder::endFunction | ( | int | line = 0 |
) |
Finish building the function and return the result.
CommandNode RTT::FunctionGraphBuilder::moveTo | ( | CommandNode | _build, | |
CommandNode | _next, | |||
int | linenr | |||
) |
Select an already added CommandNode.
CommandNode RTT::FunctionGraphBuilder::proceedToNext | ( | ConditionInterface * | cond, | |
int | line_nr = 0 | |||
) |
Proceed to the 'next' CommandNode and add an edge with a condition.
cond | The condition under which to proceed to the next node. | |
line_nr | The line number of the 'build' command. |
CommandNode RTT::FunctionGraphBuilder::proceedToNext | ( | int | line_nr = 0 |
) |
Proceed to the 'next' CommandNode.
line_nr | The line number of the 'build' command. |
void RTT::FunctionGraphBuilder::returnFunction | ( | ConditionInterface * | cond, | |
int | line | |||
) |
Function return is detected inside the function.
Do not confuse with endFunction().
cond | The Condition under which to return. | |
line | The line number of that line in the function. |
void RTT::FunctionGraphBuilder::setCommand | ( | CommandNode | vert, | |
CommandInterface * | comm | |||
) |
Sets a (new) command on a given CommandNode.
vert | The CommandNode to be adapted | |
comm | The new Command to be executed in that node. |
CommandNode RTT::FunctionGraphBuilder::setFunction | ( | FunctionGraphPtr | fn, | |
std::vector< DataSourceBase::shared_ptr > | fnargs | |||
) |
Put a function in the build CommandNode.
fn | The Function to append from the build CommandNode |
void RTT::FunctionGraphBuilder::setLineNumber | ( | int | ln | ) |
Set the line number of the build command node.
ln | The line number. |