Cleaning up C++ slave.
[iot2.git] / iotjava / iotruntime / cpp / iotslave / IoTSlave.hpp
index e5ecdfc7e4bf225f94247faa15bf202cdf53a07c..bbac3988c813df24718e913d20b95b1ad8eda889 100644 (file)
@@ -16,7 +16,7 @@
 
 /** Class IoTSlave is a communication class
  *  that interacts with IoTSlave.java to set up C++
- *  objects in Sentinel.
+ *  objects in Vigilia.
  *
  * @author      Rahmadi Trimananda <rtrimana @ uci.edu>
  * @version     1.0
@@ -26,6 +26,7 @@
 enum IoTCommCode {
 
        ACKNOWLEDGED,
+       CREATE_DRIVER_OBJECT,
        CREATE_OBJECT,
        CREATE_MAIN_OBJECT,
        CREATE_NEW_IOTSET,
@@ -42,7 +43,7 @@ enum IoTCommCode {
        REINITIALIZE_IOTSET_FIELD,
        REINITIALIZE_IOTRELATION_FIELD,
        TRANSFER_FILE,
-
+       
 };
 
 
@@ -53,13 +54,14 @@ typedef void destroy_t(void*);
 typedef void init_t(void*);
 
 
-class IoTSlave {
+class IoTSlave final {
 
        private:
                // Constants
                const static int RCVBUFSIZE = 1024;                     // Size of receive buffer
                const static int SKELPARAMSIZE = 3;                     // Number of params for skeleton
-               const static int STUBPARAMSIZE = 6;                     // Number of params for stub
+               const static int STUBPARAMSIZE = 5;                     // Number of params for stub
+               const static string LOGFILEPATH;                        // Log file path
                const static string FILEPATH;                           // File path
                const static string FILEEXT;                            // File extension
                const static string SOEXT;                              // Shared object (.so) extension
@@ -83,7 +85,6 @@ class IoTSlave {
                string objectStubClass;         // Need to send from Java IoTSlave: sMessage.getObjectStubInterfaceName() + STUB_CLASS_SUFFIX
                int objectRegPort;
                int objectStubPort;
-               vector<int> ports;                      // Now used to contain callback ports
                string objectFieldName;                                         // Field name that is going to be initialized with IoTSet or IoTRelation
                unordered_set<void*>* isetObject;                       // Set of object
                IoTSet<void*>* iotsetObject;                            // IoTSet of object
@@ -98,7 +99,7 @@ class IoTSlave {
                ofstream log;                                           // Log the messages
                vector<string> args;                            // Hold the arguments for constructor (in string format)
                vector<string> argClasses;                      // Hold the argument classes
-               bool isDriverObject;                            // Set to true if this is IoTSlave instance for a driver object
+               //bool isDriverObject;                          // Set to true if this is IoTSlave instance for a driver object
                void* objMainCls;                                       // Main class handler, i.e. driver or controller object
                void* objSkelCls;                                       // Skeleton handler
                void* objStubCls;                                       // Stub handler
@@ -137,6 +138,7 @@ class IoTSlave {
                void reinitializeIoTRelationField();
                void getIoTSetObject();
                void invokeInitMethod();
+               void createDriverObject();
                void transferFile();
 
        private:
@@ -160,6 +162,7 @@ class IoTSlave {
 };
 
 // Constant initialization
+const string IoTSlave::LOGFILEPATH = "../log/";
 const string IoTSlave::FILEPATH = "./";
 const string IoTSlave::FILEEXT = "_cpp.log";
 const string IoTSlave::SOEXT = ".so";