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 0afc699..4bbeb6a 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 9ae0485..08877cb 100644 (file)
@@ -114,8 +114,10 @@ public class IoTRMITypes {
                //"unordered_set",
                //"map",
                //"unordered_map",
-               "list",
-               "list"
+               //"list",
+               //"list"
+               "vector",
+               "vector"
        };