Adding #include<vector> declaration when array is translated as vector in C++
authorrtrimana <rtrimana@uci.edu>
Sat, 29 Oct 2016 00:07:51 +0000 (17:07 -0700)
committerrtrimana <rtrimana@uci.edu>
Sat, 29 Oct 2016 00:07:51 +0000 (17:07 -0700)
iotjava/iotpolicy/IoTCompiler.java
iotjava/iotrmi/Java/IoTRMITypes.java

index 0afc699907754a4485c94e7139976a57fb07571e..4bbeb6a8c023917a4a42cf19e0112f754428dec4 100644 (file)
@@ -753,11 +753,16 @@ public class IoTCompiler {
                for (String method : methods) {
 
                        List<String> methPrmTypes = intDecl.getMethodParamTypes(method);
-                       for (String paramType : methPrmTypes) {
+                       List<String> methParams = intDecl.getMethodParams(method);
+                       for (int i = 0; i < methPrmTypes.size(); i++) {
 
-                               String simpleType = getSimpleType(paramType);
+                               String simpleType = getSimpleType(methPrmTypes.get(i));
+                               String param = methParams.get(i);
                                if (getParamCategory(simpleType) == ParamCategory.NONPRIMITIVES) {
                                        includeClasses.add(getNonPrimitiveCplusClass(simpleType));
+                               } else if (param.contains("[]")) {
+                               // Check if this is array for C++; translate into vector
+                                       includeClasses.add("vector");
                                }
                        }
                }
index 9ae048551681d7c2c9f4fa826185e9dcebca8a34..08877cb944cc9ca6bc9db20a0c1bae61daa83dc7 100644 (file)
@@ -114,8 +114,10 @@ public class IoTRMITypes {
                //"unordered_set",
                //"map",
                //"unordered_map",
-               "list",
-               "list"
+               //"list",
+               //"list"
+               "vector",
+               "vector"
        };