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

#include <StateGraphParser.hpp>

Public Member Functions

ParsedStateMachinePtr getParserResult ()
 
std::vector< ParsedStateMachinePtrparse (iter_t &begin, iter_t end)
 
rule_tparser ()
 
 StateGraphParser (iter_t &positer, TaskContext *tc, ExecutionEngine *caller, CommonParser *cp)
 
void storeOffset ()
 
 ~StateGraphParser ()
 

Private Types

typedef std::map< std::string, StateMachineBuilder * > machinebuilders_t
 
typedef std::map< std::string, ParsedStateMachinePtrmachinenamemap_t
 
typedef std::map< std::string, base::AttributeBase * > machineparams_t
 
typedef std::map< std::string, base::DataSourceBase::shared_ptrmachineparamvalues_t
 
typedef std::map< std::string, StateDescription * > machinestatesmap_t
 
typedef boost::shared_ptr< ParsedStateMachineParsedStateMachinePtr
 

Private Member Functions

void clear ()
 
void doselect (const std::string &name)
 
boost::shared_ptr< ProgramInterfacefinishProgram ()
 
void inpreconditions ()
 
void inprogram (const std::string &name)
 
void noselect ()
 
void saveText (iter_t begin, iter_t end)
 
void seencondition ()
 
void seenelse ()
 
void seenelseprog ()
 
void seenendcondition ()
 
void seenentry ()
 
void seeneventargs ()
 
void seeneventname (iter_t s, iter_t f)
 
void seeneventtrans ()
 
void seenexit ()
 
void seenfinalstate ()
 
void seenhandle ()
 
void seeninitialstate ()
 
void seeninstmachinename (iter_t begin, iter_t end)
 
void seenmachineinstantiation ()
 
void seenmachineinstargumentname (iter_t begin, iter_t end)
 
void seenmachineinstargumentvalue ()
 
void seenmachineparam ()
 
void seenmachinetypename (iter_t begin, iter_t end)
 
void seenmachinevariable ()
 
void seenprecondition ()
 
void seenpreconditions ()
 
void seenrootmachineinstantiation ()
 
void seenrun ()
 
void seenselect (iter_t s, iter_t f)
 
void seenstateend ()
 
void seenstatemachineend ()
 
void seenstatemachinename (iter_t begin, iter_t end)
 
void seensubMachineinstantiation ()
 
void seentransprog ()
 
void startrootmachineinstantiation ()
 
void statedef (iter_t s, iter_t f)
 

Private Attributes

rule_t argslist
 
ArgumentsParserargsparser
 
rule_t body
 
ExecutionEnginecaller
 
CommonParsercommonparser
 
ConditionParserconditionparser
 
TaskContextcontext
 
std::map< std::string, ConditionCache * > cur_port_events
 
ConditionInterfacecurcondition
 
bool curfinalstateflag
 
bool curinitialstateflag
 
ParsedStateMachinePtr curinstantiatedmachine
 
std::string curinstmachinename
 
machineparamvalues_t curinstmachineparams
 
StateMachineBuildercurmachinebuilder
 
std::string curmachineinstargumentname
 
std::string curmachinename
 
StateDescriptioncurnonprecstate
 
boost::shared_ptr< StateMachineServicecurobject
 
StateDescriptioncurstate
 
ParsedStateMachinePtr curtemplate
 
rule_t elsebranch
 
boost::shared_ptr< ProgramInterfaceelseProgram
 
StateDescriptionelsestate
 
rule_t entry
 
std::vector< base::DataSourceBase::shared_ptrevargs
 store line number of select's 'if' statement. More...
 
rule_t eventline
 
std::string evname
 
rule_t exit
 
ExpressionParserexpressionparser
 
std::map< std::string, ConditionCache * > global_port_events
 
rule_t handle
 
rule_t ifbranch
 
bool isroot
 
int ln_offset
 
rule_t machinealias
 
machinebuilders_t machinebuilders
 
rule_t machineconstant
 
rule_t machineinstantiation
 
rule_t machineinstargument
 
rule_t machineinstarguments
 
rule_t machinememvar
 
rule_t machineparam
 
rule_t machinevariable
 
our_pos_iter_tmpositer
 
rule_t newline
 
std::vector< base::ActionInterface * > paraminitcommands
 
ServicePtr peer
 
PeerParserpeerparser
 
rule_t precondition
 
rule_t preconditions
 
rule_t production
 
ProgramGraphParserprogParser
 
rule_t program
 
