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);
56 void setB(float _float);
57 void setC(string _string);
58 string sumArray(vector<string> newA);
59 int setAndGetA(int newA);
60 int setACAndGetA(string newC, int newA);
66 vector<CallBackInterfaceWithCallBack*> cbvec;
70 TestClass::TestClass() {
75 // cbvec doesn't need to be initialized again
79 TestClass::TestClass(int _int, float _float, string _string) {
84 // cbvec doesn't need to be initialized again
88 void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
91 cout << "Registering callback object!" << endl;
95 /*void TestClass::registerCallback(vector<CallBackInterfaceWithCallBack*> _cb) {
97 for (CallBackInterface* cb : _cb) {
99 cout << "Registering callback object!" << endl;
104 int TestClass::callBack() {
107 for (CallBackInterfaceWithCallBack* cb : cbvec) {
108 sum = sum + cb->printInt();
116 char TestClass::getByte(char in) {
122 short TestClass::getShort(short in) {
128 int64_t TestClass::getLong(int64_t in) {
134 float TestClass::getFloat(float in) {
140 double TestClass::getDouble(double in) {
146 bool TestClass::getBoolean(bool in) {
152 char TestClass::getChar(char in) {
159 vector<char> TestClass::getByteArray(vector<char> in) {
165 vector<short> TestClass::getShortArray(vector<short> in) {
171 vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
177 vector<float> TestClass::getFloatArray(vector<float> in) {
183 vector<double> TestClass::getDoubleArray(vector<double> in) {
189 vector<bool> TestClass::getBooleanArray(vector<bool> in) {
195 vector<char> TestClass::getCharArray(vector<char> in) {
201 vector<char> TestClass::getByteList(vector<char> in) {
207 vector<short> TestClass::getShortList(vector<short> in) {
213 vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
219 vector<float> TestClass::getFloatList(vector<float> in) {
225 vector<double> TestClass::getDoubleList(vector<double> in) {
231 vector<bool> TestClass::getBooleanList(vector<bool> in) {
237 vector<char> TestClass::getCharList(vector<char> in) {
243 int TestClass::getA() {
249 void TestClass::setA(int _int) {
255 void TestClass::setB(float _float) {
261 void TestClass::setC(string _string) {
268 Enum TestClass::handleEnum(Enum en) {
270 cout << "Enum: " << en << endl;
276 vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
278 for (Enum en : vecEn) {
279 cout << "Enum: " << en << endl;
286 vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
288 for (Enum en : vecEn) {
289 cout << "Enum: " << en << endl;
297 Struct TestClass::handleStruct(Struct str) {
299 cout << "Name: " << str.name << endl;
300 cout << "Value: " << str.value << endl;
301 cout << "Year: " << str.year << endl;
304 test.name = "Anonymous";
313 /*vector<Struct> TestClass::handleStruct(vector<Struct> vecStr) {
315 for (Struct str : vecStr) {
317 cout << "Name: " << str.name << endl;
318 cout << "Value: " << str.value << endl;
319 cout << "Year: " << str.year << endl;
322 test.name = "Anonymous";
325 vecStr.push_back(test);
331 string TestClass::sumArray(vector<string> newA) {
334 int len = newA.size();
335 for(int c = 0; c < len; c++) {
342 int TestClass::setAndGetA(int newA) {
349 int TestClass::setACAndGetA(string newC, int newA) {