Vuo  2.3.2
VuoMathExpressionList.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 
13 #ifdef VUO_COMPILER
15  "title" : "Math Expression List",
16  "description" : "A list of mathematical expressions that can be used for calculations.",
17  "keywords" : [ ],
18  "version" : "1.0.0",
19  "dependencies" : [
20  "VuoDictionary_VuoText_VuoReal",
21  "VuoMathExpressionParser"
22  ]
23  });
24 #endif
26 
34 {
36 
37  if (expressions && VuoListGetCount_VuoText(expressions) > 0)
38  {
39  me.expressions = expressions;
40 
41  VuoMathExpressionError error = NULL;
44  }
45  else
46  {
48  me.parser = NULL;
49  }
50 
51  return me;
52 }
53 
65 {
66  return VuoMathExpressionList_make(VuoJson_getObjectValue(VuoList_VuoText, js, "expressions", NULL));
67 }
68 
85 {
86  json_object *js = json_object_new_object();
87 
88  json_object_object_add(js, "expressions", VuoList_VuoText_getJson(me.expressions));
89 
90  if (me.parser)
91  {
93  json_object_object_add(js, "inputVariables", VuoList_VuoText_getJson(inputVariables));
94  VuoRetain(inputVariables);
95  VuoRelease(inputVariables);
96 
98  json_object_object_add(js, "outputVariables", VuoList_VuoText_getJson(outputVariables));
99  VuoRetain(outputVariables);
100  VuoRelease(outputVariables);
101  }
102 
103  return js;
104 }
105 
111 {
113 }
114 
121  const VuoDictionary_VuoText_VuoReal variablesAndValues)
122 {
123  if (! expressionList.parser)
125 
126  return VuoMathExpressionParser_calculate(expressionList.parser, variablesAndValues);
127 }