Vuo  2.3.2
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VuoMathExpressionParserInternal Class Reference

Description

C++ implementation of opaque C type VuoMathExpressionParser.

Definition at line 272 of file VuoMathExpressionParser.cc.

Public Member Functions

 VuoMathExpressionParserInternal (const string &expression, const vector< string > &outputVariableNames_=vector< string >())
 Parses the mathematical expression(s) (e.g. More...
 

Static Public Member Functions

static double * addVariable (const char *variable, void *userData)
 Callback needed by mu::Parser to parse each variable. More...
 
static string getExpressionSeparator (void)
 Returns the token that separates expressions when multiple of them appear in a string (e.g. More...
 

Public Attributes

mu::Parser muParser
 Does most of the actual parsing work. More...
 
size_t variableCount
 Number of variables parsed. More...
 
double variableValues [MAX_VARIABLE_COUNT]
 Storage for variables parsed, used to hold values for calculations. More...
 
map< string, size_t > variableNamesAndIndices
 A mapping of variable names to indices in variableValues. More...
 
vector< string > inputVariableNames
 The unique input variable names parsed, in alphabetical order. More...
 
vector< string > outputVariableNames
 The output variable name for each expression parsed, in the order the expressions were given. More...
 

Constructor & Destructor Documentation

◆ VuoMathExpressionParserInternal()

VuoMathExpressionParserInternal::VuoMathExpressionParserInternal ( const string &  expression,
const vector< string > &  outputVariableNames_ = vector<string>() 
)
inline

Parses the mathematical expression(s) (e.g.

"a + b" or "y = x + 1" or "sum=n1+n2,product=n1*n2").

If outputVariableNames_ is given, assigns unique output variable names for any empty elements.

Exceptions
mu::ParserErrorexpression contains a syntax error.

Definition at line 306 of file VuoMathExpressionParser.cc.

Member Function Documentation

◆ addVariable()

static double* VuoMathExpressionParserInternal::addVariable ( const char *  variable,
void *  userData 
)
inlinestatic

Callback needed by mu::Parser to parse each variable.

Definition at line 285 of file VuoMathExpressionParser.cc.

◆ getExpressionSeparator()

static string VuoMathExpressionParserInternal::getExpressionSeparator ( void  )
inlinestatic

Returns the token that separates expressions when multiple of them appear in a string (e.g.

",").

Definition at line 355 of file VuoMathExpressionParser.cc.

Member Data Documentation

◆ inputVariableNames

vector<string> VuoMathExpressionParserInternal::inputVariableNames

The unique input variable names parsed, in alphabetical order.

Definition at line 279 of file VuoMathExpressionParser.cc.

◆ muParser

mu::Parser VuoMathExpressionParserInternal::muParser

Does most of the actual parsing work.

Definition at line 275 of file VuoMathExpressionParser.cc.

◆ outputVariableNames

vector<string> VuoMathExpressionParserInternal::outputVariableNames

The output variable name for each expression parsed, in the order the expressions were given.

Definition at line 280 of file VuoMathExpressionParser.cc.

◆ variableCount

size_t VuoMathExpressionParserInternal::variableCount

Number of variables parsed.

Definition at line 276 of file VuoMathExpressionParser.cc.

◆ variableNamesAndIndices

map<string, size_t> VuoMathExpressionParserInternal::variableNamesAndIndices

A mapping of variable names to indices in variableValues.

Definition at line 278 of file VuoMathExpressionParser.cc.

◆ variableValues

double VuoMathExpressionParserInternal::variableValues[MAX_VARIABLE_COUNT]

Storage for variables parsed, used to hold values for calculations.

Definition at line 277 of file VuoMathExpressionParser.cc.


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