rule_t programBody
 
rule_t progselect
 
int rank
 
rule_t rootmachineinstantiation
 
machinenamemap_t rootmachines
 
rule_t run
 
our_pos_iter_t saveStartPos
 
unsigned int selectln
 are we instantiating a rootmachine ? More...
 
rule_t selector
 
rule_t state
 
rule_t statecontent
 
rule_t statecontentline
 
rule_t statemachine
 
rule_t statemachinecontent
 
rule_t subMachinedecl
 
rule_t subMachinevarchange
 
rule_t transition
 
rule_t transitions
 
rule_t transline
 
boost::shared_ptr< ProgramInterfacetransProgram
 
ValueChangeParservaluechangeparser
 
rule_t vardec
 
std::vector< base::ActionInterface * > varinitcommands
 
rule_t varline
 

Detailed Description

This is not a parser in the Boost.spirit sense of the word, it's just a class used to hold the parser and semantic actions..

This class does the actual work. It generates a Finite State Graph, by constructing the State nodes. We just go over the code one single time, and construct the FSM as we go. For every statement, we construct a new GraphNode, and fill it up as we get the information we need.

Definition at line 61 of file StateGraphParser.hpp.

Member Typedef Documentation

Definition at line 80 of file StateGraphParser.hpp.

Definition at line 76 of file StateGraphParser.hpp.

Definition at line 77 of file StateGraphParser.hpp.

Definition at line 78 of file StateGraphParser.hpp.

Definition at line 79 of file StateGraphParser.hpp.

Definition at line 75 of file StateGraphParser.hpp.

Constructor & Destructor Documentation

RTT::StateGraphParser::StateGraphParser ( iter_t positer,
TaskContext tc,
ExecutionEngine caller,
CommonParser cp 
)

Definition at line 111 of file StateGraphParser.cpp.

RTT::StateGraphParser::~StateGraphParser ( )

Definition at line 796 of file StateGraphParser.cpp.

Member Function Documentation

void RTT::StateGraphParser::clear ( )
private

Definition at line 804 of file StateGraphParser.cpp.

void RTT::StateGraphParser::doselect ( const std::string &  name)
private

Definition at line 522 of file StateGraphParser.cpp.

ProgramInterfacePtr RTT::StateGraphParser::finishProgram ( )
private

Definition at line 410 of file StateGraphParser.cpp.

ParsedStateMachinePtr RTT::StateGraphParser::getParserResult ( )

Returns the last state machine instantiation of parser() or null if no instantiations were seen.

Definition at line 331 of file StateGraphParser.cpp.

void RTT::StateGraphParser::inpreconditions ( )
private

Definition at line 901 of file StateGraphParser.cpp.

void RTT::StateGraphParser::inprogram ( const std::string &  name)
private

Definition at line 398 of file StateGraphParser.cpp.

void RTT::StateGraphParser::noselect ( )
private

Definition at line 507 of file StateGraphParser.cpp.

std::vector< ParsedStateMachinePtr > RTT::StateGraphParser::parse ( iter_t begin,
iter_t  end 
)

Definition at line 732 of file StateGraphParser.cpp.

rule_t & RTT::StateGraphParser::parser ( )

Returns the top-level parser for state machines. It parses one state machine definition or one state machine instantiation.

See also
storeOffset()

Definition at line 327 of file StateGraphParser.cpp.

void RTT::StateGraphParser::saveText ( iter_t  begin,
iter_t  end 
)
private

Definition at line 891 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seencondition ( )
private

Definition at line 461 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenelse ( )
private

Definition at line 455 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenelseprog ( )
private

Definition at line 448 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenendcondition ( )
private

Definition at line 632 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenentry ( )
private

Definition at line 415 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seeneventargs ( )
private

Definition at line 500 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seeneventname ( iter_t  s,
iter_t  f 
)
private

Definition at line 470 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seeneventtrans ( )
private

Definition at line 639 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenexit ( )
private

Definition at line 422 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenfinalstate ( )
private

Definition at line 346 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenhandle ( )
private

Definition at line 429 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seeninitialstate ( )
private

Definition at line 341 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seeninstmachinename ( iter_t  begin,
iter_t  end 
)
private

Definition at line 978 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachineinstantiation ( )
private

Definition at line 1002 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachineinstargumentname ( iter_t  begin,
iter_t  end 
)
private

Definition at line 984 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachineinstargumentvalue ( )
private

Definition at line 990 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachineparam ( )
private

