Testing callbacks for Java and C++; fixing a few bugs; more bugs to tackle: 1) Need...
[iot2.git] / iotjava / iotrmi / C++ / basics / TestClass_Stub.cpp
index 96011d19f6f3e3b07fa156a28f5567e19642e15c..207eb8b2654ed7866ce789e3b2fa3a0d1c378037 100644 (file)
@@ -1,6 +1,7 @@
 #include <iostream>
 #include <string>
 #include "TestClassComplete_Stub.hpp"
+#include "CallBack.hpp"
 
 using namespace std;
 
@@ -24,7 +25,7 @@ int main(int argc, char *argv[])
        cout << "Return value: " << tcStub->getDouble(12345.678) << endl;
        cout << "Return value: " << tcStub->getBoolean(true) << endl;
        cout << "Return value: " << tcStub->getChar('c') << endl;
-       cout << "==== ARRAY ====" << endl;
+/*     cout << "==== ARRAY ====" << endl;
        vector<char> in1;
        in1.push_back(68);
        in1.push_back(69);
@@ -127,7 +128,29 @@ int main(int argc, char *argv[])
                cout << "Name: " << st.name << endl;
                cout << "Value:" << st.value << endl;
                cout << "Year" << st.year << endl;
-       }
+       }*/
+       cout << "==== CALLBACK ====" << endl;
+       CallBackInterface *cbSingle = new CallBack(2354);
+       tcStub->registerCallback(cbSingle);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
+       CallBackInterface *cb1 = new CallBack(23);
+       CallBackInterface *cb2 = new CallBack(33);
+       CallBackInterface *cb3 = new CallBack(43);
+       vector<CallBackInterface*> cb;
+       cb.push_back(cb1);
+       cb.push_back(cb2);
+       cb.push_back(cb3);
+       tcStub->registerCallbackArray(cb);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
+       CallBackInterface *cb4 = new CallBack(23);
+       CallBackInterface *cb5 = new CallBack(33);
+       CallBackInterface *cb6 = new CallBack(43);
+       vector<CallBackInterface*> cblist;
+       cblist.push_back(cb4);
+       cblist.push_back(cb5);
+       cblist.push_back(cb6);
+       tcStub->registerCallbackList(cblist);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
 
        cout << "==== OTHERS ====" << endl;
        cout << "Return value: " << tcStub->getA() << endl;