-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViconDirection.cpp
118 lines (110 loc) · 3.27 KB
/
ViconDirection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* Fabric Core 1.11.4
* Vicon Datastream EDK wrap
*/
#include "ViconDirection.h" // Automatically generated by kl2edk
#include "ViconDirection_functions.h"
#include <Client.h> // Vicon header
#include "conversion.h"
using namespace ViconDataStreamSDK::CPP::Direction;
namespace
{
inline Enum StringToEnum(const char* i_string)
{
if(!strcmp(i_string, "Up"))
return Up;
else if(!strcmp(i_string, "Down"))
return Down;
else if(!strcmp(i_string, "Left"))
return Left;
else if(!strcmp(i_string, "Right"))
return Right;
else if(!strcmp(i_string, "Forward"))
return Forward;
else if(!strcmp(i_string, "Backward"))
return Backward;
else
FABRIC_EXT_SETERROR_AND_RETURN_VALUE(Up, "%s: %s", "Invalid ViconDirection name", i_string);
}
inline Fabric::EDK::KL::String EnumToString(const Enum i_enum)
{
switch(i_enum)
{
case Up:
return "Up";
case Down:
return "Down";
case Left:
return "Left";
case Right:
return "Right";
case Forward:
return "Forward";
case Backward:
return "Backward";
default:
FABRIC_EXT_SETERROR_AND_RETURN_VALUE("", "%s: %i", "Invalid ViconDirection code", int(i_enum));
}
}
}
FABRIC_EXT_EXPORT void ViconDirectionFromString(
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::IOParam this_,
Fabric::EDK::KL::Traits< Fabric::EDK::KL::String >::INParam name
)
{
this_.handle = new Enum(StringToEnum(name.data()));
}
FABRIC_EXT_EXPORT Fabric::EDK::KL::SInt32 ViconDirectionAsCode(
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam this_
)
{
Enum resultEnum;
if (conv_from_KLStruct(this_, resultEnum))
{
return Fabric::EDK::KL::Integer(resultEnum);
} else {
FABRIC_EXT_SETERROR_AND_RETURN_VALUE(0, "%s: %s", "ViconDirectionAsCode", "Invalid ViconDirection");
}
}
FABRIC_EXT_EXPORT void ViconDirectionAsString(
Fabric::EDK::KL::Traits< Fabric::EDK::KL::String >::Result _result,
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam this_
)
{
Enum resultEnum;
if (conv_from_KLStruct(this_, resultEnum))
{
_result = EnumToString(resultEnum);
} else {
_result = "Unknown";
FABRIC_EXT_SETERROR_AND_RETURN("%s: %s", "ViconDirectionAsString", "Invalid ViconDirection");
}
}
FABRIC_EXT_EXPORT Fabric::EDK::KL::Boolean ViconDirectionEqual(
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam a,
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam b
)
{
Enum enumA;
Enum enumB;
if (conv_from_KLStruct(a, enumA) && conv_from_KLStruct(b, enumB))
{
return (enumA == enumB);
} else {
FABRIC_EXT_SETERROR_AND_RETURN_VALUE(false, "%s: %s", "ViconDirectionEqual", "Invalid ViconDirection");
}
}
FABRIC_EXT_EXPORT Fabric::EDK::KL::Boolean ViconDirectionNotEqual(
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam a,
Fabric::EDK::KL::Traits< Fabric::EDK::KL::ViconDirection >::INParam b
)
{
Enum enumA;
Enum enumB;
if (conv_from_KLStruct(a, enumA) && conv_from_KLStruct(b, enumB))
{
return (enumA != enumB);
} else {
FABRIC_EXT_SETERROR_AND_RETURN_VALUE(true, "%s: %s", "ViconDirectionNotEqual", "Invalid ViconDirection");
}
}