Sending int[] instead of a bunch of int for enum type transport; cleaning up method...
[iot2.git] / iotjava / iotrmi / C++ / sample / TestClass_Stub.hpp
index 8e470efdf6cecd8baa90a4dd3f60bf71bbb38f73..b8cce2186ec0ac5f5cbba5e215d339e0cacc8552 100644 (file)
@@ -32,9 +32,6 @@ class TestClass_Stub : public TestClassInterface {
                void                            ____init_CallBack();    // thread
                void                            ____registerCallBack(); // tell the other side that we are ready
 
-               const static int        size = 12;
-               const static string methodSignatures[size];
-
        private:                
                int                                                     intA;
                float                                           floatB;
@@ -54,23 +51,6 @@ class TestClass_Stub : public TestClassInterface {
 int TestClass_Stub::objIdCnt = 0;
 
 
-const string TestClass_Stub::methodSignatures[TestClass_Stub::size] = {
-       "voidsetA(int)", // 0
-       "voidsetB(float)", // 1
-       "voidsetC(string)", // 2
-       "sumArray(string[])", // 3
-       //"sumArray(int[])",
-       "intsetAndGetA(int)", // 4
-       "intsetACAndGetA(string,int)", // 5
-       "intcallBack()", // 6
-       "voidregisterCallBack(CallBackInterface)", // 7
-       "voidregisterCallBack(CallBackInterface[])", // 8
-       "registercallback", // 9
-       "handleStruct(StructJ[])", // 10
-       "structsize" // 11
-};
-
-
 TestClass_Stub::TestClass_Stub() {
 
        address = "";
@@ -306,32 +286,22 @@ void TestClass_Stub::handleStruct(vector<data> vecData) {
 vector<EnumC> TestClass_Stub::handleEnum(vector<EnumC> vecEn) {
 
        int numParam = 1;
-       int methodId = 13;
-       string retType = "void";
-       string paramCls[] = { "int" };
-       int enumsize = vecEn.size();
-       void* paramObj[] = { &enumsize };
-       void* retObj = NULL;
-       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
-
-       int numParam2 = vecEn.size();
-       int methodId2 = 12;
-       string retType2 = "int[]";
-       string paramCls2[numParam2];
+       int numEl = vecEn.size();
+       int methodId = 12;
+       string retType = "int[]";
+       string paramCls[] = { "int[]" };
        // Need to define this container for integer version of enum
-       int paramEnum[numParam2];
-       void* paramObj2[numParam2];
-       for(int i = 0; i < numParam2; i++) {
-               paramCls2[i] = "int";
-               paramEnum[i] = (int) vecEn[i]; // cast enum to integer
-               paramObj2[i] = &paramEnum[i];
+       vector<int> paramInt(numEl);
+       for(int i = 0; i < numEl; i++) {
+               paramInt[i] = (int) vecEn[i]; // cast enum to integer
        }
-       vector<int> retEnumInt(numParam2);
+       void* paramObj[] = { &paramInt };
        // 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);
+       vector<int> retEnumInt;
+       void* retObj = &retEnumInt;
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        int enumsize1 = retEnumInt.size();
        vector<EnumC> retVal(enumsize1);
        for (int i=0; i < enumsize1; i++) {