Orocos Real-Time Toolkit  2.9.0
Public Member Functions | List of all members
RTT::scripting::ValueChangeParser Class Reference

This class is responsible for parsing constant definitions, variable definitions, variable change instructions, and alias definitions. More...

#include <rtt/scripting/ValueChangeParser.hpp>

Public Member Functions

 ValueChangeParser (TaskContext *tc, CommonParser &cp, Service::shared_ptr storage, ExecutionEngine *caller)
 Create a ValueChangeParser which operates and stores values in a task. More...
 
void clear ()
 Clear assignCommands(), definedValues() and definedNames(). More...
 
void store (Service::shared_ptr other)
 Store allDefinedNames() in a service. More...
 
void load (Service::shared_ptr source)
 Loads all defined names from a service. More...
 
base::ActionInterfaceassignCommand ()
 This base::ActionInterface holds the command assigning a value to a variable that should be included in the program. More...
 
std::vector< base::ActionInterface * > assignCommands ()
 
std::vector< scripting::ConditionInterface * > assignConditions ()
 
base::AttributeBaselastDefinedValue ()
 
std::vector< base::AttributeBase * > definedValues ()
 
std::string lastDefinedName ()
 
std::vector< std::string > definedNames ()
 
std::vector< std::string > allDefinedNames ()
 
rule_tparser ()
 Returns the full parser, as it is used most. More...
 
rule_tconstantDefinitionParser ()
 the parser that parses definitions of constants. More...
 
rule_tvariableDefinitionParser ()
 the parser that parses variable definitions, don't forget to check assignCommand after a variable definition is parsed. More...
 
rule_taliasDefinitionParser ()
 The parser that parses alias definitions. More...
 
rule_tparamDefinitionParser ()
 The parser that parses state context parameter definitions. More...
 
rule_tbareDefinitionParser ()
 The parser that parses a bare variable definition. More...
 
void reset ()
 Completely clear all data and erase all parsed definitions from the taskcontext given in the constructor. More...
 

Detailed Description

This class is responsible for parsing constant definitions, variable definitions, variable change instructions, and alias definitions.

. It stores these in the ValueParser in the ParseContext, and parses values using ExpressionParser..

Todo:
The ValueChangeParser.cxx implementation needs refactoring.

Definition at line 60 of file ValueChangeParser.hpp.

Constructor & Destructor Documentation

RTT::ValueChangeParser::ValueChangeParser ( TaskContext tc,
CommonParser cp,
Service::shared_ptr  storage,
ExecutionEngine caller 
)

Create a ValueChangeParser which operates and stores values in a task.

Use definedvalues() to get the values added to tc, use store() to store the added values in another task context as well. After reset(), tc will be cleared of all the stored values. tc is thus used as a temporary storage container. If you want the new added values in a different storage container, use the storage argument. Defaults to tc->provides() if set to null.

Definition at line 73 of file ValueChangeParser.cpp.

References RTT::types::TypeInfo::buildAlias(), RTT::types::TypeInfo::buildConstant(), RTT::types::TypeInfo::buildVariable(), RTT::scripting::ExpressionParser::dropResult(), RTT::Logger::endl(), RTT::scripting::ExpressionParser::getCmdResult(), RTT::base::AttributeBase::getDataSource(), RTT::scripting::ExpressionParser::getResult(), RTT::types::TypeInfo::getTypeName(), RTT::scripting::ExpressionParser::hasResult(), RTT::scripting::CommonParser::identifier, keyword_p, RTT::Logger::log(), RTT::scripting::ExpressionParser::parser(), RULE, and RTT::Logger::Warning.

Member Function Documentation

rule_t & RTT::ValueChangeParser::aliasDefinitionParser ( )

The parser that parses alias definitions.

This does not work via an assignment, and it is not necessary to check assignCommand() after this..

Definition at line 371 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::StateGraphParser::StateGraphParser().

std::vector<std::string> RTT::scripting::ValueChangeParser::allDefinedNames ( )
inline
base::ActionInterface* RTT::scripting::ValueChangeParser::assignCommand ( )
inline

This base::ActionInterface holds the command assigning a value to a variable that should be included in the program.

After a constant definition, variable definition or variable assignment is parsed, you should check it, and include it in your program if it is non-zero.

Definition at line 158 of file ValueChangeParser.hpp.

std::vector<base::ActionInterface*> RTT::scripting::ValueChangeParser::assignCommands ( )
inline
std::vector<scripting::ConditionInterface*> RTT::scripting::ValueChangeParser::assignConditions ( )
inline
rule_t & RTT::ValueChangeParser::bareDefinitionParser ( )

The parser that parses a bare variable definition.

These do not get initialised where they are defined, so it is not necessary to check assignCommand() after this...

Definition at line 386 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::ProgramGraphParser::~ProgramGraphParser().

void RTT::ValueChangeParser::clear ( )
rule_t & RTT::ValueChangeParser::constantDefinitionParser ( )

the parser that parses definitions of constants.

Do not forget to check assignCommand after a constant definition is parsed..

Definition at line 366 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::StateGraphParser::StateGraphParser().

std::vector<std::string> RTT::scripting::ValueChangeParser::definedNames ( )
inline
std::vector<base::AttributeBase*> RTT::scripting::ValueChangeParser::definedValues ( )
inline
std::string RTT::scripting::ValueChangeParser::lastDefinedName ( )
inline

Definition at line 187 of file ValueChangeParser.hpp.

base::AttributeBase* RTT::scripting::ValueChangeParser::lastDefinedValue ( )
inline
void RTT::ValueChangeParser::load ( Service::shared_ptr  source)

Loads all defined names from a service.

Just like store(), but works the other way around and allows you to pre-defined some variables. This function removes all these variables from 'source'

Definition at line 316 of file ValueChangeParser.cpp.

Referenced by RTT::scripting::ProgramGraphParser::parserUsed().

rule_t & RTT::ValueChangeParser::paramDefinitionParser ( )

The parser that parses state context parameter definitions.

These do not get initialised where they are defined, so it is not necessary to check assignCommand() after this...

Definition at line 381 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::StateGraphParser::StateGraphParser().

rule_t & RTT::ValueChangeParser::parser ( )

Returns the full parser, as it is used most.

The individual sub-parsers are below.

Returns

Definition at line 361 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::ProgramGraphParser::~ProgramGraphParser().

void RTT::ValueChangeParser::reset ( )
void RTT::ValueChangeParser::store ( Service::shared_ptr  other)

Store allDefinedNames() in a service.

This allows you to retrieve all parsed variable declarations.

Definition at line 302 of file ValueChangeParser.cpp.

Referenced by RTT::scripting::ProgramGraphParser::bodyParserResult(), RTT::scripting::StateGraphParser::getParserResult(), and RTT::scripting::ProgramGraphParser::parserUsed().

rule_t & RTT::ValueChangeParser::variableDefinitionParser ( )

the parser that parses variable definitions, don't forget to check assignCommand after a variable definition is parsed.

Definition at line 376 of file ValueChangeParser.cpp.

Referenced by allDefinedNames(), and RTT::scripting::StateGraphParser::StateGraphParser().


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