Vuo
2.4.4
Loading...
Searching...
No Matches
type
VuoMathExpression.c
Go to the documentation of this file.
1
10
#include <string.h>
11
12
#include "
VuoMathExpression.h
"
13
15
#ifdef VUO_COMPILER
16
VuoModuleMetadata
({
17
"title"
:
"Math Expression"
,
18
"description"
:
"A mathematical expression that can be used for calculations."
,
19
"keywords"
: [ ],
20
"version"
:
"1.0.0"
,
21
"dependencies"
: [
22
"c"
,
23
"VuoMathExpressionParser"
24
]
25
});
26
#endif
28
39
VuoMathExpression
VuoMathExpression_makeFromJson
(json_object *js)
40
{
41
VuoMathExpression
me;
42
json_object *o = NULL;
43
44
if
(json_object_object_get_ex(js,
"expression"
, &o))
45
{
46
me.
expression
=
VuoText_makeFromJson
(o);
47
48
VuoMathExpressionError
error = NULL;
49
me.
parser
=
VuoMathExpressionParser_makeFromSingleExpression
(me.
expression
, &error);
50
free(error);
51
}
52
else
53
{
54
me.
expression
=
VuoText_make
(
""
);
55
me.
parser
= NULL;
56
}
57
58
return
me;
59
}
60
76
json_object *
VuoMathExpression_getJson
(
const
VuoMathExpression
me)
77
{
78
json_object *js = json_object_new_object();
79
80
json_object_object_add(js,
"expression"
,
VuoText_getJson
(me.
expression
));
81
82
if
(me.
parser
)
83
{
84
VuoList_VuoText
inputVariables =
VuoMathExpressionParser_getInputVariables
(me.
parser
);
85
json_object_object_add(js,
"inputVariables"
,
VuoList_VuoText_getJson
(inputVariables));
86
VuoRelease
(inputVariables);
87
88
VuoList_VuoText
outputVariables =
VuoMathExpressionParser_getOutputVariables
(me.
parser
);
89
json_object_object_add(js,
"outputVariables"
,
VuoList_VuoText_getJson
(outputVariables));
90
VuoRelease
(outputVariables);
91
}
92
93
return
js;
94
}
95
100
char
*
VuoMathExpression_getSummary
(
const
VuoMathExpression
me)
101
{
102
return
VuoText_getSummary
(me.
expression
);
103
}
Generated on Thu Nov 9 2023 16:59:30 for Vuo by
1.9.8