Definition at line 1080 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachinetypename ( iter_t  begin,
iter_t  end 
)
private

Definition at line 969 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenmachinevariable ( )
private

Definition at line 1072 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenprecondition ( )
private

Definition at line 645 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenpreconditions ( )
private

Definition at line 909 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenrootmachineinstantiation ( )
private

Definition at line 920 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenrun ( )
private

Definition at line 436 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenselect ( iter_t  s,
iter_t  f 
)
private

Definition at line 516 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenstateend ( )
private

Definition at line 374 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenstatemachineend ( )
private

Definition at line 659 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seenstatemachinename ( iter_t  begin,
iter_t  end 
)
private

Definition at line 860 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seensubMachineinstantiation ( )
private

Definition at line 942 of file StateGraphParser.cpp.

void RTT::StateGraphParser::seentransprog ( )
private

Definition at line 443 of file StateGraphParser.cpp.

void RTT::StateGraphParser::startrootmachineinstantiation ( )
private

Definition at line 916 of file StateGraphParser.cpp.

void RTT::StateGraphParser::statedef ( iter_t  s,
iter_t  f 
)
private

Definition at line 351 of file StateGraphParser.cpp.

void RTT::StateGraphParser::storeOffset ( )

Stores the current position in the input stream (iterator received from the constructor) in order to be able to extract the statemachine's text from the input stream. You need to call this function once before using the parser().

Definition at line 883 of file StateGraphParser.cpp.

Member Data Documentation

rule_t RTT::scripting::StateGraphParser::argslist
private

Definition at line 138 of file StateGraphParser.hpp.

ArgumentsParser* RTT::scripting::StateGraphParser::argsparser
private

Definition at line 162 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::body
private

Definition at line 120 of file StateGraphParser.hpp.

ExecutionEngine* RTT::scripting::StateGraphParser::caller
private

Definition at line 66 of file StateGraphParser.hpp.

CommonParser* RTT::scripting::StateGraphParser::commonparser
private

Definition at line 158 of file StateGraphParser.hpp.

ConditionParser* RTT::scripting::StateGraphParser::conditionparser
private

Definition at line 159 of file StateGraphParser.hpp.

TaskContext* RTT::scripting::StateGraphParser::context
private

Definition at line 64 of file StateGraphParser.hpp.

std::map<std::string,ConditionCache*> RTT::scripting::StateGraphParser::cur_port_events
private

Definition at line 116 of file StateGraphParser.hpp.

ConditionInterface* RTT::scripting::StateGraphParser::curcondition
private

Definition at line 101 of file StateGraphParser.hpp.

bool RTT::scripting::StateGraphParser::curfinalstateflag
private

Definition at line 94 of file StateGraphParser.hpp.

bool RTT::scripting::StateGraphParser::curinitialstateflag
private

Definition at line 93 of file StateGraphParser.hpp.

ParsedStateMachinePtr RTT::scripting::StateGraphParser::curinstantiatedmachine
private

Definition at line 87 of file StateGraphParser.hpp.

std::string RTT::scripting::StateGraphParser::curinstmachinename
private

Definition at line 89 of file StateGraphParser.hpp.

machineparamvalues_t RTT::scripting::StateGraphParser::curinstmachineparams
private

Definition at line 90 of file StateGraphParser.hpp.

StateMachineBuilder* RTT::scripting::StateGraphParser::curmachinebuilder
private

Definition at line 88 of file StateGraphParser.hpp.

std::string RTT::scripting::StateGraphParser::curmachineinstargumentname
private

Definition at line 91 of file StateGraphParser.hpp.

std::string RTT::scripting::StateGraphParser::curmachinename
private

Definition at line 92 of file StateGraphParser.hpp.

StateDescription* RTT::scripting::StateGraphParser::curnonprecstate
private

Definition at line 96 of file StateGraphParser.hpp.

boost::shared_ptr<StateMachineService> RTT::scripting::StateGraphParser::curobject
private

Definition at line 68 of file StateGraphParser.hpp.

StateDescription* RTT::scripting::StateGraphParser::curstate
private

Definition at line 95 of file StateGraphParser.hpp.

ParsedStateMachinePtr RTT::scripting::StateGraphParser::curtemplate
private

Definition at line 84 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::elsebranch
private

Definition at line 147 of file StateGraphParser.hpp.

boost::shared_ptr<ProgramInterface> RTT::scripting::StateGraphParser::elseProgram
private

Definition at line 100 of file StateGraphParser.hpp.

