Vuo  2.4.0
VuoParity.c
Go to the documentation of this file.
1
10#include "type.h"
11#include "VuoParity.h"
12#include "VuoList_VuoParity.h"
13
15#ifdef VUO_COMPILER
17 "title" : "Parity",
18 "description" : "Whether to include an error detection bit, and how to use it.",
19 "keywords" : [ ],
20 "version" : "1.0.0",
21 "dependencies" : [
22 "VuoList_VuoParity"
23 ]
24 });
25#endif
27
36{
37 const char *valueAsString = "";
38 if (json_object_get_type(js) == json_type_string)
39 valueAsString = json_object_get_string(js);
40
41 VuoParity value = VuoParity_None;
42
43 if (strcmp(valueAsString, "even") == 0)
44 value = VuoParity_Even;
45 else if (strcmp(valueAsString, "odd") == 0)
46 value = VuoParity_Odd;
47
48 return value;
49}
50
55{
56 char *valueAsString = "none";
57
58 if (value == VuoParity_Even)
59 valueAsString = "even";
60 else if (value == VuoParity_Odd)
61 valueAsString = "odd";
62
63 return json_object_new_string(valueAsString);
64}
65
70{
72 VuoListAppendValue_VuoParity(l, VuoParity_None);
73 VuoListAppendValue_VuoParity(l, VuoParity_Even);
74 VuoListAppendValue_VuoParity(l, VuoParity_Odd);
75 return l;
76}
77
82{
83 char *valueAsString = "None";
84
85 if (value == VuoParity_Even)
86 valueAsString = "Even";
87 else if (value == VuoParity_Odd)
88 valueAsString = "Odd";
89
90 return strdup(valueAsString);
91}
92
96bool VuoParity_areEqual(const VuoParity valueA, const VuoParity valueB)
97{
98 return valueA == valueB;
99}
100
104bool VuoParity_isLessThan(const VuoParity valueA, const VuoParity valueB)
105{
106 return valueA < valueB;
107}
108