Vuo
1.0.1
|
VuoMathExpressionParser interface.
Typedefs | |
typedef void * | VuoMathExpressionParser |
Parses and performs calculations with mathematical expressions. | |
typedef void * | VuoMathExpressionError |
Error caused by invalid expression given to VuoMathExpressionParser. | |
typedef void* VuoMathExpressionError |
Error caused by invalid expression given to VuoMathExpressionParser.
typedef void* VuoMathExpressionParser |
Parses and performs calculations with mathematical expressions.
void VuoMathExpressionError_free | ( | VuoMathExpressionError | error | ) |
Destructor.
VuoList_VuoInteger VuoMathExpressionError_getExpressionIndices | ( | VuoMathExpressionError | error | ) |
Returns a sorted list of the indices of the math expressions causing the error.
The indices refer to the VuoList_VuoText passed to VuoMathExpressionParser_makeFromMultipleExpressions().
const char* VuoMathExpressionError_getMessage | ( | VuoMathExpressionError | error | ) |
Returns a description of the error.
The returned pointer is owned by error and should not be freed by the caller.
VuoDictionary_VuoText_VuoReal VuoMathExpressionParser_calculate | ( | VuoMathExpressionParser | m, |
VuoDictionary_VuoText_VuoReal | inputValues | ||
) |
Evaluates the parsed expression(s).
The value of each input variable is set from inputValues (a mapping of variable names to values). Any variables not in inputValues are set to 0.
Returns a mapping of output variable names to values.
VuoList_VuoText VuoMathExpressionParser_getInputVariables | ( | VuoMathExpressionParser | m | ) |
Returns the unique input variable names from the parsed expression(s), in alphabetical order.
VuoList_VuoText VuoMathExpressionParser_getOutputVariables | ( | VuoMathExpressionParser | m | ) |
Returns the output variable names from the parsed expression(s), in the order they appeared.
For a non-assignment expression (e.g. "x + 1", as opposed to "y = x + 1"), a unique name is automatically assigned.
VuoMathExpressionParser VuoMathExpressionParser_makeFromMultipleExpressions | ( | VuoList_VuoText | expressions, |
VuoMathExpressionError * | error | ||
) |
Parses expressions (e.g.
["sum=n1+n2", "product=n1*n2", "n1-n2+5"]).
If parsing fails, returns null and sets error.
VuoMathExpressionParser VuoMathExpressionParser_makeFromSingleExpression | ( | VuoText | expression, |
VuoMathExpressionError * | error | ||
) |
Parses expression (e.g.
"a + b" or "y = x + 1").
If parsing fails, returns null and sets error.