1 #ifndef _CALLBACK_CBSKELETON_HPP__
2 #define _CALLBACK_CBSKELETON_HPP__
5 #include "CallBackInterface.hpp"
6 #include "../IoTRMIObject.hpp"
11 class CallBack_CBSkeleton : public CallBackInterface {
13 CallBack_CBSkeleton(CallBackInterface* _cb, int _objectId);
14 ~CallBack_CBSkeleton();
16 void* invokeMethod(IoTRMIObject* rmiObj, string *type);
20 const static int size = 2;
21 const static string methodSignatures[size];
24 CallBackInterface *cb;
29 const string CallBack_CBSkeleton::methodSignatures[CallBack_CBSkeleton::size] = {
37 CallBack_CBSkeleton::CallBack_CBSkeleton(CallBackInterface* _cb, int _objectId) {
41 cout << "Creating CallBack_Skeleton and waiting!" << endl;
45 CallBack_CBSkeleton::~CallBack_CBSkeleton() {
50 void* CallBack_CBSkeleton::invokeMethod(IoTRMIObject* rmiObj, string *type) {
52 // Loop continuously waiting for incoming bytes
54 cout << "Get inside invoke method!" << endl;
56 //rmiObj->getMethodBytes();
57 cout << "Get inside invoke 2!" << endl;
58 string methodSign = rmiObj->getSignature();
59 cout << "Get inside invoke 3!" << endl;
60 cout << "Method sign: " << methodSign << endl;
62 if (methodSign.compare("intprintInt()") == 0) {
63 string paramCls[] = { };
65 void* paramObj[] = { };
66 rmiObj->getMethodParams(paramCls, numParam, paramObj);
67 int retVal = printInt();
70 rmiObj->sendReturnObj(retObj, "int");
71 } else if (methodSign.compare("voidsetInt(int)") == 0) {
72 string paramCls[] = { "int" };
75 void* paramObj[] = { ¶m1 };
76 rmiObj->getMethodParams(paramCls, numParam, paramObj);
80 string error = "Signature not recognized: " + string(methodSign);
88 int CallBack_CBSkeleton::printInt() {
90 return cb->printInt();
94 void CallBack_CBSkeleton::setInt(int _i) {