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);
53 Struct handleStruct(Struct str);
54 vector<Struct> handleStructArray(vector<Struct> vecStr);
55 vector<Struct> handleStructList(vector<Struct> vecStr);
59 void setB(float _float);
60 void setC(string _string);
61 string sumArray(vector<string> newA);
62 int setAndGetA(int newA);
63 int setACAndGetA(string newC, int newA);
69 vector<CallBackInterfaceWithCallBack*> cbvec;
73 TestClass::TestClass() {
78 // cbvec doesn't need to be initialized again
82 TestClass::TestClass(int _int, float _float, string _string) {
87 // cbvec doesn't need to be initialized again
91 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
94 cout << "Registering callback object!" << endl;
98 void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
100 for (CallBackInterfaceWithCallBack* cb : _cb) {
102 cout << "Registering callback object in array!" << endl;
107 void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
109 for (CallBackInterfaceWithCallBack* cb : _cb) {
111 cout << "Registering callback object in list!" << endl;
116 int TestClass::callBack() {
119 for (CallBackInterfaceWithCallBack* cb : cbvec) {
120 sum = sum + cb->printInt();
128 char TestClass::getByte(char in) {
134 short TestClass::getShort(short in) {
140 int64_t TestClass::getLong(int64_t in) {
146 float TestClass::getFloat(float in) {
152 double TestClass::getDouble(double in) {
158 bool TestClass::getBoolean(bool in) {
164 char TestClass::getChar(char in) {
171 vector<char> TestClass::getByteArray(vector<char> in) {
177 vector<short> TestClass::getShortArray(vector<short> in) {
183 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
189 vector<float> TestClass::getFloatArray(vector<float> in) {
195 vector<double> TestClass::getDoubleArray(vector<double> in) {
201 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
207 vector<char> TestClass::getCharArray(vector<char> in) {
213 vector<char> TestClass::getByteList(vector<char> in) {
219 vector<short> TestClass::getShortList(vector<short> in) {
225 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
231 vector<float> TestClass::getFloatList(vector<float> in) {
237 vector<double> TestClass::getDoubleList(vector<double> in) {
243 vector<bool> TestClass::getBooleanList(vector<bool> in) {
249 vector<char> TestClass::getCharList(vector<char> in) {
255 int TestClass::getA() {
261 void TestClass::setA(int _int) {
267 void TestClass::setB(float _float) {
273 void TestClass::setC(string _string) {
280 Enum TestClass::handleEnum(Enum en) {
282 cout << "Enum: " << en << endl;
288 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
290 for (Enum en : vecEn) {
291 cout << "Enum: " << en << endl;
298 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
300 for (Enum en : vecEn) {
301 cout << "Enum: " << en << endl;
309 Struct TestClass::handleStruct(Struct str) {
311 cout << "Name: " << str.name << endl;
312 cout << "Value: " << str.value << endl;
313 cout << "Year: " << str.year << endl;
316 test.name = "Anonymous";
325 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
327 for (Struct str : vecStr) {
329 cout << "Name: " << str.name << endl;
330 cout << "Value: " << str.value << endl;
331 cout << "Year: " << str.year << endl;
334 test.name = "Anonymous";
337 vecStr.push_back(test);
343 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
345 for (Struct str : vecStr) {
347 cout << "Name: " << str.name << endl;
348 cout << "Value: " << str.value << endl;
349 cout << "Year: " << str.year << endl;
352 test.name = "Trimananda";
355 vecStr.push_back(test);
361 string TestClass::sumArray(vector<string> newA) {
364 int len = newA.size();
365 for(int c = 0; c < len; c++) {
372 int TestClass::setAndGetA(int newA) {
379 int TestClass::setACAndGetA(string newC, int newA) {