fe758d728932b5f601a38ae98e193af516c6b69d
[iot2.git] / iotjava / iotrmi / C++ / basics / TestClass.hpp
1 #ifndef _TESTCLASS_HPP__
2 #define _TESTCLASS_HPP__
3
4 #include <iostream>
5 #include <thread>
6 #include <chrono>
7 #include "TestClassInterface.hpp"
8
9 using namespace std;
10
11 class TestClass : public TestClassInterface {
12         public:
13                 TestClass();
14                 TestClass(int _int, float _float, string _string);
15
16                 char                            getByte(char in);
17                 short                           getShort(short in);
18                 int64_t                         getLong(int64_t in);
19                 float                           getFloat(float in);
20                 double                          getDouble(double in);
21                 bool                            getBoolean(bool in);
22                 char                            getChar(char in);
23
24                 vector<char>            getByteArray(vector<char> in);
25                 vector<short>           getShortArray(vector<short> in);
26                 vector<int64_t>         getLongArray(vector<int64_t> in);
27                 vector<float>           getFloatArray(vector<float> in);
28                 vector<double>          getDoubleArray(vector<double> in);
29                 vector<bool>            getBooleanArray(vector<bool> in);
30                 vector<char>            getCharArray(vector<char> in);
31
32                 vector<char>            getByteList(vector<char> in);
33                 vector<short>           getShortList(vector<short> in);
34                 vector<int64_t>         getLongList(vector<int64_t> in);
35                 vector<float>           getFloatList(vector<float> in);
36                 vector<double>          getDoubleList(vector<double> in);
37                 vector<bool>            getBooleanList(vector<bool> in);
38                 vector<char>            getCharList(vector<char> in);
39
40                 int                                     getA();
41                 void                            setA(int _int);
42                 void                            setB(float _float);
43                 void                            setC(string _string);
44                 string                          sumArray(vector<string> newA);
45                 int                                     setAndGetA(int newA);
46                 int                                     setACAndGetA(string newC, int newA);
47
48         private:                
49                 int                                                     intA;
50                 float                                           floatB;
51                 string                                          stringC;
52 };
53
54
55 TestClass::TestClass() {
56
57         intA = 1;
58         floatB = 2;
59         stringC = "345";
60         // cbvec doesn't need to be initialized again
61 }
62
63
64 TestClass::TestClass(int _int, float _float, string _string) {
65
66         intA = _int;
67         floatB = _float;
68         stringC = _string;
69         // cbvec doesn't need to be initialized again
70 }
71
72
73 // Single variables
74 char TestClass::getByte(char in) {
75
76         return in;
77 }
78
79
80 short TestClass::getShort(short in) {
81
82         return in;
83 }
84
85
86 int64_t TestClass::getLong(int64_t in) {
87
88         return in;
89 }
90
91
92 float TestClass::getFloat(float in) {
93
94         return in;
95 }
96
97
98 double TestClass::getDouble(double in) {
99
100         return in;
101 }
102
103
104 bool TestClass::getBoolean(bool in) {
105
106         return in;
107 }
108
109
110 char TestClass::getChar(char in) {
111
112         return in;
113 }
114
115
116 // Arrays
117 vector<char> TestClass::getByteArray(vector<char> in) {
118
119         return in;
120 }
121
122
123 vector<short> TestClass::getShortArray(vector<short> in) {
124
125         return in;
126 }
127
128
129 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
130
131         return in;
132 }
133
134
135 vector<float> TestClass::getFloatArray(vector<float> in) {
136
137         return in;
138 }
139
140
141 vector<double> TestClass::getDoubleArray(vector<double> in) {
142
143         return in;
144 }
145
146
147 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
148
149         return in;
150 }
151
152
153 vector<char> TestClass::getCharArray(vector<char> in) {
154
155         return in;
156 }
157
158 // List
159 vector<char> TestClass::getByteList(vector<char> in) {
160
161         return in;
162 }
163
164
165 vector<short> TestClass::getShortList(vector<short> in) {
166
167         return in;
168 }
169
170
171 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
172
173         return in;
174 }
175
176
177 vector<float> TestClass::getFloatList(vector<float> in) {
178
179         return in;
180 }
181
182
183 vector<double> TestClass::getDoubleList(vector<double> in) {
184
185         return in;
186 }
187
188
189 vector<bool> TestClass::getBooleanList(vector<bool> in) {
190
191         return in;
192 }
193
194
195 vector<char> TestClass::getCharList(vector<char> in) {
196
197         return in;
198 }
199
200
201 int TestClass::getA() {
202
203         return intA;
204 }
205
206
207 void TestClass::setA(int _int) {
208
209         intA = _int;
210 }
211
212
213 void TestClass::setB(float _float) {
214
215         floatB = _float;
216 }
217
218
219 void TestClass::setC(string _string) {
220
221         stringC = _string;
222 }
223
224
225 string TestClass::sumArray(vector<string> newA) {
226
227         string sum = "";
228         int len = newA.size();
229         for(int c = 0; c < len; c++) {
230                 sum = sum + newA[c];
231         }
232         return sum;
233 }
234
235
236 int TestClass::setAndGetA(int newA) {
237
238         intA = newA;
239         return intA;
240 }
241
242
243 int TestClass::setACAndGetA(string newC, int newA) {
244
245         stringC = newC;
246         intA = newA;
247         return intA;
248 }
249
250 #endif
251