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);
45 void registerCallbackComplex(int in, vector<CallBackInterfaceWithCallBack*> _cb, double db);
47 vector<Enum> handleCallbackEnum(vector<Enum> en, char c, vector<CallBackInterfaceWithCallBack*> _cb);
50 Enum handleEnum(Enum en);
51 vector<Enum> handleEnumArray(vector<Enum> vecEn);
52 vector<Enum> handleEnumList(vector<Enum> vecEn);
53 Enum handleEnumComplex(Enum en, int i, char c);
54 vector<Enum> handleEnumComplex2(vector<Enum> en, int i, char c);
55 vector<Enum> handleEnumTwo(vector<Enum> en1, vector<Enum> en2);
56 vector<Enum> handleEnumThree(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2);
59 Struct handleStruct(Struct str);
60 vector<Struct> handleStructArray(vector<Struct> vecStr);
61 vector<Struct> handleStructList(vector<Struct> vecStr);
62 Struct handleStructComplex(int in, char c, Struct str);
63 vector<Struct> handleStructComplex2(int in, char c, vector<Struct> vecStr);
64 vector<Struct> handleStructTwo(vector<Struct> str1, vector<Struct> str2);
65 vector<Struct> handleStructThree(vector<Struct> str1, vector<Struct> str2, vector<Struct> str3);
67 vector<Enum> handleEnumStruct(vector<Enum> en, vector<Struct> str, char c);
68 vector<Enum> handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb);
69 vector<Enum> handleAllTwo(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2, char c,
70 vector<CallBackInterfaceWithCallBack*> _cb1, vector<CallBackInterfaceWithCallBack*> _cb2);
74 void setB(float _float);
75 void setC(string _string);
76 string sumArray(vector<string> newA);
77 int setAndGetA(int newA);
78 int setACAndGetA(string newC, int newA);
84 vector<CallBackInterfaceWithCallBack*> cbvec;
88 TestClass::TestClass() {
93 // cbvec doesn't need to be initialized again
97 TestClass::TestClass(int _int, float _float, string _string) {
102 // cbvec doesn't need to be initialized again
106 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
108 cbvec.push_back(_cb);
109 cout << "Registering callback object!" << endl;
113 void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
115 for (CallBackInterfaceWithCallBack* cb : _cb) {
117 cout << "Registering callback object in array!" << endl;
122 void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
124 for (CallBackInterfaceWithCallBack* cb : _cb) {
126 cout << "Registering callback object in list!" << endl;
131 void TestClass::registerCallbackComplex(int in, vector<CallBackInterfaceWithCallBack*> _cb, double db) {
133 for (CallBackInterfaceWithCallBack* cb : _cb) {
135 cout << "Registering callback object in list!" << endl;
138 cout << "Integer: " << in << endl;
139 cout << "Double: " << db << endl;
143 int TestClass::callBack() {
146 for (CallBackInterfaceWithCallBack* cb : cbvec) {
147 sum = sum + cb->printInt();
155 char TestClass::getByte(char in) {
161 short TestClass::getShort(short in) {
167 int64_t TestClass::getLong(int64_t in) {
173 float TestClass::getFloat(float in) {
179 double TestClass::getDouble(double in) {
185 bool TestClass::getBoolean(bool in) {
191 char TestClass::getChar(char in) {
198 vector<char> TestClass::getByteArray(vector<char> in) {
204 vector<short> TestClass::getShortArray(vector<short> in) {
210 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
216 vector<float> TestClass::getFloatArray(vector<float> in) {
222 vector<double> TestClass::getDoubleArray(vector<double> in) {
228 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
234 vector<char> TestClass::getCharArray(vector<char> in) {
240 vector<char> TestClass::getByteList(vector<char> in) {
246 vector<short> TestClass::getShortList(vector<short> in) {
252 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
258 vector<float> TestClass::getFloatList(vector<float> in) {
264 vector<double> TestClass::getDoubleList(vector<double> in) {
270 vector<bool> TestClass::getBooleanList(vector<bool> in) {
276 vector<char> TestClass::getCharList(vector<char> in) {
282 int TestClass::getA() {
288 void TestClass::setA(int _int) {
294 void TestClass::setB(float _float) {
300 void TestClass::setC(string _string) {
307 Enum TestClass::handleEnum(Enum en) {
309 cout << "Enum: " << en << endl;
315 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
317 for (Enum en : vecEn) {
318 cout << "Enum: " << en << endl;
325 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
327 for (Enum en : vecEn) {
328 cout << "Enum: " << en << endl;
335 Enum TestClass::handleEnumComplex(Enum en, int i, char c) {
337 cout << "Enum: " << en << endl;
338 cout << "Integer: " << i << endl;
339 cout << "Char: " << c << endl;
345 vector<Enum> TestClass::handleEnumComplex2(vector<Enum> vecEn, int in, char c) {
347 for (Enum en : vecEn) {
348 cout << "Enum: " << en << endl;
350 cout << "Integer: " << in << endl;
351 cout << "Char: " << c << endl;
357 vector<Enum> TestClass::handleEnumTwo(vector<Enum> en1, vector<Enum> en2) {
359 for (Enum en : en1) {
360 cout << "Enum1: " << en << endl;
362 for (Enum en : en2) {
363 cout << "Enum2: " << en << endl;
370 vector<Enum> TestClass::handleEnumThree(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2) {
372 for (Enum en : en1) {
373 cout << "Enum1: " << en << endl;
375 for (Enum en : en2) {
376 cout << "Enum2: " << en << endl;
385 Struct TestClass::handleStruct(Struct str) {
387 cout << "Name: " << str.name << endl;
388 cout << "Value: " << str.value << endl;
389 cout << "Year: " << str.year << endl;
392 test.name = "Anonymous";
401 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
403 for (Struct str : vecStr) {
405 cout << "Name: " << str.name << endl;
406 cout << "Value: " << str.value << endl;
407 cout << "Year: " << str.year << endl;
410 test.name = "Anonymous";
413 vecStr.push_back(test);
419 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
421 for (Struct str : vecStr) {
423 cout << "Name: " << str.name << endl;
424 cout << "Value: " << str.value << endl;
425 cout << "Year: " << str.year << endl;
428 test.name = "Trimananda";
431 vecStr.push_back(test);
437 vector<Struct> TestClass::handleStructTwo(vector<Struct> str1, vector<Struct> str2) {
439 for (Struct str : str1) {
441 cout << "Name: " << str.name << endl;
442 cout << "Value: " << str.value << endl;
443 cout << "Year: " << str.year << endl;
450 vector<Struct> TestClass::handleStructThree(vector<Struct> str1, vector<Struct> str2, vector<Struct> str3) {
452 for (Struct str : str1) {
454 cout << "Name: " << str.name << endl;
455 cout << "Value: " << str.value << endl;
456 cout << "Year: " << str.year << endl;
463 Struct TestClass::handleStructComplex(int in, char c, Struct str) {
465 cout << "Name: " << str.name << endl;
466 cout << "Value: " << str.value << endl;
467 cout << "Year: " << str.year << endl;
469 cout << "Integer: " << in << endl;
470 cout << "Char: " << c << endl;
473 test.name = "Anonymous";
482 vector<Struct> TestClass::handleStructComplex2(int in, char c, vector<Struct> vecStr) {
484 for (Struct str : vecStr) {
485 cout << "Name: " << str.name << endl;
486 cout << "Value: " << str.value << endl;
487 cout << "Year: " << str.year << endl;
490 cout << "Integer: " << in << endl;
491 cout << "Char: " << c << endl;
497 vector<Enum> TestClass::handleEnumStruct(vector<Enum> en, vector<Struct> str, char c) {
499 for (Struct st : str) {
500 cout << "Name: " << st.name << endl;
501 cout << "Value: " << st.value << endl;
502 cout << "Year: " << st.year << endl;
505 cout << "Char: " << c << endl;
511 vector<Enum> TestClass::handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb) {
513 for (CallBackInterfaceWithCallBack* cb : _cb) {
515 cout << "Registering callback object in array!" << endl;
518 for (Struct st : str) {
519 cout << "Name: " << st.name << endl;
520 cout << "Value: " << st.value << endl;
521 cout << "Year: " << st.year << endl;
524 cout << "Char: " << c << endl;
530 vector<Enum> TestClass::handleAllTwo(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2, char c,
531 vector<CallBackInterfaceWithCallBack*> _cb1, vector<CallBackInterfaceWithCallBack*> _cb2) {
533 for (CallBackInterfaceWithCallBack* cb : _cb1) {
535 cout << "Registering callback object in array!" << endl;
538 for (Struct st : str1) {
539 cout << "Name: " << st.name << endl;
540 cout << "Value: " << st.value << endl;
541 cout << "Year: " << st.year << endl;
544 cout << "Char: " << c << endl;
550 vector<Enum> TestClass::handleCallbackEnum(vector<Enum> en, char c, vector<CallBackInterfaceWithCallBack*> _cb) {
552 for (CallBackInterfaceWithCallBack* cb : _cb) {
554 cout << "Registering callback object in array!" << endl;
557 cout << "Char: " << c << endl;
563 string TestClass::sumArray(vector<string> newA) {
566 int len = newA.size();
567 for(int c = 0; c < len; c++) {
574 int TestClass::setAndGetA(int newA) {
581 int TestClass::setACAndGetA(string newC, int newA) {