Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/iot2
[iot2.git] / iotjava / iotrmi / C++ / IoTRMIUtil.hpp
index 2c3be17cfc9aab7372d1b647cf175257cf3681f1..2f18adc5952f4d44ab9dbc0bc3477cb576f22525 100644 (file)
@@ -16,6 +16,7 @@
 #include <cstdlib>
 #include <memory>
 #include <typeinfo>
+#include <map>
 
 #include <iostream>
 #include <string>
@@ -26,7 +27,7 @@
 
 using namespace std;
 
-class IoTRMIUtil {
+class IoTRMIUtil final {
 
        public:
                IoTRMIUtil();
@@ -97,11 +98,19 @@ class IoTRMIUtil {
                // Constants
                const static int        OBJECT_ID_LEN = 4;      // 4 bytes = 32 bits
                const static int        METHOD_ID_LEN = 4;      // 4 bytes = 32 bits
+               const static int        PACKET_TYPE_LEN = 4;// 4 bytes = 32 bits
                const static int        PARAM_LEN = 4;          // 4 bytes = 32 bits (4-byte field that stores the length of the param)
                const static int        RETURN_LEN = 4;         // 4 bytes = 32 bits (4-byte field that stores the length of the return object)
                const static int        CHAR_LEN = 2;           // 2 bytes (we follow Java convention)
                const static int        BYTE_LEN = 1;           // 1 byte
                const static int        BOOL_LEN = 1;           // 1 byte
+               const static int        METHOD_TYPE = 1;        // Packet type of method
+               const static int        RET_VAL_TYPE = -1;      // Packet type of return value
+
+               // Static containers
+               static map<int,void*>* mapStub;         // Map object to its stub ID
+               static map<void*,void*>* mapSkel;       // Map object to its skeleton
+               static map<void*,int>* mapSkelId;       // Map object to its skeleton ID
                
        private:
                map<string,string>      mapPrimitives;
@@ -109,6 +118,10 @@ class IoTRMIUtil {
                map<string,string>      mapNonPrimitives;
 };
 
+map<int,void*>* IoTRMIUtil::mapStub = new map<int,void*>();
+map<void*,void*>* IoTRMIUtil::mapSkel = new map<void*,void*>();
+map<void*,int>* IoTRMIUtil::mapSkelId = new map<void*,int>();
+
 
 // Constructor
 IoTRMIUtil::IoTRMIUtil() {