Vuo  0.9.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VuoMathExpressionParserInternal Class Reference

Description

C++ implementation of opaque C type VuoMathExpressionParser.

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Constructor & Destructor Documentation

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.

Member Function Documentation

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

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

static string VuoMathExpressionParserInternal::getExpressionSeparator ( void  )
inlinestatic

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

",").

Member Data Documentation

vector<string> VuoMathExpressionParserInternal::inputVariableNames

The unique input variable names parsed, in alphabetical order.

mu::Parser VuoMathExpressionParserInternal::muParser

Does most of the actual parsing work.

vector<string> VuoMathExpressionParserInternal::outputVariableNames

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

size_t VuoMathExpressionParserInternal::variableCount

Number of variables parsed.

map<string, size_t> VuoMathExpressionParserInternal::variableNamesAndIndices

A mapping of variable names to indices in variableValues.

double VuoMathExpressionParserInternal::variableValues[MAX_VARIABLE_COUNT]

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


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