#include <ExpressionParser.h>
Definition at line 29 of file ExpressionParser.h.
◆ ExpressionParser() [1/5]
ExpressionParsing::ExpressionParser::ExpressionParser |
( |
| ) |
|
◆ ExpressionParser() [2/5]
ExpressionParsing::ExpressionParser::ExpressionParser |
( |
IProxyLoader * |
proxyLoader | ) |
|
◆ ExpressionParser() [3/5]
ExpressionParsing::ExpressionParser::ExpressionParser |
( |
IUnitInterpreter * |
unitInterpreter | ) |
|
◆ ExpressionParser() [4/5]
◆ ~ExpressionParser()
ExpressionParsing::ExpressionParser::~ExpressionParser |
( |
| ) |
|
◆ ExpressionParser() [5/5]
◆ evaluate()
StackElement ExpressionParsing::ExpressionParser::evaluate |
( |
| ) |
const |
◆ evaluateAsBool()
bool ExpressionParsing::ExpressionParser::evaluateAsBool |
( |
| ) |
const |
Definition at line 104 of file ExpressionParser.cxx.
108 else throw std::runtime_error(
"Unable to evaluate vector quantity as a boolean");
◆ evaluateAsDouble()
double ExpressionParsing::ExpressionParser::evaluateAsDouble |
( |
| ) |
const |
Definition at line 111 of file ExpressionParser.cxx.
114 if (
result.isScalar())
return result.scalarValue<
double>();
115 else throw std::runtime_error(
"Unable to evaluate vector quantity as a double");
◆ evaluateAsVector()
std::vector< int > ExpressionParsing::ExpressionParser::evaluateAsVector |
( |
| ) |
const |
Definition at line 118 of file ExpressionParser.cxx.
121 if (
result.isVector())
return result.vectorValue<
int>();
122 else throw std::runtime_error(
"Unable to evaluate scalar quantity as a vector");
◆ getVariables()
std::vector< std::string > ExpressionParsing::ExpressionParser::getVariables |
( |
| ) |
const |
Definition at line 89 of file ExpressionParser.cxx.
90 std::vector<std::string> vars;
92 if (element.isProxy() &&
std::find(vars.begin(),vars.end(),element.proxyVarName()) == vars.end() ) {
93 vars.push_back( element.proxyVarName() );
◆ loadExpression()
bool ExpressionParsing::ExpressionParser::loadExpression |
( |
const std::string & |
expression | ) |
|
Definition at line 61 of file ExpressionParser.cxx.
63 std::string trimmedExpression = boost::algorithm::trim_copy_if(
expression, boost::is_any_of(
"\""));
68 Grammar<std::string::const_iterator>
grammar;
71 std::string::const_iterator expressionIter = trimmedExpression.begin();
72 std::string::const_iterator expressionEnd = trimmedExpression.end();
73 using boost::spirit::ascii::space_type;
74 bool r = phrase_parse(expressionIter, expressionEnd,
grammar, space_type(), expr);
75 std::string remainingExpression(expressionIter, expressionEnd);
77 if (remainingExpression.length() > 0) {
78 throw std::runtime_error(
"Did you forget an operator? This was not parsed: '" + remainingExpression +
"'");
◆ operator=()
◆ setup()
void ExpressionParsing::ExpressionParser::setup |
( |
| ) |
|
|
private |
◆ m_code
std::vector<StackElement> ExpressionParsing::ExpressionParser::m_code |
|
private |
◆ m_proxyLoader
IProxyLoader* ExpressionParsing::ExpressionParser::m_proxyLoader |
|
private |
◆ m_unitInterpreter
◆ m_vm
VirtualMachine* ExpressionParsing::ExpressionParser::m_vm |
|
private |
The documentation for this class was generated from the following files: