Vuo  2.4.0
VuoLeapPointableType.c
Go to the documentation of this file.
1
10#include "type.h"
13
15#ifdef VUO_COMPILER
17 "title" : "Leap Pointable Type",
18 "description" : "Whether a pointable is a finger or a tool.",
19 "keywords" : [ "leap", "pointable" ],
20 "version" : "1.0.0",
21 "dependencies" : [
22 "VuoList_VuoLeapPointableType"
23 ]
24 });
25#endif
27
33{
34 const char *valueAsString = "";
35 if (json_object_get_type(js) == json_type_string)
36 valueAsString = json_object_get_string(js);
37
38 VuoLeapPointableType value = VuoLeapPointableType_Finger;
39
40 if( !strcmp(valueAsString, "tool") )
41 value = VuoLeapPointableType_Tool;
42 else
43 value = VuoLeapPointableType_Finger;
44
45 return value;
46}
47
53{
54 char *valueAsString = "";
55
56 switch (value)
57 {
58 case VuoLeapPointableType_Finger:
59 valueAsString = "finger";
60 break;
61
62 case VuoLeapPointableType_Tool:
63 valueAsString = "tool";
64 break;
65 }
66 return json_object_new_string(valueAsString);
67}
68
73{
75 VuoListAppendValue_VuoLeapPointableType(l, VuoLeapPointableType_Finger);
76 VuoListAppendValue_VuoLeapPointableType(l, VuoLeapPointableType_Tool);
77 return l;
78}
79
85{
86 char *valueAsString = "";
87
88 switch (value)
89 {
90 case VuoLeapPointableType_Finger:
91 valueAsString = "Finger";
92 break;
93 case VuoLeapPointableType_Tool:
94 valueAsString = "Tool";
95 break;
96 }
97 return strdup(valueAsString);
98}