3 /** Class IoTRMITypes is a class that provides type translations.
5 * It stores C++ and Java types.
7 * @author Rahmadi Trimananda <rtrimana @ uci.edu>
12 import java.util.HashMap;
15 public final class IoTRMITypes {
18 * Primitive data types in Java
20 public final static String[] primitivesJava = new String[] {
37 "Character", // 2 bytes
38 "string", // indefinite
39 "String", // indefinite
45 * Primitive data types in C++ to map the primitives list
47 public final static String[] primitivesCplus = new String[] {
63 "char", // 2 bytes - C++ is made to follow Java convention
64 "char", // 2 bytes - i.e. 2 bytes for a char
65 "string", // indefinite
66 "string", // indefinite
72 * Primitive sizes in Java - Long is 8 bytes and char is 2 bytes
74 public final static Integer[] primitivesSizes = new Integer[] {
76 1, 1, 2, 2, 4, 4, 8, 8, 4, 4, 8, 8, 1, 1, 2, 2, -1, -1, 0
81 * Non-primitive Java data types
83 public final static String[] nonPrimitivesJava = new String[] {
91 * Non-primitive Java libraries based on the list above
93 public final static String[] nonPrimitiveJavaLibs = new String[] {
101 * Non-primitive C++ data types
103 public final static String[] nonPrimitivesCplus = new String[] {
114 // Inserting array members into a Map object
115 // that maps arrKey to arrVal objects
116 public static void arraysToMap(Map<String,String> map, String[] arrKey, String[] arrVal) {
118 for(int i = 0; i < arrKey.length; i++) {
120 map.put(arrKey[i], arrVal[i]);
124 // Inserting array members into a Map object
125 // that maps arrKey to arrVal objects
126 public static void arraysToMap(Map<String,Integer> map, String[] arrKey, Integer[] arrVal) {
128 for(int i = 0; i < arrKey.length; i++) {
130 map.put(arrKey[i], arrVal[i]);
134 // Inserting array members into a Map object
135 // that maps arrKey to arrVal objects
136 public static void arraysToMap(Map<Object,Object> map, Object[] arrKey, Object[] arrVal) {
138 for(int i = 0; i < arrKey.length; i++) {
140 map.put(arrKey[i], arrVal[i]);