Vuo 2.4.4
Loading...
Searching...
No Matches
VuoParity.c
Go to the documentation of this file.
1
10#include "VuoParity.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Parity",
16 "description" : "Whether to include an error detection bit, and how to use it.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoParity"
21 ]
22 });
23#endif
25
34{
35 const char *valueAsString = "";
36 if (json_object_get_type(js) == json_type_string)
37 valueAsString = json_object_get_string(js);
38
39 VuoParity value = VuoParity_None;
40
41 if (strcmp(valueAsString, "even") == 0)
42 value = VuoParity_Even;
43 else if (strcmp(valueAsString, "odd") == 0)
44 value = VuoParity_Odd;
45
46 return value;
47}
48
52json_object *VuoParity_getJson(const VuoParity value)
53{
54 char *valueAsString = "none";
55
56 if (value == VuoParity_Even)
57 valueAsString = "even";
58 else if (value == VuoParity_Odd)
59 valueAsString = "odd";
60
61 return json_object_new_string(valueAsString);
62}
63
75
80{
81 char *valueAsString = "None";
82
83 if (value == VuoParity_Even)
84 valueAsString = "Even";
85 else if (value == VuoParity_Odd)
86 valueAsString = "Odd";
87
88 return strdup(valueAsString);
89}
90
94bool VuoParity_areEqual(const VuoParity valueA, const VuoParity valueB)
95{
96 return valueA == valueB;
97}
98
102bool VuoParity_isLessThan(const VuoParity valueA, const VuoParity valueB)
103{
104 return valueA < valueB;
105}