1 /** Class IoTRMITypes is a class that provides type translations.
3 * It stores C++ and Java types.
5 * @author Rahmadi Trimananda <rtrimana @ uci.edu>
9 #ifndef _IOTRMITYPES_HPP__
10 #define _IOTRMITYPES_HPP__
22 /* Public constants */
23 const static int NUM_PRIMITIVES = 19;
24 const static int NUM_NONPRIMITIVES = 6;
27 * Primitive data types in Java
29 const static string primitivesJava[NUM_PRIMITIVES];
33 * Primitive data types in C++ to map the primitives list
35 const static string primitivesCplus[NUM_PRIMITIVES];
39 * Primitive sizes in Java - Long is 8 bytes and char is 2 bytes
41 const static int primitivesJavaSizes[NUM_PRIMITIVES];
45 * Primitive sizes in Cplus - Long is 4 bytes and char is 1 byte
47 const static int primitivesCplusSizes[NUM_PRIMITIVES];
51 * Non-primitive Java data types
53 const static string nonPrimitivesJava[NUM_NONPRIMITIVES];
57 * Non-primitive C++ data types
59 const static string nonPrimitivesCplus[NUM_NONPRIMITIVES];
63 static void arraysToMap(map<string,string> &srcMap, const vector<string> arrKey,
64 const vector<string> arrVal);
65 static void arraysToMap(map<string,int> &srcMap, const vector<string> arrKey,
66 const vector<int> arrVal);
67 static void arraysToMap(map<void*,void*> &srcMap, const vector<void*> arrKey,
68 const vector<void*> arrVal);
72 const string IoTRMITypes::primitivesJava[IoTRMITypes::NUM_PRIMITIVES] = {
89 "Character", // 2 bytes
90 "string", // indefinite
91 "String", // indefinite
96 const string IoTRMITypes::primitivesCplus[IoTRMITypes::NUM_PRIMITIVES] = {
104 "int64_t", // 8 bytes
105 "int64_t", // 8 bytes
114 "string", // indefinite
115 "string", // indefinite
120 const int IoTRMITypes::primitivesJavaSizes[IoTRMITypes::NUM_PRIMITIVES] = {
122 1, 1, 2, 2, 4, 4, 8, 8, 4, 4, 8, 8, 1, 1, 2, 2, -1, -1, 0
126 const int IoTRMITypes::primitivesCplusSizes[IoTRMITypes::NUM_PRIMITIVES] = {
128 1, 1, 2, 2, 4, 4, 8, 8, 4, 4, 8, 8, 1, 1, 2, 2, -1, -1, 0
132 const string IoTRMITypes::nonPrimitivesJava[IoTRMITypes::NUM_NONPRIMITIVES] = {
143 const string IoTRMITypes::nonPrimitivesCplus[IoTRMITypes::NUM_NONPRIMITIVES] = {
158 // Inserting array members into a Map object
159 // that maps arrKey to arrVal objects
160 void IoTRMITypes::arraysToMap(map<string,string> &srcMap, const vector<string> arrKey,
161 const vector<string> arrVal) {
163 for(int i = 0; i < arrKey.size(); i++) {
165 srcMap[arrKey[i]] = arrVal[i];
170 // Inserting array members into a Map object
171 // that maps arrKey to arrVal objects
172 void IoTRMITypes::arraysToMap(map<string,int> &srcMap, const vector<string> arrKey,
173 const vector<int> arrVal) {
175 for(int i = 0; i < arrKey.size(); i++) {
177 srcMap[arrKey[i]] = arrVal[i];
182 // Inserting array members into a Map object
183 // that maps arrKey to arrVal objects
184 void IoTRMITypes::arraysToMap(map<void*,void*> &srcMap, const vector<void*> arrKey,
185 const vector<void*> arrVal) {
187 for(int i = 0; i < arrKey.size(); i++) {
189 srcMap[arrKey[i]] = arrVal[i];