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/C++
41 const static int primitivesSizes[NUM_PRIMITIVES];
45 * Non-primitive Java data types
47 const static string nonPrimitivesJava[NUM_NONPRIMITIVES];
51 * Non-primitive C++ data types
53 const static string nonPrimitivesCplus[NUM_NONPRIMITIVES];
57 static void arraysToMap(map<string,string> &srcMap, const vector<string> arrKey,
58 const vector<string> arrVal);
59 static void arraysToMap(map<string,int> &srcMap, const vector<string> arrKey,
60 const vector<int> arrVal);
61 static void arraysToMap(map<void*,void*> &srcMap, const vector<void*> arrKey,
62 const vector<void*> arrVal);
66 const string IoTRMITypes::primitivesJava[IoTRMITypes::NUM_PRIMITIVES] = {
83 "Character", // 2 bytes
84 "string", // indefinite
85 "String", // indefinite
90 const string IoTRMITypes::primitivesCplus[IoTRMITypes::NUM_PRIMITIVES] = {
108 "string", // indefinite
109 "string", // indefinite
114 const int IoTRMITypes::primitivesSizes[IoTRMITypes::NUM_PRIMITIVES] = {
116 1, 1, 2, 2, 4, 4, 8, 8, 4, 4, 8, 8, 1, 1, 2, 2, -1, -1, 0
120 const string IoTRMITypes::nonPrimitivesJava[IoTRMITypes::NUM_NONPRIMITIVES] = {
131 const string IoTRMITypes::nonPrimitivesCplus[IoTRMITypes::NUM_NONPRIMITIVES] = {
146 // Inserting array members into a Map object
147 // that maps arrKey to arrVal objects
148 void IoTRMITypes::arraysToMap(map<string,string> &srcMap, const vector<string> arrKey,
149 const vector<string> arrVal) {
151 for(int i = 0; i < arrKey.size(); i++) {
153 srcMap[arrKey[i]] = arrVal[i];
158 // Inserting array members into a Map object
159 // that maps arrKey to arrVal objects
160 void IoTRMITypes::arraysToMap(map<string,int> &srcMap, const vector<string> arrKey,
161 const vector<int> 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<void*,void*> &srcMap, const vector<void*> arrKey,
173 const vector<void*> arrVal) {
175 for(int i = 0; i < arrKey.size(); i++) {
177 srcMap[arrKey[i]] = arrVal[i];