1 #ifndef _TESTCLASS_HPP__
2 #define _TESTCLASS_HPP__
7 #include "TestClassInterface.hpp"
8 #include "CallBackInterfaceWithCallBack.hpp"
14 class TestClass : public TestClassInterface {
17 TestClass(int _int, float _float, string _string);
19 char getByte(char in);
20 short getShort(short in);
21 int64_t getLong(int64_t in);
22 float getFloat(float in);
23 double getDouble(double in);
24 bool getBoolean(bool in);
25 char getChar(char in);
27 vector<char> getByteArray(vector<char> in);
28 vector<short> getShortArray(vector<short> in);
29 vector<int64_t> getLongArray(vector<int64_t> in);
30 vector<float> getFloatArray(vector<float> in);
31 vector<double> getDoubleArray(vector<double> in);
32 vector<bool> getBooleanArray(vector<bool> in);
33 vector<char> getCharArray(vector<char> in);
35 vector<char> getByteList(vector<char> in);
36 vector<short> getShortList(vector<short> in);
37 vector<int64_t> getLongList(vector<int64_t> in);
38 vector<float> getFloatList(vector<float> in);
39 vector<double> getDoubleList(vector<double> in);
40 vector<bool> getBooleanList(vector<bool> in);
41 vector<char> getCharList(vector<char> in);
44 void registerCallback(CallBackInterfaceWithCallBack* _cb);
45 void registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb);
46 void registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb);
47 void registerCallbackComplex(int in, vector<CallBackInterfaceWithCallBack*> _cb, double db);
49 vector<Enum> handleCallbackEnum(vector<Enum> en, char c, vector<CallBackInterfaceWithCallBack*> _cb);
52 Enum handleEnum(Enum en);
53 vector<Enum> handleEnumArray(vector<Enum> vecEn);
54 vector<Enum> handleEnumList(vector<Enum> vecEn);
55 Enum handleEnumComplex(Enum en, int i, char c);
56 vector<Enum> handleEnumComplex2(vector<Enum> en, int i, char c);
57 vector<Enum> handleEnumTwo(vector<Enum> en1, vector<Enum> en2);
58 vector<Enum> handleEnumThree(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2);
61 Struct handleStruct(Struct str);
62 vector<Struct> handleStructArray(vector<Struct> vecStr);
63 vector<Struct> handleStructList(vector<Struct> vecStr);
64 Struct handleStructComplex(int in, char c, Struct str);
65 vector<Struct> handleStructComplex2(int in, char c, vector<Struct> vecStr);
66 vector<Struct> handleStructTwo(vector<Struct> str1, vector<Struct> str2);
67 vector<Struct> handleStructThree(vector<Struct> str1, vector<Struct> str2, vector<Struct> str3);
69 vector<Enum> handleEnumStruct(vector<Enum> en, vector<Struct> str, char c);
70 vector<Enum> handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb);
71 vector<Enum> handleAllTwo(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2, char c,
72 vector<CallBackInterfaceWithCallBack*> _cb1, vector<CallBackInterfaceWithCallBack*> _cb2);
76 void setB(float _float);
77 void setC(string _string);
78 string sumArray(vector<string> newA);
79 int setAndGetA(int newA);
80 int setACAndGetA(string newC, int newA);
86 vector<CallBackInterfaceWithCallBack*> cbvec;
90 TestClass::TestClass() {
95 // cbvec doesn't need to be initialized again
99 TestClass::TestClass(int _int, float _float, string _string) {
104 // cbvec doesn't need to be initialized again
108 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
110 cbvec.push_back(_cb);
111 cout << "Registering callback object!" << endl;
115 void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
117 for (CallBackInterfaceWithCallBack* cb : _cb) {
119 cout << "Registering callback object in array!" << endl;
124 void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
126 for (CallBackInterfaceWithCallBack* cb : _cb) {
128 cout << "Registering callback object in list!" << endl;
133 void TestClass::registerCallbackComplex(int in, vector<CallBackInterfaceWithCallBack*> _cb, double db) {
135 for (CallBackInterfaceWithCallBack* cb : _cb) {
137 cout << "Registering callback object in list!" << endl;
140 cout << "Integer: " << in << endl;
141 cout << "Double: " << db << endl;
145 int TestClass::callBack() {
148 for (CallBackInterfaceWithCallBack* cb : cbvec) {
149 cb->needCallback(this);
150 sum = sum + cb->printInt();
158 char TestClass::getByte(char in) {
164 short TestClass::getShort(short in) {
170 int64_t TestClass::getLong(int64_t in) {
176 float TestClass::getFloat(float in) {
182 double TestClass::getDouble(double in) {
188 bool TestClass::getBoolean(bool in) {
194 char TestClass::getChar(char in) {
201 vector<char> TestClass::getByteArray(vector<char> in) {
207 vector<short> TestClass::getShortArray(vector<short> in) {
213 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
219 vector<float> TestClass::getFloatArray(vector<float> in) {
225 vector<double> TestClass::getDoubleArray(vector<double> in) {
231 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
237 vector<char> TestClass::getCharArray(vector<char> in) {
243 vector<char> TestClass::getByteList(vector<char> in) {
249 vector<short> TestClass::getShortList(vector<short> in) {
255 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
261 vector<float> TestClass::getFloatList(vector<float> in) {
267 vector<double> TestClass::getDoubleList(vector<double> in) {
273 vector<bool> TestClass::getBooleanList(vector<bool> in) {
279 vector<char> TestClass::getCharList(vector<char> in) {
285 int TestClass::getA() {
291 void TestClass::setA(int _int) {
297 void TestClass::setB(float _float) {
303 void TestClass::setC(string _string) {
310 Enum TestClass::handleEnum(Enum en) {
312 cout << "Enum: " << en << endl;
318 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
320 for (Enum en : vecEn) {
321 cout << "Enum: " << en << endl;
328 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
330 for (Enum en : vecEn) {
331 cout << "Enum: " << en << endl;
338 Enum TestClass::handleEnumComplex(Enum en, int i, char c) {
340 cout << "Enum: " << en << endl;
341 cout << "Integer: " << i << endl;
342 cout << "Char: " << c << endl;
348 vector<Enum> TestClass::handleEnumComplex2(vector<Enum> vecEn, int in, char c) {
350 for (Enum en : vecEn) {
351 cout << "Enum: " << en << endl;
353 cout << "Integer: " << in << endl;
354 cout << "Char: " << c << endl;
360 vector<Enum> TestClass::handleEnumTwo(vector<Enum> en1, vector<Enum> en2) {
362 for (Enum en : en1) {
363 cout << "Enum1: " << en << endl;
365 for (Enum en : en2) {
366 cout << "Enum2: " << en << endl;
373 vector<Enum> TestClass::handleEnumThree(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2) {
375 for (Enum en : en1) {
376 cout << "Enum1: " << en << endl;
378 for (Enum en : en2) {
379 cout << "Enum2: " << en << endl;
388 Struct TestClass::handleStruct(Struct str) {
390 cout << "Name: " << str.name << endl;
391 cout << "Value: " << str.value << endl;
392 cout << "Year: " << str.year << endl;
395 test.name = "Anonymous";
404 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
406 for (Struct str : vecStr) {
408 cout << "Name: " << str.name << endl;
409 cout << "Value: " << str.value << endl;
410 cout << "Year: " << str.year << endl;
413 test.name = "Anonymous";
416 vecStr.push_back(test);
422 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
424 for (Struct str : vecStr) {
426 cout << "Name: " << str.name << endl;
427 cout << "Value: " << str.value << endl;
428 cout << "Year: " << str.year << endl;
431 test.name = "Trimananda";
434 vecStr.push_back(test);
440 vector<Struct> TestClass::handleStructTwo(vector<Struct> str1, vector<Struct> str2) {
442 for (Struct str : str1) {
444 cout << "Name: " << str.name << endl;
445 cout << "Value: " << str.value << endl;
446 cout << "Year: " << str.year << endl;
453 vector<Struct> TestClass::handleStructThree(vector<Struct> str1, vector<Struct> str2, vector<Struct> str3) {
455 for (Struct str : str1) {
457 cout << "Name: " << str.name << endl;
458 cout << "Value: " << str.value << endl;
459 cout << "Year: " << str.year << endl;
466 Struct TestClass::handleStructComplex(int in, char c, Struct str) {
468 cout << "Name: " << str.name << endl;
469 cout << "Value: " << str.value << endl;
470 cout << "Year: " << str.year << endl;
472 cout << "Integer: " << in << endl;
473 cout << "Char: " << c << endl;
476 test.name = "Anonymous";
485 vector<Struct> TestClass::handleStructComplex2(int in, char c, vector<Struct> vecStr) {
487 for (Struct str : vecStr) {
488 cout << "Name: " << str.name << endl;
489 cout << "Value: " << str.value << endl;
490 cout << "Year: " << str.year << endl;
493 cout << "Integer: " << in << endl;
494 cout << "Char: " << c << endl;
500 vector<Enum> TestClass::handleEnumStruct(vector<Enum> en, vector<Struct> str, char c) {
502 for (Struct st : str) {
503 cout << "Name: " << st.name << endl;
504 cout << "Value: " << st.value << endl;
505 cout << "Year: " << st.year << endl;
508 cout << "Char: " << c << endl;
514 vector<Enum> TestClass::handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb) {
516 for (CallBackInterfaceWithCallBack* cb : _cb) {
518 cout << "Registering callback object in array!" << endl;
521 for (Struct st : str) {
522 cout << "Name: " << st.name << endl;
523 cout << "Value: " << st.value << endl;
524 cout << "Year: " << st.year << endl;
527 cout << "Char: " << c << endl;
533 vector<Enum> TestClass::handleAllTwo(vector<Enum> en1, vector<Enum> en2, vector<Struct> str1, vector<Struct> str2, char c,
534 vector<CallBackInterfaceWithCallBack*> _cb1, vector<CallBackInterfaceWithCallBack*> _cb2) {
536 for (CallBackInterfaceWithCallBack* cb : _cb1) {
538 cout << "Registering callback object in array!" << endl;
541 for (Struct st : str1) {
542 cout << "Name: " << st.name << endl;
543 cout << "Value: " << st.value << endl;
544 cout << "Year: " << st.year << endl;
547 cout << "Char: " << c << endl;
553 vector<Enum> TestClass::handleCallbackEnum(vector<Enum> en, char c, vector<CallBackInterfaceWithCallBack*> _cb) {
555 for (CallBackInterfaceWithCallBack* cb : _cb) {
557 cout << "Registering callback object in array!" << endl;
560 cout << "Char: " << c << endl;
566 string TestClass::sumArray(vector<string> newA) {
569 int len = newA.size();
570 for(int c = 0; c < len; c++) {
577 int TestClass::setAndGetA(int newA) {
584 int TestClass::setACAndGetA(string newC, int newA) {