#include <thread>
#include <chrono>
#include "TestClassInterface.hpp"
+#include "CallBackInterfaceWithCallBack.hpp"
using namespace std;
double getDouble(double in);
bool getBoolean(bool in);
char getChar(char in);
+
+ vector<char> getByteArray(vector<char> in);
+ vector<short> getShortArray(vector<short> in);
+ vector<int64_t> getLongArray(vector<int64_t> in);
+ vector<float> getFloatArray(vector<float> in);
+ vector<double> getDoubleArray(vector<double> in);
+ vector<bool> getBooleanArray(vector<bool> in);
+ vector<char> getCharArray(vector<char> in);
+
+ vector<char> getByteList(vector<char> in);
+ vector<short> getShortList(vector<short> in);
+ vector<int64_t> getLongList(vector<int64_t> in);
+ vector<float> getFloatList(vector<float> in);
+ vector<double> getDoubleList(vector<double> in);
+ vector<bool> getBooleanList(vector<bool> in);
+ vector<char> getCharList(vector<char> in);
+
+ // Callbacks
+ void registerCallback(CallBackInterfaceWithCallBack* _cb);
+ //void registerCallback(vector<CallBackInterfaceWithCallBack*> _cb);
+ int callBack();
+
+ // Enum
+ Enum handleEnum(Enum en);
+ vector<Enum> handleEnumArray(vector<Enum> vecEn);
+ vector<Enum> handleEnumList(vector<Enum> vecEn);
+
+ // Struct
+ Struct handleStruct(Struct str);
+
int getA();
void setA(int _int);
void setB(float _float);
int setACAndGetA(string newC, int newA);
private:
- int intA;
- float floatB;
- string stringC;
+ int intA;
+ float floatB;
+ string stringC;
+ vector<CallBackInterfaceWithCallBack*> cbvec;
};
}
+void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
+
+ cbvec.push_back(_cb);
+ cout << "Registering callback object!" << endl;
+}
+
+
+/*void TestClass::registerCallback(vector<CallBackInterfaceWithCallBack*> _cb) {
+
+ for (CallBackInterface* cb : _cb) {
+ cbvec.push_back(cb);
+ cout << "Registering callback object!" << endl;
+ }
+}*/
+
+
+int TestClass::callBack() {
+
+ int sum = 0;
+ for (CallBackInterfaceWithCallBack* cb : cbvec) {
+ sum = sum + cb->printInt();
+ }
+
+ return sum;
+}
+
+
+// Single variables
char TestClass::getByte(char in) {
return in;
}
+// Arrays
+vector<char> TestClass::getByteArray(vector<char> in) {
+
+ return in;
+}
+
+
+vector<short> TestClass::getShortArray(vector<short> in) {
+
+ return in;
+}
+
+
+vector<int64_t> TestClass::getLongArray(vector<int64_t> in) {
+
+ return in;
+}
+
+
+vector<float> TestClass::getFloatArray(vector<float> in) {
+
+ return in;
+}
+
+
+vector<double> TestClass::getDoubleArray(vector<double> in) {
+
+ return in;
+}
+
+
+vector<bool> TestClass::getBooleanArray(vector<bool> in) {
+
+ return in;
+}
+
+
+vector<char> TestClass::getCharArray(vector<char> in) {
+
+ return in;
+}
+
+// List
+vector<char> TestClass::getByteList(vector<char> in) {
+
+ return in;
+}
+
+
+vector<short> TestClass::getShortList(vector<short> in) {
+
+ return in;
+}
+
+
+vector<int64_t> TestClass::getLongList(vector<int64_t> in) {
+
+ return in;
+}
+
+
+vector<float> TestClass::getFloatList(vector<float> in) {
+
+ return in;
+}
+
+
+vector<double> TestClass::getDoubleList(vector<double> in) {
+
+ return in;
+}
+
+
+vector<bool> TestClass::getBooleanList(vector<bool> in) {
+
+ return in;
+}
+
+
+vector<char> TestClass::getCharList(vector<char> in) {
+
+ return in;
+}
+
+
int TestClass::getA() {
return intA;
}
+// Enum
+Enum TestClass::handleEnum(Enum en) {
+
+ cout << "Enum: " << en << endl;
+
+ return en;
+}
+
+
+vector<Enum> TestClass::handleEnumArray(vector<Enum> vecEn) {
+
+ for (Enum en : vecEn) {
+ cout << "Enum: " << en << endl;
+ }
+
+ return vecEn;
+}
+
+
+vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
+
+ for (Enum en : vecEn) {
+ cout << "Enum: " << en << endl;
+ }
+
+ return vecEn;
+}
+
+
+// Struct
+Struct TestClass::handleStruct(Struct str) {
+
+ cout << "Name: " << str.name << endl;
+ cout << "Value: " << str.value << endl;
+ cout << "Year: " << str.year << endl;
+
+ Struct test;
+ test.name = "Anonymous";
+ test.value = 1.33;
+ test.year = 2016;
+ str = test;
+
+ return str;
+}
+
+
+/*vector<Struct> TestClass::handleStruct(vector<Struct> vecStr) {
+
+ for (Struct str : vecStr) {
+
+ cout << "Name: " << str.name << endl;
+ cout << "Value: " << str.value << endl;
+ cout << "Year: " << str.year << endl;
+ }
+ Struct test;
+ test.name = "Anonymous";
+ test.value = 1.33;
+ test.year = 2016;
+ vecStr.push_back(test);
+
+ return vecStr;
+}*/
+
+
string TestClass::sumArray(vector<string> newA) {
string sum = "";