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);
49 Enum handleEnum(Enum en);
50 vector<Enum> handleEnumArray(vector<Enum> vecEn);
51 vector<Enum> handleEnumList(vector<Enum> vecEn);
52 Enum handleEnumComplex(Enum en, int i, char c);
53 vector<Enum> handleEnumComplex2(vector<Enum> en, int i, char c);
56 Struct handleStruct(Struct str);
57 vector<Struct> handleStructArray(vector<Struct> vecStr);
58 vector<Struct> handleStructList(vector<Struct> vecStr);
59 Struct handleStructComplex(int in, char c, Struct str);
60 vector<Struct> handleStructComplex2(int in, char c, vector<Struct> vecStr);
62 vector<Enum> handleEnumStruct(vector<Enum> en, vector<Struct> str, char c);
63 vector<Enum> handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb);
67 void setB(float _float);
68 void setC(string _string);
69 string sumArray(vector<string> newA);
70 int setAndGetA(int newA);
71 int setACAndGetA(string newC, int newA);
77 vector<CallBackInterfaceWithCallBack*> cbvec;
81 TestClass::TestClass() {
86 // cbvec doesn't need to be initialized again
90 TestClass::TestClass(int _int, float _float, string _string) {
95 // cbvec doesn't need to be initialized again
99 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
101 cbvec.push_back(_cb);
102 cout << "Registering callback object!" << endl;
106 void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
108 for (CallBackInterfaceWithCallBack* cb : _cb) {
110 cout << "Registering callback object in array!" << endl;
115 void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
117 for (CallBackInterfaceWithCallBack* cb : _cb) {
119 cout << "Registering callback object in list!" << endl;
124 void TestClass::registerCallbackComplex(int in, vector<CallBackInterfaceWithCallBack*> _cb, double db) {
126 for (CallBackInterfaceWithCallBack* cb : _cb) {
128 cout << "Registering callback object in list!" << endl;
131 cout << "Integer: " << in << endl;
132 cout << "Double: " << db << endl;
136 int TestClass::callBack() {
139 for (CallBackInterfaceWithCallBack* cb : cbvec) {
140 sum = sum + cb->printInt();
148 char TestClass::getByte(char in) {
154 short TestClass::getShort(short in) {
160 int64_t TestClass::getLong(int64_t in) {
166 float TestClass::getFloat(float in) {
172 double TestClass::getDouble(double in) {
178 bool TestClass::getBoolean(bool in) {
184 char TestClass::getChar(char in) {
191 vector<char> TestClass::getByteArray(vector<char> in) {
197 vector<short> TestClass::getShortArray(vector<short> in) {
203 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
209 vector<float> TestClass::getFloatArray(vector<float> in) {
215 vector<double> TestClass::getDoubleArray(vector<double> in) {
221 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
227 vector<char> TestClass::getCharArray(vector<char> in) {
233 vector<char> TestClass::getByteList(vector<char> in) {
239 vector<short> TestClass::getShortList(vector<short> in) {
245 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
251 vector<float> TestClass::getFloatList(vector<float> in) {
257 vector<double> TestClass::getDoubleList(vector<double> in) {
263 vector<bool> TestClass::getBooleanList(vector<bool> in) {
269 vector<char> TestClass::getCharList(vector<char> in) {
275 int TestClass::getA() {
281 void TestClass::setA(int _int) {
287 void TestClass::setB(float _float) {
293 void TestClass::setC(string _string) {
300 Enum TestClass::handleEnum(Enum en) {
302 cout << "Enum: " << en << endl;
308 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
310 for (Enum en : vecEn) {
311 cout << "Enum: " << en << endl;
318 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
320 for (Enum en : vecEn) {
321 cout << "Enum: " << en << endl;
328 Enum TestClass::handleEnumComplex(Enum en, int i, char c) {
330 cout << "Enum: " << en << endl;
331 cout << "Integer: " << i << endl;
332 cout << "Char: " << c << endl;
338 vector<Enum> TestClass::handleEnumComplex2(vector<Enum> vecEn, int in, char c) {
340 for (Enum en : vecEn) {
341 cout << "Enum: " << en << endl;
343 cout << "Integer: " << in << endl;
344 cout << "Char: " << c << endl;
352 Struct TestClass::handleStruct(Struct str) {
354 cout << "Name: " << str.name << endl;
355 cout << "Value: " << str.value << endl;
356 cout << "Year: " << str.year << endl;
359 test.name = "Anonymous";
368 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
370 for (Struct str : vecStr) {
372 cout << "Name: " << str.name << endl;
373 cout << "Value: " << str.value << endl;
374 cout << "Year: " << str.year << endl;
377 test.name = "Anonymous";
380 vecStr.push_back(test);
386 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
388 for (Struct str : vecStr) {
390 cout << "Name: " << str.name << endl;
391 cout << "Value: " << str.value << endl;
392 cout << "Year: " << str.year << endl;
395 test.name = "Trimananda";
398 vecStr.push_back(test);
404 Struct TestClass::handleStructComplex(int in, char c, Struct str) {
406 cout << "Name: " << str.name << endl;
407 cout << "Value: " << str.value << endl;
408 cout << "Year: " << str.year << endl;
410 cout << "Integer: " << in << endl;
411 cout << "Char: " << c << endl;
414 test.name = "Anonymous";
423 vector<Struct> TestClass::handleStructComplex2(int in, char c, vector<Struct> vecStr) {
425 for (Struct str : vecStr) {
426 cout << "Name: " << str.name << endl;
427 cout << "Value: " << str.value << endl;
428 cout << "Year: " << str.year << endl;
431 cout << "Integer: " << in << endl;
432 cout << "Char: " << c << endl;
438 vector<Enum> TestClass::handleEnumStruct(vector<Enum> en, vector<Struct> str, char c) {
440 for (Struct st : str) {
441 cout << "Name: " << st.name << endl;
442 cout << "Value: " << st.value << endl;
443 cout << "Year: " << st.year << endl;
446 cout << "Char: " << c << endl;
452 vector<Enum> TestClass::handleAll(vector<Enum> en, vector<Struct> str, char c, vector<CallBackInterfaceWithCallBack*> _cb) {
454 for (CallBackInterfaceWithCallBack* cb : _cb) {
456 cout << "Registering callback object in array!" << endl;
459 for (Struct st : str) {
460 cout << "Name: " << st.name << endl;
461 cout << "Value: " << st.value << endl;
462 cout << "Year: " << st.year << endl;
465 cout << "Char: " << c << endl;
471 string TestClass::sumArray(vector<string> newA) {
474 int len = newA.size();
475 for(int c = 0; c < len; c++) {
482 int TestClass::setAndGetA(int newA) {
489 int TestClass::setACAndGetA(string newC, int newA) {