1 #ifndef _TESTCLASS_HPP__
2 #define _TESTCLASS_HPP__
7 #include "TestClassInterface.hpp"
8 #include "CallBackInterfaceWithCallBack.hpp"
12 class TestClass : public TestClassInterface {
15 TestClass(int _int, float _float, string _string);
17 char getByte(char in);
18 short getShort(short in);
19 int64_t getLong(int64_t in);
20 float getFloat(float in);
21 double getDouble(double in);
22 bool getBoolean(bool in);
23 char getChar(char in);
25 vector<char> getByteArray(vector<char> in);
26 vector<short> getShortArray(vector<short> in);
27 vector<int64_t> getLongArray(vector<int64_t> in);
28 vector<float> getFloatArray(vector<float> in);
29 vector<double> getDoubleArray(vector<double> in);
30 vector<bool> getBooleanArray(vector<bool> in);
31 vector<char> getCharArray(vector<char> in);
33 vector<char> getByteList(vector<char> in);
34 vector<short> getShortList(vector<short> in);
35 vector<int64_t> getLongList(vector<int64_t> in);
36 vector<float> getFloatList(vector<float> in);
37 vector<double> getDoubleList(vector<double> in);
38 vector<bool> getBooleanList(vector<bool> in);
39 vector<char> getCharList(vector<char> in);
42 void registerCallback(CallBackInterfaceWithCallBack* _cb);
43 void registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb);
44 void registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb);
48 Enum handleEnum(Enum en);
49 vector<Enum> handleEnumArray(vector<Enum> vecEn);
50 vector<Enum> handleEnumList(vector<Enum> vecEn);
51 Enum handleEnumComplex(Enum en, int i, char c);
52 vector<Enum> handleEnumComplex2(vector<Enum> en, int i, char c);
55 Struct handleStruct(Struct str);
56 vector<Struct> handleStructArray(vector<Struct> vecStr);
57 vector<Struct> handleStructList(vector<Struct> vecStr);
58 Struct handleStructComplex(int in, char c, Struct str);
59 vector<Struct> handleStructComplex2(int in, char c, vector<Struct> vecStr);
63 void setB(float _float);
64 void setC(string _string);
65 string sumArray(vector<string> newA);
66 int setAndGetA(int newA);
67 int setACAndGetA(string newC, int newA);
73 vector<CallBackInterfaceWithCallBack*> cbvec;
77 TestClass::TestClass() {
82 // cbvec doesn't need to be initialized again
86 TestClass::TestClass(int _int, float _float, string _string) {
91 // cbvec doesn't need to be initialized again
95 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
98 cout << "Registering callback object!" << endl;
102 void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
104 for (CallBackInterfaceWithCallBack* cb : _cb) {
106 cout << "Registering callback object in array!" << endl;
111 void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
113 for (CallBackInterfaceWithCallBack* cb : _cb) {
115 cout << "Registering callback object in list!" << endl;
120 int TestClass::callBack() {
123 for (CallBackInterfaceWithCallBack* cb : cbvec) {
124 sum = sum + cb->printInt();
132 char TestClass::getByte(char in) {
138 short TestClass::getShort(short in) {
144 int64_t TestClass::getLong(int64_t in) {
150 float TestClass::getFloat(float in) {
156 double TestClass::getDouble(double in) {
162 bool TestClass::getBoolean(bool in) {
168 char TestClass::getChar(char in) {
175 vector<char> TestClass::getByteArray(vector<char> in) {
181 vector<short> TestClass::getShortArray(vector<short> in) {
187 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
193 vector<float> TestClass::getFloatArray(vector<float> in) {
199 vector<double> TestClass::getDoubleArray(vector<double> in) {
205 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
211 vector<char> TestClass::getCharArray(vector<char> in) {
217 vector<char> TestClass::getByteList(vector<char> in) {
223 vector<short> TestClass::getShortList(vector<short> in) {
229 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
235 vector<float> TestClass::getFloatList(vector<float> in) {
241 vector<double> TestClass::getDoubleList(vector<double> in) {
247 vector<bool> TestClass::getBooleanList(vector<bool> in) {
253 vector<char> TestClass::getCharList(vector<char> in) {
259 int TestClass::getA() {
265 void TestClass::setA(int _int) {
271 void TestClass::setB(float _float) {
277 void TestClass::setC(string _string) {
284 Enum TestClass::handleEnum(Enum en) {
286 cout << "Enum: " << en << endl;
292 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
294 for (Enum en : vecEn) {
295 cout << "Enum: " << en << endl;
302 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
304 for (Enum en : vecEn) {
305 cout << "Enum: " << en << endl;
312 Enum TestClass::handleEnumComplex(Enum en, int i, char c) {
314 cout << "Enum: " << en << endl;
315 cout << "Integer: " << i << endl;
316 cout << "Char: " << c << endl;
322 vector<Enum> TestClass::handleEnumComplex2(vector<Enum> vecEn, int in, char c) {
324 for (Enum en : vecEn) {
325 cout << "Enum: " << en << endl;
327 cout << "Integer: " << in << endl;
328 cout << "Char: " << c << endl;
336 Struct TestClass::handleStruct(Struct str) {
338 cout << "Name: " << str.name << endl;
339 cout << "Value: " << str.value << endl;
340 cout << "Year: " << str.year << endl;
343 test.name = "Anonymous";
352 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
354 for (Struct str : vecStr) {
356 cout << "Name: " << str.name << endl;
357 cout << "Value: " << str.value << endl;
358 cout << "Year: " << str.year << endl;
361 test.name = "Anonymous";
364 vecStr.push_back(test);
370 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
372 for (Struct str : vecStr) {
374 cout << "Name: " << str.name << endl;
375 cout << "Value: " << str.value << endl;
376 cout << "Year: " << str.year << endl;
379 test.name = "Trimananda";
382 vecStr.push_back(test);
388 Struct TestClass::handleStructComplex(int in, char c, Struct str) {
390 cout << "Name: " << str.name << endl;
391 cout << "Value: " << str.value << endl;
392 cout << "Year: " << str.year << endl;
394 cout << "Integer: " << in << endl;
395 cout << "Char: " << c << endl;
398 test.name = "Anonymous";
407 vector<Struct> TestClass::handleStructComplex2(int in, char c, vector<Struct> vecStr) {
409 for (Struct str : vecStr) {
410 cout << "Name: " << str.name << endl;
411 cout << "Value: " << str.value << endl;
412 cout << "Year: " << str.year << endl;
415 cout << "Integer: " << in << endl;
416 cout << "Char: " << c << endl;
422 string TestClass::sumArray(vector<string> newA) {
425 int len = newA.size();
426 for(int c = 0; c < len; c++) {
433 int TestClass::setAndGetA(int newA) {
440 int TestClass::setACAndGetA(string newC, int newA) {