Adjustments in stubs and skeletons for callback in callback; using different ports...
[iot2.git] / iotjava / iotpolicy / IoTCompiler.java
index 4cd54182312c25e37f22aca4b11b1910dddf0cfe..66287f93a79b4fc58d5813757128ff71f2ef71d0 100644 (file)
@@ -48,6 +48,7 @@ public class IoTCompiler {
        private Map<String,ParseTreeHandler> mapIntfacePTH;
        private Map<String,DeclarationHandler> mapIntDeclHand;
        private Map<String,Map<String,Set<String>>> mapInt2NewInts;
+       private Map<String,String> mapInt2NewIntName;
        // Data structure to store our types (primitives and non-primitives) for compilation
        private Map<String,String> mapPrimitives;
        private Map<String,String> mapNonPrimitivesJava;
@@ -58,6 +59,8 @@ public class IoTCompiler {
        private PrintWriter pw;
        private String dir;
        private String subdir;
+       private Map<String,Integer> mapPortCount;       // Counter for ports
+       private static int portCount = 0;
 
 
        /**
@@ -83,6 +86,7 @@ public class IoTCompiler {
                mapIntfacePTH = new HashMap<String,ParseTreeHandler>();
                mapIntDeclHand = new HashMap<String,DeclarationHandler>();
                mapInt2NewInts = new HashMap<String,Map<String,Set<String>>>();
+               mapInt2NewIntName = new HashMap<String,String>();
                mapIntfaceObjId = new HashMap<String,Integer>();
                mapNewIntfaceObjId = new HashMap<String,Integer>();
                mapPrimitives = new HashMap<String,String>();
@@ -91,6 +95,7 @@ public class IoTCompiler {
                        arraysToMap(mapNonPrimitivesJava, IoTRMITypes.nonPrimitivesJava, IoTRMITypes.nonPrimitiveJavaLibs);
                mapNonPrimitivesCplus = new HashMap<String,String>();
                        arraysToMap(mapNonPrimitivesCplus, IoTRMITypes.nonPrimitivesJava, IoTRMITypes.nonPrimitivesCplus);
+               mapPortCount = new HashMap<String,Integer>();
                pw = null;
                dir = OUTPUT_DIRECTORY;
                subdir = null;
@@ -177,6 +182,9 @@ public class IoTCompiler {
                        }
                        // Add interface and methods information into map
                        mapNewIntMethods.put(strInt, setMethods);
+                       // Map new interface method name to the original interface
+                       // TODO: perhaps need to check in the future if we have more than 1 stub interface for one original interface
+                       mapInt2NewIntName.put(origInt, strInt);
                }
                // Map the map of interface-methods to the original interface
                mapInt2NewInts.put(origInt, mapNewIntMethods);
@@ -476,8 +484,11 @@ public class IoTCompiler {
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
                        String callbackType = (String) it.next();
-                       writeConstructorJavaPermission(intface);
+                       writeConstructorJavaPermission(callbackType);
                        println("listCallbackObj = new ArrayList<" + callbackType + ">();");
+                       DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
+                       InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
+                       writeJavaInitCallbackPermission(callbackType, intDecl, callbackExist);
                        println("___initCallBack();");
                }
                println("}\n");
@@ -520,26 +531,35 @@ public class IoTCompiler {
        }
 
 
+       /**
+        * HELPER: getPortCount() gets port count for different stubs and skeletons
+        */
+       private int getPortCount(String intface) {
+
+               if (!mapPortCount.containsKey(intface))
+                       mapPortCount.put(intface, portCount++);
+               return mapPortCount.get(intface);
+       }
+
+
        /**
         * HELPER: writeInitCallbackJavaStub() writes callback initialization in stub
         */
-       private void writeInitCallbackJavaStub(String intface, InterfaceDecl intDecl, boolean isGenCallbackStub) {
+       private void writeInitCallbackJavaStub(String intface, InterfaceDecl intDecl, String newStubClass) {
 
                println("public void ___initCallBack() {");
                // Generate main thread for callbacks
                println("Thread thread = new Thread() {");
                println("public void run() {");
                println("try {");
-               if (isGenCallbackStub)  // Use the second port for a _CallbackStub class (callback in callback)
-                       println("rmiObj = new IoTRMIObject(ports[1]);");
-               else
-                       println("rmiObj = new IoTRMIObject(ports[0]);");
+               int port = getPortCount(newStubClass);
+               println("rmiObj = new IoTRMIObject(ports[" + port + "]);");
                println("while (true) {");
                println("byte[] method = rmiObj.getMethodBytes();");
-               writeJavaMethodCallbackPermission(intface);
                println("int objId = IoTRMIObject.getObjectId(method);");
                println(intface + "_CallbackSkeleton skel = (" + intface + "_CallbackSkeleton) listCallbackObj.get(objId);");
                println("if (skel != null) {");
+               writeJavaMethodCallbackPermission(intface);
                println("skel.invokeMethod(rmiObj);");
                print("}");
                println(" else {");
@@ -1017,7 +1037,7 @@ public class IoTCompiler {
        /**
         * HELPER: writeMethodJavaStub() writes the methods of the stub class
         */
-       private void writeMethodJavaStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, boolean isGenCallbackStub) {
+       private void writeMethodJavaStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, String newStubClass) {
 
                boolean isDefined = false;
                for (String method : methods) {
@@ -1052,13 +1072,22 @@ public class IoTCompiler {
                        println("}\n");
                        // Write the init callback helper method
                        if (isCallbackMethod && !isDefined) {
-                               writeInitCallbackJavaStub(callbackType, intDecl, isGenCallbackStub);
+                               writeInitCallbackJavaStub(callbackType, intDecl, newStubClass);
                                isDefined = true;
                        }
                }
        }
 
 
+       /**
+        * HELPER: getStubInterface() gets stub interface name based on original interface
+        */
+       public String getStubInterface(String intface) {
+
+               return mapInt2NewIntName.get(intface);
+       }
+
+
        /**
         * generateJavaStubClasses() generate stubs based on the methods list in Java
         */
@@ -1094,7 +1123,7 @@ public class IoTCompiler {
                                // Write constructor
                                writeConstructorJavaStub(intface, newStubClass, callbackExist, callbackClasses);
                                // Write methods
-                               writeMethodJavaStub(intMeth.getValue(), intDecl, callbackClasses, false);
+                               writeMethodJavaStub(intMeth.getValue(), intDecl, callbackClasses, newStubClass);
                                println("}");
                                pw.close();
                                System.out.println("IoTCompiler: Generated stub class " + newStubClass + ".java...");
@@ -1144,8 +1173,11 @@ public class IoTCompiler {
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
                        String callbackType = (String) it.next();
-                       writeConstructorJavaPermission(intface);
+                       writeConstructorJavaPermission(callbackType);
                        println("listCallbackObj = new ArrayList<" + callbackType + ">();");
+                       DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
+                       InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
+                       writeJavaInitCallbackPermission(callbackType, intDecl, callbackExist);
                        println("___initCallBack();");
                }
                println("}\n");
@@ -1192,7 +1224,7 @@ public class IoTCompiler {
                                writeConstructorJavaCallbackStub(intface, newStubClass, callbackExist, callbackClasses);
                                // Write methods
                                // TODO: perhaps need to generate callback for callback
-                               writeMethodJavaStub(intMeth.getValue(), intDecl, callbackClasses, true);
+                               writeMethodJavaStub(intMeth.getValue(), intDecl, callbackClasses, newStubClass);
                                println("}");
                                pw.close();
                                System.out.println("IoTCompiler: Generated callback stub class " + newStubClass + ".java...");
@@ -1294,7 +1326,7 @@ public class IoTCompiler {
        /**
         * HELPER: writeInitCallbackJavaSkeleton() writes the init callback method for skeleton class
         */
-       private void writeInitCallbackJavaSkeleton(boolean callbackSkeleton) {
+       private void writeInitCallbackJavaSkeleton(boolean callbackSkeleton, String intface) {
 
                // This is a callback skeleton generation
                if (callbackSkeleton)
@@ -1304,10 +1336,13 @@ public class IoTCompiler {
                print("Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int[].class, String.class, int.class },");
                println("new Class<?>[] { null, null, null });");
                println("ports = (int[]) paramObj[0];");
-               if (callbackSkeleton)   // If this is a callback skeleton then use the other port
-                       println("rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], ports[1]);");
+               String stubInt = null;
+               if (callbackSkeleton)
+                       stubInt = getStubInterface(intface) + "_CallbackStub";
                else
-                       println("rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], ports[0]);");
+                       stubInt = getStubInterface(intface) + "_Stub";
+               int port = getPortCount(stubInt);
+               println("rmiCall = new IoTRMICall(ports[" + port + "], (String) paramObj[1], (int) paramObj[2]);");
                println("}\n");
        }
 
@@ -1316,7 +1351,7 @@ public class IoTCompiler {
         * HELPER: writeMethodJavaSkeleton() writes the method of the skeleton class
         */
        private void writeMethodJavaSkeleton(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, 
-                       boolean callbackSkeleton) {
+                       boolean callbackSkeleton, String intface) {
 
                boolean isDefined = false;
                for (String method : methods) {
@@ -1346,7 +1381,7 @@ public class IoTCompiler {
                        writeStdMethodBodyJavaSkeleton(methParams, methodId, intDecl.getMethodType(method));
                        println("}\n");
                        if (isCallbackMethod && !isDefined) {   // Make sure that this function is only defined once!
-                               writeInitCallbackJavaSkeleton(callbackSkeleton);
+                               writeInitCallbackJavaSkeleton(callbackSkeleton, intface);
                                isDefined = true;
                        }
                }
@@ -1391,7 +1426,7 @@ public class IoTCompiler {
                                        println("}");
                                } else if (isList(paramType)) {
                                        println("for (int objId = 0; objId < numStubs" + i + "; objId++) {");
-                                       println("stub" + i + ".add(new " + exchParamType + "_CallbackStub(rmiCall, objIdCnt, ports));");
+                                       println("stub" + i + ".add(new " + exchParamType + "_CallbackStub(rmiCall, callbackAddress, objIdCnt, ports));");
                                        println("objIdCnt++;");
                                        println("}");
                                }
@@ -2167,7 +2202,7 @@ public class IoTCompiler {
                        // Write constructor
                        writeConstructorJavaSkeleton(newSkelClass, intface, intDecl, methods, callbackExist);
                        // Write methods
-                       writeMethodJavaSkeleton(methods, intDecl, callbackClasses, false);
+                       writeMethodJavaSkeleton(methods, intDecl, callbackClasses, false, intface);
                        // Write method helper
                        writeMethodHelperJavaSkeleton(methods, intDecl, callbackClasses);
                        // Write waitRequestInvokeMethod() - main loop
@@ -2353,7 +2388,7 @@ public class IoTCompiler {
                        // Write constructor
                        writeConstructorJavaCallbackSkeleton(newSkelClass, intface, intDecl, methods);
                        // Write methods
-                       writeMethodJavaSkeleton(methods, intDecl, callbackClasses, true);
+                       writeMethodJavaSkeleton(methods, intDecl, callbackClasses, true, intface);
                        // Write method helper
                        writeMethodHelperJavaCallbackSkeleton(methods, intDecl, callbackClasses);
                        // Write waitRequestInvokeMethod() - main loop
@@ -2594,7 +2629,7 @@ public class IoTCompiler {
        /**
         * HELPER: writeMethodCplusStub() writes the methods of the stub
         */
-       private void writeMethodCplusStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, boolean isGenCallbackStub) {
+       private void writeMethodCplusStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, String newStubClass) {
 
                boolean isDefined = false;
                for (String method : methods) {
@@ -2629,7 +2664,7 @@ public class IoTCompiler {
                        println("}\n");
                        // Write the init callback helper method
                        if (isCallbackMethod && !isDefined) {
-                               writeInitCallbackCplusStub(callbackType, intDecl, isGenCallbackStub);
+                               writeInitCallbackCplusStub(callbackType, intDecl, newStubClass);
                                writeInitCallbackSendInfoCplusStub(intDecl);
                                isDefined = true;
                        }
@@ -3040,8 +3075,6 @@ public class IoTCompiler {
                // Get the object Id
                Integer objId = mapIntfaceObjId.get(intface);
                println("const static int objectId = " + objId + ";");
-               //mapNewIntfaceObjId.put(newIntface, objId);
-               //mapIntfaceObjId.put(intface, objId++);
                if (callbackExist) {
                // We assume that each class only has one callback interface for now
                        Iterator it = callbackClasses.iterator();
@@ -3063,13 +3096,16 @@ public class IoTCompiler {
        private void writeConstructorCplusStub(String newStubClass, boolean callbackExist, Set<String> callbackClasses) {
 
                println(newStubClass + 
-                       "(int _port, const char* _skeletonAddress, const char* _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {");
+                       "(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {");
                println("callbackAddress = _callbackAddress;");
                println("ports = _ports;");
                println("rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult);");
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
                        String callbackType = (String) it.next();
+                       DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
+                       InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
+                       writeCplusInitCallbackPermission(callbackType, intDecl, callbackExist);
                        println("thread th1 (&" + newStubClass + "::___initCallBack, this);");
                        println("th1.detach();");
                        println("___regCB();");
@@ -3128,21 +3164,20 @@ public class IoTCompiler {
        /**
         * HELPER: writeInitCallbackCplusStub() writes the initialization of callback
         */
-       private void writeInitCallbackCplusStub(String intface, InterfaceDecl intDecl, boolean isGenCallbackStub) {
+       private void writeInitCallbackCplusStub(String intface, InterfaceDecl intDecl, String newStubClass) {
 
                println("void ___initCallBack() {");
                println("bool bResult = false;");
-               if (isGenCallbackStub)  // Use the second port for a _CallbackStub class (callback in callback)
-                       println("rmiObj = new IoTRMIObject(ports[1], &bResult);");
-               else
-                       println("rmiObj = new IoTRMIObject(ports[0], &bResult);");
+               int port = getPortCount(newStubClass);
+               println("rmiObj = new IoTRMIObject(ports[" + port + "], &bResult);");
                println("while (true) {");
                println("char* method = rmiObj->getMethodBytes();");
-               writeCplusMethodCallbackPermission(intface);
+               //writeCplusMethodCallbackPermission(intface);
                println("int objId = IoTRMIObject::getObjectId(method);");
                println("if (objId < vecCallbackObj.size()) {   // Check if still within range");
                println(intface + "_CallbackSkeleton* skel = dynamic_cast<" + intface + 
                        "_CallbackSkeleton*> (vecCallbackObj.at(objId));");
+               writeCplusMethodCallbackPermission(intface);
                println("skel->invokeMethod(rmiObj);");
                print("}");
                println(" else {");
@@ -3233,7 +3268,7 @@ public class IoTCompiler {
                                writeConstructorCplusStub(newStubClass, callbackExist, callbackClasses);
                                writeDeconstructorCplusStub(newStubClass, callbackExist, callbackClasses);
                                // Write methods
-                               writeMethodCplusStub(methods, intDecl, callbackClasses, false);
+                               writeMethodCplusStub(methods, intDecl, callbackClasses, newStubClass);
                                print("}"); println(";");
                                if (callbackExist) {
                                        Iterator it = callbackClasses.iterator();
@@ -3260,6 +3295,8 @@ public class IoTCompiler {
                println("IoTRMICall *rmiCall;");
                // Get the object Id
                println("int objectId;");
+               println("vector<int> ports;\n");
+               println("string callbackAddress;");
                if (callbackExist) {
                // We assume that each class only has one callback interface for now
                        Iterator it = callbackClasses.iterator();
@@ -3269,8 +3306,6 @@ public class IoTCompiler {
                        println("vector<" + callbackType + "*> vecCallbackObj;");
                        println("static int objIdCnt;");
                        // TODO: Need to initialize address and ports if we want to have callback-in-callback
-                       println("string callbackAddress;");
-                       println("vector<int> ports;\n");
                        writePropertiesCplusPermission(callbackType);
                }
                println("\n");
@@ -3282,13 +3317,17 @@ public class IoTCompiler {
         */
        private void writeConstructorCplusCallbackStub(String newStubClass, boolean callbackExist, Set<String> callbackClasses) {
 
-               println(newStubClass + "(IoTRMICall* _rmiCall, int _objectId, vector<int> _ports) {");
+               println(newStubClass + "(IoTRMICall* _rmiCall, string _callbackAddress, int _objectId, vector<int> _ports) {");
                println("objectId = _objectId;");
+               println("callbackAddress = _callbackAddress;");
                println("rmiCall = _rmiCall;");
                println("ports = _ports;");
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
                        String callbackType = (String) it.next();
+                       DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
+                       InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
+                       writeCplusInitCallbackPermission(callbackType, intDecl, callbackExist);
                        println("thread th1 (&" + newStubClass + "::___initCallBack, this);");
                        println("th1.detach();");
                        println("___regCB();");
@@ -3336,7 +3375,7 @@ public class IoTCompiler {
                                writeConstructorCplusCallbackStub(newStubClass, callbackExist, callbackClasses);
                                writeDeconstructorCplusStub(newStubClass, callbackExist, callbackClasses);
                                // Write methods
-                               writeMethodCplusStub(methods, intDecl, callbackClasses, true);
+                               writeMethodCplusStub(methods, intDecl, callbackClasses, newStubClass);
                                println("};");
                                if (callbackExist) {
                                        Iterator it = callbackClasses.iterator();
@@ -3361,6 +3400,8 @@ public class IoTCompiler {
        private void writePropertiesCplusSkeleton(String intface, boolean callbackExist, Set<String> callbackClasses) {
 
                println(intface + " *mainObj;");
+               println("vector<int> ports;");
+               println("string callbackAddress;");
                // Callback
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
@@ -3370,7 +3411,6 @@ public class IoTCompiler {
                        println("static int objIdCnt;");
                        println("vector<" + exchangeType + "*> vecCallbackObj;");
                        println("IoTRMICall *rmiCall;");
-                       println("vector<int> ports;");
                }
                println("IoTRMIObject *rmiObj;\n");
                // Keep track of object Ids of all stubs registered to this interface
@@ -3452,9 +3492,10 @@ public class IoTCompiler {
         */
        private void writeConstructorCplusSkeleton(String newSkelClass, String intface, boolean callbackExist, InterfaceDecl intDecl, Collection<String> methods) {
 
-               println(newSkelClass + "(" + intface + " *_mainObj, int _port) {");
+               println(newSkelClass + "(" + intface + " *_mainObj, string _callbackAddress, int _port) {");
                println("bool _bResult = false;");
                println("mainObj = _mainObj;");
+               println("callbackAddress = _callbackAddress;");
                println("rmiObj = new IoTRMIObject(_port, &_bResult);");
                writeCplusInitCallbackPermission(intface, intDecl, callbackExist);
                writeStructPermissionCplusSkeleton(methods, intDecl, intface);
@@ -3516,7 +3557,7 @@ public class IoTCompiler {
        /**
         * HELPER: writeInitCallbackCplusSkeleton() writes the init callback method for skeleton class
         */
-       private void writeInitCallbackCplusSkeleton(boolean callbackSkeleton) {
+       private void writeInitCallbackCplusSkeleton(boolean callbackSkeleton, String intface) {
 
                // This is a callback skeleton generation
                if (callbackSkeleton)
@@ -3531,10 +3572,13 @@ public class IoTCompiler {
                println("void* paramObj[] = { &param1, &param2, &param3 };");
                println("rmiObj->getMethodParams(paramCls, numParam, paramObj);");
                println("bool bResult = false;");
+               String stubInt = null;
                if (callbackSkeleton)
-                       println("rmiCall = new IoTRMICall(param1[1], param2.c_str(), param3, &bResult);");
+                       stubInt = getStubInterface(intface) + "_CallbackStub";
                else
-                       println("rmiCall = new IoTRMICall(param1[0], param2.c_str(), param3, &bResult);");
+                       stubInt = getStubInterface(intface) + "_Stub";
+               int port = getPortCount(stubInt);
+               println("rmiCall = new IoTRMICall(param1[" + port + "], param2.c_str(), param3, &bResult);");
                println("}\n");
        }
 
@@ -3543,7 +3587,7 @@ public class IoTCompiler {
         * HELPER: writeMethodCplusSkeleton() writes the method of the skeleton class
         */
        private void writeMethodCplusSkeleton(Collection<String> methods, InterfaceDecl intDecl, 
-                       Set<String> callbackClasses, boolean callbackSkeleton) {
+                       Set<String> callbackClasses, boolean callbackSkeleton, String intface) {
 
                boolean isDefined = false;
                for (String method : methods) {
@@ -3576,7 +3620,7 @@ public class IoTCompiler {
                        writeStdMethodBodyCplusSkeleton(methParams, methodId, intDecl.getMethodType(method));
                        println("}\n");
                        if (isCallbackMethod && !isDefined) {
-                               writeInitCallbackCplusSkeleton(callbackSkeleton);
+                               writeInitCallbackCplusSkeleton(callbackSkeleton, intface);
                                isDefined = true;
                        }
                }
@@ -4236,7 +4280,7 @@ public class IoTCompiler {
                        // Write deconstructor
                        writeDeconstructorCplusSkeleton(newSkelClass, callbackExist, callbackClasses);
                        // Write methods
-                       writeMethodCplusSkeleton(methods, intDecl, callbackClasses, false);
+                       writeMethodCplusSkeleton(methods, intDecl, callbackClasses, false, intface);
                        // Write method helper
                        writeMethodHelperCplusSkeleton(methods, intDecl, callbackClasses);
                        // Write waitRequestInvokeMethod() - main loop
@@ -4259,6 +4303,8 @@ public class IoTCompiler {
                println(intface + " *mainObj;");
                // Keep track of object Ids of all stubs registered to this interface
                println("int objectId;");
+               println("vector<int> ports;\n");
+               println("string callbackAddress;");
                // Callback
                if (callbackExist) {
                        Iterator it = callbackClasses.iterator();
@@ -4268,7 +4314,6 @@ public class IoTCompiler {
                        println("IoTRMICall* rmiCall;");
                        println("vector<" + exchangeType + "*> vecCallbackObj;");
                        println("static int objIdCnt;");
-                       println("vector<int> ports;\n");
                }
                println("\n");
        }
@@ -4279,8 +4324,9 @@ public class IoTCompiler {
         */
        private void writeConstructorCplusCallbackSkeleton(String newSkelClass, String intface, boolean callbackExist, InterfaceDecl intDecl, Collection<String> methods) {
 
-               println(newSkelClass + "(" + intface + " *_mainObj, int _objectId) {");
+               println(newSkelClass + "(" + intface + " *_mainObj, string _callbackAddress, int _objectId) {");
                println("mainObj = _mainObj;");
+               println("callbackAddress = _callbackAddress;");
                println("objectId = _objectId;");
                println("}\n");
        }
@@ -4458,7 +4504,7 @@ public class IoTCompiler {
                        // Write deconstructor
                        writeDeconstructorCplusCallbackSkeleton(newSkelClass, callbackExist, callbackClasses);
                        // Write methods
-                       writeMethodCplusSkeleton(methods, intDecl, callbackClasses, true);
+                       writeMethodCplusSkeleton(methods, intDecl, callbackClasses, true, intface);
                        // Write method helper
                        writeMethodHelperCplusCallbackSkeleton(methods, intDecl, callbackClasses);
                        // Write waitRequestInvokeMethod() - main loop