1 #ifndef _TESTCLASS_HPP__
2 #define _TESTCLASS_HPP__
5 #include "TestClassInterface.hpp"
10 class TestClass : public TestClassInterface {
13 TestClass(int _int, float _float, string _string);
17 void setB(float _float);
18 void setC(string _string);
19 string sumArray(vector<string> newA);
20 //int64_t sumArray(vector<int> newA);
21 int setAndGetA(int newA);
22 int setACAndGetA(string newC, int newA);
23 void registerCallback(CallBackInterface* _cb);
24 void registerCallback(vector<CallBackInterface*> _cb);
26 void handleStruct(vector<data> vecData);
32 CallBackInterface *cb;
33 vector<CallBackInterface*> cbvec;
38 TestClass::TestClass() {
44 // cbvec doesn't need to be initialized again
48 TestClass::TestClass(int _int, float _float, string _string) {
54 // cbvec doesn't need to be initialized again
58 void TestClass::setA(int _int) {
64 void TestClass::setB(float _float) {
70 void TestClass::setC(string _string) {
76 string TestClass::sumArray(vector<string> newA) {
79 int len = newA.size();
80 for(int c = 0; c < len; c++) {
87 /*int64_t TestClass::sumArray(vector<int> newA) {
90 int len = newA.size();
91 for(int c = 0; c < len; c++) {
98 int TestClass::setAndGetA(int newA) {
105 int TestClass::setACAndGetA(string newC, int newA) {
113 void TestClass::registerCallback(CallBackInterface* _cb) {
119 void TestClass::registerCallback(vector<CallBackInterface*> _cb) {
121 for (CallBackInterface* cb : _cb) {
123 cout << "Registering callback object!" << endl;
128 void TestClass::handleStruct(vector<data> vecData) {
130 for (data dat : vecData) {
132 cout << "Name: " << dat.name << endl;
133 cout << "Value: " << dat.value << endl;
134 cout << "Year: " << dat.year << endl;
139 //int TestClass::callBack() {
140 // return cb.printInt();
144 int TestClass::callBack() {
147 for (CallBackInterface* cb : cbvec) {
148 //cout << "Sum: " << sum << endl;
149 sum = sum + cb->printInt();
152 //CallBackInterface* cb = cbvec[0];
153 //sum = cb->printInt();
154 //sum = sum + cb->printInt();
156 //CallBackInterface* cb1 = cbvec[0];