X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=blobdiff_plain;f=iotjava%2Fiotrmi%2FC%2B%2B%2Fsample%2FTestClass_Stub.hpp;h=8e470efdf6cecd8baa90a4dd3f60bf71bbb38f73;hp=63457fe69fefa006d51499c91da0c911c1d8b35f;hb=fa20c8e87f7a52d03ce3a71647b22107ef0e9710;hpb=87b736a65257f4497b0b28543e758d7b09db2820 diff --git a/iotjava/iotrmi/C++/sample/TestClass_Stub.hpp b/iotjava/iotrmi/C++/sample/TestClass_Stub.hpp index 63457fe..8e470ef 100644 --- a/iotjava/iotrmi/C++/sample/TestClass_Stub.hpp +++ b/iotjava/iotrmi/C++/sample/TestClass_Stub.hpp @@ -28,7 +28,7 @@ class TestClass_Stub : public TestClassInterface { void registerCallback(vector_cb); int callBack(); void handleStruct(vector vecData); - void handleEnum(vector vecEn); + vector handleEnum(vector vecEn); void ____init_CallBack(); // thread void ____registerCallBack(); // tell the other side that we are ready @@ -303,7 +303,7 @@ void TestClass_Stub::handleStruct(vector vecData) { } -void TestClass_Stub::handleEnum(vector vecEn) { +vector TestClass_Stub::handleEnum(vector vecEn) { int numParam = 1; int methodId = 13; @@ -316,18 +316,28 @@ void TestClass_Stub::handleEnum(vector vecEn) { int numParam2 = vecEn.size(); int methodId2 = 12; - string retType2 = "void"; + string retType2 = "int[]"; string paramCls2[numParam2]; // Need to define this container for integer version of enum int paramEnum[numParam2]; void* paramObj2[numParam2]; - for(int i = 0; i < vecEn.size(); i++) { + for(int i = 0; i < numParam2; i++) { paramCls2[i] = "int"; paramEnum[i] = (int) vecEn[i]; // cast enum to integer paramObj2[i] = ¶mEnum[i]; } - void* retObj2 = NULL; + vector retEnumInt(numParam2); + // if no return value just + // void* retObj2 = NULL; + // This is with return value: + void* retObj2 = &retEnumInt; rmiCall->remoteCall(objectId, methodId2, retType2, paramCls2, paramObj2, numParam2, retObj2); + int enumsize1 = retEnumInt.size(); + vector retVal(enumsize1); + for (int i=0; i < enumsize1; i++) { + retVal[i] = (EnumC) retEnumInt[i]; + } + return retVal; }