From: rtrimana Date: Sat, 29 Oct 2016 00:07:51 +0000 (-0700) Subject: Adding #include declaration when array is translated as vector in C++ X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=b71ab2322db0f9b401ec8b8689b9a59a170b94cb Adding #include declaration when array is translated as vector in C++ --- diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java index 0afc699..4bbeb6a 100644 --- a/iotjava/iotpolicy/IoTCompiler.java +++ b/iotjava/iotpolicy/IoTCompiler.java @@ -753,11 +753,16 @@ public class IoTCompiler { for (String method : methods) { List methPrmTypes = intDecl.getMethodParamTypes(method); - for (String paramType : methPrmTypes) { + List 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"); } } } diff --git a/iotjava/iotrmi/Java/IoTRMITypes.java b/iotjava/iotrmi/Java/IoTRMITypes.java index 9ae0485..08877cb 100644 --- a/iotjava/iotrmi/Java/IoTRMITypes.java +++ b/iotjava/iotrmi/Java/IoTRMITypes.java @@ -114,8 +114,10 @@ public class IoTRMITypes { //"unordered_set", //"map", //"unordered_map", - "list", - "list" + //"list", + //"list" + "vector", + "vector" };