StateDescription* RTT::scripting::StateGraphParser::elsestate
private

Definition at line 99 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::entry
private

Definition at line 132 of file StateGraphParser.hpp.

std::vector<base::DataSourceBase::shared_ptr> RTT::scripting::StateGraphParser::evargs
private

store line number of select's 'if' statement.

Definition at line 114 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::eventline
private

Definition at line 143 of file StateGraphParser.hpp.

std::string RTT::scripting::StateGraphParser::evname
private

Definition at line 115 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::exit
private

Definition at line 140 of file StateGraphParser.hpp.

ExpressionParser* RTT::scripting::StateGraphParser::expressionparser
private

Definition at line 161 of file StateGraphParser.hpp.

std::map<std::string,ConditionCache*> RTT::scripting::StateGraphParser::global_port_events
private

Definition at line 117 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::handle
private

Definition at line 139 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::ifbranch
private

Definition at line 146 of file StateGraphParser.hpp.

bool RTT::scripting::StateGraphParser::isroot
private

Definition at line 111 of file StateGraphParser.hpp.

int RTT::scripting::StateGraphParser::ln_offset
private

Definition at line 73 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machinealias
private

Definition at line 155 of file StateGraphParser.hpp.

machinebuilders_t RTT::scripting::StateGraphParser::machinebuilders
private

Definition at line 83 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machineconstant
private

Definition at line 154 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machineinstantiation
private

Definition at line 124 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machineinstargument
private

Definition at line 150 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machineinstarguments
private

Definition at line 149 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machinememvar
private

Definition at line 151 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machineparam
private

Definition at line 153 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::machinevariable
private

Definition at line 152 of file StateGraphParser.hpp.

our_pos_iter_t& RTT::scripting::StateGraphParser::mpositer
private

Definition at line 70 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::newline
private

Definition at line 121 of file StateGraphParser.hpp.

std::vector<base::ActionInterface*> RTT::scripting::StateGraphParser::paraminitcommands
private

Definition at line 85 of file StateGraphParser.hpp.

ServicePtr RTT::scripting::StateGraphParser::peer
private

Definition at line 69 of file StateGraphParser.hpp.

PeerParser* RTT::scripting::StateGraphParser::peerparser
private

Definition at line 163 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::precondition
private

Definition at line 134 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::preconditions
private

Definition at line 133 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::production
private

Definition at line 119 of file StateGraphParser.hpp.

ProgramGraphParser* RTT::scripting::StateGraphParser::progParser
private

Definition at line 97 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::program
private

Definition at line 144 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::programBody
private

Definition at line 141 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::progselect
private

Definition at line 145 of file StateGraphParser.hpp.

int RTT::scripting::StateGraphParser::rank
private

used to sort conditions as they are generated and inserted in the StateMachine.

Definition at line 110 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::rootmachineinstantiation
private

Definition at line 122 of file StateGraphParser.hpp.

machinenamemap_t RTT::scripting::StateGraphParser::rootmachines
private

Definition at line 82 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::run
private

Definition at line 135 of file StateGraphParser.hpp.

our_pos_iter_t RTT::scripting::StateGraphParser::saveStartPos
private

Definition at line 71 of file StateGraphParser.hpp.

unsigned int RTT::scripting::StateGraphParser::selectln
private

are we instantiating a rootmachine ?

Definition at line 112 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::selector
private

Definition at line 148 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::state
private

Definition at line 127 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::statecontent
private

Definition at line 130 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::statecontentline
private

Definition at line 131 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::statemachine
private

Definition at line 123 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::statemachinecontent
private

Definition at line 125 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::subMachinedecl
private

Definition at line 129 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::subMachinevarchange
private

Definition at line 156 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::transition
private

Definition at line 137 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::transitions
private

Definition at line 136 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::transline
private

Definition at line 142 of file StateGraphParser.hpp.

boost::shared_ptr<ProgramInterface> RTT::scripting::StateGraphParser::transProgram
private

Definition at line 98 of file StateGraphParser.hpp.

ValueChangeParser* RTT::scripting::StateGraphParser::valuechangeparser
private

Definition at line 160 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::vardec
private

Definition at line 128 of file StateGraphParser.hpp.

std::vector<base::ActionInterface*> RTT::scripting::StateGraphParser::varinitcommands
private

Definition at line 86 of file StateGraphParser.hpp.

rule_t RTT::scripting::StateGraphParser::varline
private

Definition at line 126 of file StateGraphParser.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:46