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 registerCallback(vector<CallBackInterfaceWithCallBack*> _cb);
47 Enum handleEnum(Enum en);
48 vector<Enum> handleEnumArray(vector<Enum> vecEn);
49 vector<Enum> handleEnumList(vector<Enum> vecEn);
52 Struct handleStruct(Struct str);
53 vector<Struct> handleStructArray(vector<Struct> vecStr);
54 vector<Struct> handleStructList(vector<Struct> vecStr);
58 void setB(float _float);
59 void setC(string _string);
60 string sumArray(vector<string> newA);
61 int setAndGetA(int newA);
62 int setACAndGetA(string newC, int newA);
68 vector<CallBackInterfaceWithCallBack*> cbvec;
72 TestClass::TestClass() {
77 // cbvec doesn't need to be initialized again
81 TestClass::TestClass(int _int, float _float, string _string) {
86 // cbvec doesn't need to be initialized again
90 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
93 cout << "Registering callback object!" << endl;
97 /*void TestClass::registerCallback(vector<CallBackInterfaceWithCallBack*> _cb) {
99 for (CallBackInterface* cb : _cb) {
101 cout << "Registering callback object!" << endl;
106 int TestClass::callBack() {
109 for (CallBackInterfaceWithCallBack* cb : cbvec) {
110 sum = sum + cb->printInt();
118 char TestClass::getByte(char in) {
124 short TestClass::getShort(short in) {
130 int64_t TestClass::getLong(int64_t in) {
136 float TestClass::getFloat(float in) {
142 double TestClass::getDouble(double in) {
148 bool TestClass::getBoolean(bool in) {
154 char TestClass::getChar(char in) {
161 vector<char> TestClass::getByteArray(vector<char> in) {
167 vector<short> TestClass::getShortArray(vector<short> in) {
173 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
179 vector<float> TestClass::getFloatArray(vector<float> in) {
185 vector<double> TestClass::getDoubleArray(vector<double> in) {
191 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
197 vector<char> TestClass::getCharArray(vector<char> in) {
203 vector<char> TestClass::getByteList(vector<char> in) {
209 vector<short> TestClass::getShortList(vector<short> in) {
215 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
221 vector<float> TestClass::getFloatList(vector<float> in) {
227 vector<double> TestClass::getDoubleList(vector<double> in) {
233 vector<bool> TestClass::getBooleanList(vector<bool> in) {
239 vector<char> TestClass::getCharList(vector<char> in) {
245 int TestClass::getA() {
251 void TestClass::setA(int _int) {
257 void TestClass::setB(float _float) {
263 void TestClass::setC(string _string) {
270 Enum TestClass::handleEnum(Enum en) {
272 cout << "Enum: " << en << endl;
278 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
280 for (Enum en : vecEn) {
281 cout << "Enum: " << en << endl;
288 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
290 for (Enum en : vecEn) {
291 cout << "Enum: " << en << endl;
299 Struct TestClass::handleStruct(Struct str) {
301 cout << "Name: " << str.name << endl;
302 cout << "Value: " << str.value << endl;
303 cout << "Year: " << str.year << endl;
306 test.name = "Anonymous";
315 vector<Struct> TestClass::handleStructArray(vector<Struct> vecStr) {
317 for (Struct str : vecStr) {
319 cout << "Name: " << str.name << endl;
320 cout << "Value: " << str.value << endl;
321 cout << "Year: " << str.year << endl;
324 test.name = "Anonymous";
327 vecStr.push_back(test);
333 vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
335 for (Struct str : vecStr) {
337 cout << "Name: " << str.name << endl;
338 cout << "Value: " << str.value << endl;
339 cout << "Year: " << str.year << endl;
342 test.name = "Trimananda";
345 vecStr.push_back(test);
351 string TestClass::sumArray(vector<string> newA) {
354 int len = newA.size();
355 for(int c = 0; c < len; c++) {
362 int TestClass::setAndGetA(int newA) {
369 int TestClass::setACAndGetA(string newC, int newA) {