Preparing Lifxtest as a test benchmark; making adjustments in IoTSet for C++, etc.
authorrtrimana <rtrimana@uci.edu>
Thu, 12 Jan 2017 04:06:26 +0000 (20:06 -0800)
committerrtrimana <rtrimana@uci.edu>
Thu, 12 Jan 2017 04:06:26 +0000 (20:06 -0800)
12 files changed:
benchmarks/Cpp/Lifxtest/Lifxtest.config [new file with mode: 0644]
benchmarks/Cpp/Lifxtest/Lifxtest.cpp [new file with mode: 0644]
benchmarks/Cpp/Lifxtest/Lifxtest.hpp [new file with mode: 0644]
benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp [new file with mode: 0644]
benchmarks/Cpp/Lifxtest/Makefile [new file with mode: 0755]
benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.cpp
benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp
benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp [new file with mode: 0644]
benchmarks/virtuals/LightBulbTest.hpp [new file with mode: 0644]
iotjava/Makefile
iotjava/iotruntime/cpp/setrelation/IoTSet.hpp
iotjava/iotruntime/cpp/setrelation/Iterator.hpp

diff --git a/benchmarks/Cpp/Lifxtest/Lifxtest.config b/benchmarks/Cpp/Lifxtest/Lifxtest.config
new file mode 100644 (file)
index 0000000..5a44766
--- /dev/null
@@ -0,0 +1 @@
+ADDITIONAL_ZIP_FILE=No
diff --git a/benchmarks/Cpp/Lifxtest/Lifxtest.cpp b/benchmarks/Cpp/Lifxtest/Lifxtest.cpp
new file mode 100644 (file)
index 0000000..39c2f44
--- /dev/null
@@ -0,0 +1,71 @@
+#include <iostream>
+#include <chrono>
+#include <thread>
+
+#include "Lifxtest.hpp"
+#include "Iterator.hpp"
+
+Lifxtest::Lifxtest() {
+
+}
+
+Lifxtest::Lifxtest(IoTSet<LightBulbTest*> _lifx_light_bulb) {
+
+       lifx_light_bulb = _lifx_light_bulb;
+}
+
+
+Lifxtest::~Lifxtest() {
+}
+
+
+void Lifxtest::init() {
+
+       unordered_set<LightBulbTest*>* bulbSet = lifx_light_bulb.values();
+       for(LightBulbTest* lifx : *bulbSet) {
+
+               lifx->init();
+               this_thread::sleep_for (chrono::milliseconds(1000));
+
+               for (int i = 0; i < 5; i++) {
+                       lifx->turnOff();
+                       cout << "Turning off!" << endl;
+                       this_thread::sleep_for (chrono::milliseconds(1000));
+                       lifx->turnOn();
+                       cout << "Turning on!" << endl;
+                       this_thread::sleep_for (chrono::milliseconds(1000));
+               }
+
+               for (int i = 2500; i < 9000; i += 100) {
+                       cout << "Adjusting Temp: ";
+                       lifx->setTemperature(i);
+                       this_thread::sleep_for (chrono::milliseconds(100));
+               }
+
+               for (int i = 9000; i > 2500; i -= 100) {
+                       cout << "Adjusting Temp: ";
+                       lifx->setTemperature(i);
+                       this_thread::sleep_for (chrono::milliseconds(100));
+               }
+
+               for (int i = 100; i > 0; i -= 10) {
+                       cout << "Adjusting Brightness: ";
+                       lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
+                       this_thread::sleep_for (chrono::milliseconds(500));
+               }
+
+               for (int i = 0; i < 100; i += 10) {
+                       cout << "Adjusting Brightness: " << endl;
+                       lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
+                       this_thread::sleep_for (chrono::milliseconds(500));
+               }
+       }
+}
+
+
+int main(int argc, char *argv[]) {
+
+       return 0;
+}
+
+
diff --git a/benchmarks/Cpp/Lifxtest/Lifxtest.hpp b/benchmarks/Cpp/Lifxtest/Lifxtest.hpp
new file mode 100644 (file)
index 0000000..41b61aa
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _LIFXTEST_HPP__
+#define _LIFXTEST_HPP__
+#include <iostream>
+
+#include "IoTSet.hpp"
+#include "LightBulbTest.hpp"
+
+class Lifxtest {
+
+       private:
+               // IoTSet
+               IoTSet<LightBulbTest*> lifx_light_bulb;
+
+       public:
+
+               Lifxtest();
+               Lifxtest(IoTSet<LightBulbTest*> _lifx_light_bulb);
+               ~Lifxtest();
+               void init();
+};
+#endif
+
diff --git a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp
new file mode 100644 (file)
index 0000000..ccc3fe6
--- /dev/null
@@ -0,0 +1,147 @@
+#ifndef _LIGHTBULBTEST_STUB_HPP__
+#define _LIGHTBULBTEST_STUB_HPP__
+#include <iostream>
+#include "LightBulbTest.hpp"
+
+using namespace std;
+
+class LightBulbTest_Stub : public LightBulbTest
+{
+       private:
+
+       IoTRMICall *rmiCall;
+       string callbackAddress;
+       vector<int> ports;
+
+       const static int objectId = 0;
+       
+
+       public:
+
+       LightBulbTest_Stub() { }
+       
+       LightBulbTest_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {
+               callbackAddress = _callbackAddress;
+               ports = _ports;
+               rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult);
+       }
+
+       ~LightBulbTest_Stub() {
+               if (rmiCall != NULL) {
+                       delete rmiCall;
+                       rmiCall = NULL;
+               }
+       }
+       
+       void turnOn() { 
+               int methodId = 2;
+               string retType = "void";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               void* retObj = NULL;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+       }
+
+       double getBrightness() { 
+               int methodId = 6;
+               string retType = "double";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               double retVal = 0;
+               void* retObj = &retVal;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+               return retVal;
+       }
+
+       void turnOff() { 
+               int methodId = 1;
+               string retType = "void";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               void* retObj = NULL;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+       }
+
+       bool getState() { 
+               int methodId = 3;
+               string retType = "boolean";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               bool retVal = false;
+               void* retObj = &retVal;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+               return retVal;
+       }
+
+       void setColor(double _hue, double _saturation, double _brightness) { 
+               int methodId = 4;
+               string retType = "void";
+               int numParam = 3;
+               string paramCls[] = { "double", "double", "double" };
+               void* paramObj[] = { &_hue, &_saturation, &_brightness };
+               void* retObj = NULL;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+       }
+
+       double getSaturation() { 
+               int methodId = 8;
+               string retType = "double";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               double retVal = 0;
+               void* retObj = &retVal;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+               return retVal;
+       }
+
+       void init() { 
+               int methodId = 0;
+               string retType = "void";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               void* retObj = NULL;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+       }
+
+       void setTemperature(int _temperature) { 
+               int methodId = 5;
+               string retType = "void";
+               int numParam = 1;
+               string paramCls[] = { "int" };
+               void* paramObj[] = { &_temperature };
+               void* retObj = NULL;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+       }
+
+       double getHue() { 
+               int methodId = 7;
+               string retType = "double";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               double retVal = 0;
+               void* retObj = &retVal;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+               return retVal;
+       }
+
+       int getTemperature() { 
+               int methodId = 9;
+               string retType = "int";
+               int numParam = 0;
+               string paramCls[] = {  };
+               void* paramObj[] = {  };
+               int retVal = 0;
+               void* retObj = &retVal;
+               rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+               return retVal;
+       }
+
+};
+#endif
diff --git a/benchmarks/Cpp/Lifxtest/Makefile b/benchmarks/Cpp/Lifxtest/Makefile
new file mode 100755 (executable)
index 0000000..4a98f8a
--- /dev/null
@@ -0,0 +1,12 @@
+BASE = ../../..
+
+include $(BASE)/common.mk
+
+all: lifxtest
+
+PHONY += lifxtest
+lifxtest:
+       $(G++) ./Lifxtest.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/Lifxtest.o --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/
+       cp ./Lifxtest.config $(BIN_DIR)/iotcode/Lifxtest
+
+.PHONY: $(PHONY)
index b3a99ea805fa870faab41778de03e68cf21698a4..669548ffcb744a6a4bc7816007db674a480bd31c 100644 (file)
@@ -1124,12 +1124,6 @@ void LifxLightBulb::handleLightStateMessageReceived(char* payloadData) {
 
 
 // Functions for the main function
-void run(LifxLightBulb *llb) {
-
-       llb->init();
-}
-
-
 void onOff(LifxLightBulb *llb) {
 
        for (int i = 0; i < 5; i++) {
index 56bc7333360662b81d9cc6bf80f6117bcaab8320..79e8e9eb085e18e395cdf50b195696962f7ca3b5 100644 (file)
@@ -5,11 +5,9 @@
 #include <mutex>
 #include <thread>
 #include <chrono>
-#include <future>
 
 #include <string.h>
 #include <time.h>
-#include <pthread.h>
 
 #include "LightBulb.hpp"
 #include "Socket.hpp"
diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp
new file mode 100644 (file)
index 0000000..5b7aaaa
--- /dev/null
@@ -0,0 +1,332 @@
+#ifndef _LIGHTBULB_SKELETON_HPP__
+#define _LIGHTBULB_SKELETON_HPP__
+#include <iostream>
+#include "LightBulb.hpp"
+
+#include <vector>
+#include <set>
+#include "IoTRMICall.hpp"
+#include "IoTRMIObject.hpp"
+
+using namespace std;
+
+class LightBulb_Skeleton : public LightBulb
+{
+       private:
+
+       LightBulb *mainObj;
+       vector<int> ports;
+       string callbackAddress;
+       IoTRMIObject *rmiObj;
+
+       const static int object0Id = 0; //LightBulbSmart
+       static set<int> set0Allowed;
+       
+
+       public:
+
+       LightBulb_Skeleton(LightBulb *_mainObj, string _callbackAddress, int _port) {
+               bool _bResult = false;
+               mainObj = _mainObj;
+               callbackAddress = _callbackAddress;
+               rmiObj = new IoTRMIObject(_port, &_bResult);
+               ___waitRequestInvokeMethod();
+       }
+
+       ~LightBulb_Skeleton() {
+               if (rmiObj != NULL) {
+                       delete rmiObj;
+                       rmiObj = NULL;
+               }
+       }
+       
+       void init() {
+               mainObj->init();
+       }
+
+       void turnOff() {
+               mainObj->turnOff();
+       }
+
+       void turnOn() {
+               mainObj->turnOn();
+       }
+
+       bool getState() {
+               return mainObj->getState();
+       }
+
+       void setColor(double _hue, double _saturation, double _brightness) {
+               mainObj->setColor(_hue, _saturation, _brightness);
+       }
+
+       void setTemperature(int _temperature) {
+               mainObj->setTemperature(_temperature);
+       }
+
+       double getBrightness() {
+               return mainObj->getBrightness();
+       }
+
+       double getHue() {
+               return mainObj->getHue();
+       }
+
+       double getSaturation() {
+               return mainObj->getSaturation();
+       }
+
+       int getTemperature() {
+               return mainObj->getTemperature();
+       }
+
+       double getBrightnessRangeLowerBound() {
+               return mainObj->getBrightnessRangeLowerBound();
+       }
+
+       double getBrightnessRangeUpperBound() {
+               return mainObj->getBrightnessRangeUpperBound();
+       }
+
+       double getHueRangeLowerBound() {
+               return mainObj->getHueRangeLowerBound();
+       }
+
+       double getHueRangeUpperBound() {
+               return mainObj->getHueRangeUpperBound();
+       }
+
+       double getSaturationRangeLowerBound() {
+               return mainObj->getSaturationRangeLowerBound();
+       }
+
+       double getSaturationRangeUpperBound() {
+               return mainObj->getSaturationRangeUpperBound();
+       }
+
+       int getTemperatureRangeLowerBound() {
+               return mainObj->getTemperatureRangeLowerBound();
+       }
+
+       int getTemperatureRangeUpperBound() {
+               return mainObj->getTemperatureRangeUpperBound();
+       }
+
+       void ___init() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               init();
+       }
+
+       void ___turnOff() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               turnOff();
+       }
+
+       void ___turnOn() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               turnOn();
+       }
+
+       void ___getState() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               bool retVal = getState();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "boolean");
+       }
+
+       void ___setColor() {
+               string paramCls[] = { "double", "double", "double" };
+               int numParam = 3;
+               double _hue;
+               double _saturation;
+               double _brightness;
+               void* paramObj[] = { &_hue, &_saturation, &_brightness };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               setColor(_hue, _saturation, _brightness);
+       }
+
+       void ___setTemperature() {
+               string paramCls[] = { "int" };
+               int numParam = 1;
+               int _temperature;
+               void* paramObj[] = { &_temperature };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               setTemperature(_temperature);
+       }
+
+       void ___getBrightness() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getBrightness();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getHue() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getHue();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getSaturation() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getSaturation();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getTemperature() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               int retVal = getTemperature();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "int");
+       }
+
+       void ___getBrightnessRangeLowerBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getBrightnessRangeLowerBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getBrightnessRangeUpperBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getBrightnessRangeUpperBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getHueRangeLowerBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getHueRangeLowerBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getHueRangeUpperBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getHueRangeUpperBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getSaturationRangeLowerBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getSaturationRangeLowerBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getSaturationRangeUpperBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               double retVal = getSaturationRangeUpperBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "double");
+       }
+
+       void ___getTemperatureRangeLowerBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               int retVal = getTemperatureRangeLowerBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "int");
+       }
+
+       void ___getTemperatureRangeUpperBound() {
+               string paramCls[] = {  };
+               int numParam = 0;
+               void* paramObj[] = {  };
+               rmiObj->getMethodParams(paramCls, numParam, paramObj);
+               int retVal = getTemperatureRangeUpperBound();
+               void* retObj = &retVal;
+               rmiObj->sendReturnObj(retObj, "int");
+       }
+
+       void ___waitRequestInvokeMethod() {
+               while (true) {
+                       rmiObj->getMethodBytes();
+                       int _objectId = rmiObj->getObjectId();
+                       int methodId = rmiObj->getMethodId();
+                       if (_objectId == object0Id) {
+                               if (set0Allowed.find(methodId) == set0Allowed.end()) {
+                                       cerr << "Object with object Id: " << _objectId << "  is not allowed to access method: " << methodId << endl;
+                                       return;
+                               }
+                       }
+                       else {
+                               cerr << "Object Id: " << _objectId << " not recognized!" << endl;
+                               return;
+                       }
+                       switch (methodId) {
+                               case 0: ___init(); break;
+                               case 1: ___turnOff(); break;
+                               case 2: ___turnOn(); break;
+                               case 3: ___getState(); break;
+                               case 4: ___setColor(); break;
+                               case 5: ___setTemperature(); break;
+                               case 6: ___getBrightness(); break;
+                               case 7: ___getHue(); break;
+                               case 8: ___getSaturation(); break;
+                               case 9: ___getTemperature(); break;
+                               case 10: ___getBrightnessRangeLowerBound(); break;
+                               case 11: ___getBrightnessRangeUpperBound(); break;
+                               case 12: ___getHueRangeLowerBound(); break;
+                               case 13: ___getHueRangeUpperBound(); break;
+                               case 14: ___getSaturationRangeLowerBound(); break;
+                               case 15: ___getSaturationRangeUpperBound(); break;
+                               case 16: ___getTemperatureRangeLowerBound(); break;
+                               case 17: ___getTemperatureRangeUpperBound(); break;
+                               default: 
+                               cerr << "Method Id " << methodId << " not recognized!" << endl;
+                               throw exception();
+                       }
+               }
+       }
+
+};
+set<int> LightBulb_Skeleton::set0Allowed { 2, 10, 1, 3, 11, 8, 12, 7, 13, 9, 6, 16, 17, 4, 0, 14, 15, 5 };
+#endif
diff --git a/benchmarks/virtuals/LightBulbTest.hpp b/benchmarks/virtuals/LightBulbTest.hpp
new file mode 100644 (file)
index 0000000..5b60f41
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _LIGHTBULBTEST_HPP__
+#define _LIGHTBULBTEST_HPP__
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <set>
+#include "IoTRMICall.hpp"
+#include "IoTRMIObject.hpp"
+
+using namespace std;
+
+class LightBulbTest
+{
+       public:
+       virtual void turnOn() = 0;
+       virtual double getBrightness() = 0;
+       virtual void turnOff() = 0;
+       virtual bool getState() = 0;
+       virtual void setColor(double _hue, double _saturation, double _brightness) = 0;
+       virtual double getSaturation() = 0;
+       virtual void init() = 0;
+       virtual void setTemperature(int _temperature) = 0;
+       virtual double getHue() = 0;
+       virtual int getTemperature() = 0;
+
+       // Custom hasher for LightBulbTest iterator
+       size_t hash(LightBulbTest const& device) const {
+
+               // Use device address for hashing
+               std::stringstream ss;
+               ss << &device;
+               std::hash<std::string> hashVal;
+               return hashVal(ss.str());
+       }
+};
+#endif
index e346a159ac0e2841a5f9f7088d6203a1a6518ce7..310b859ad238a15a9d15f5ffc62e4d88a4eb5c9c 100644 (file)
@@ -30,7 +30,8 @@ PHONY += run-compiler-lbtest
 run-compiler-lbtest:
        cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
        cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
-       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
+       #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
+       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus
 
 # SmartLightsController
 PHONY += run-compiler-lifx
index f64595f99cf808d3ae7821bd474455c8584b113a..f5ba84a0fc81f01faa34fa3f28ec3a3f1726a4dc 100644 (file)
@@ -26,7 +26,7 @@ class IoTSet {
                typename unordered_set<T>::const_iterator begin();                      // Iterator
                typename unordered_set<T>::const_iterator end();                        // Iterator
                int size();                                                                                                     // Set size
-               unordered_set<T> values();                                                                      // Return set contents
+               unordered_set<T>* values();                                                                     // Return set contents
 };
 
 
@@ -103,7 +103,7 @@ int IoTSet<T>::size() {
  * Return a new copy of the set
  */
 template <class T>
-unordered_set<T> IoTSet<T>::values() {
+unordered_set<T>* IoTSet<T>::values() {
 
        return new unordered_set<T>(set);
 }
index 9cc4416df0e112d95386cc0056b3b4d1b6630f2b..2890af22e14ea6c6b40f4d5af9d85a7d0f1f8729 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _ITERATOR_HPP__
 #define _ITERATOR_HPP__
 
+#include "IoTDeviceAddress.hpp"
+#include "LightBulbTest.hpp"
+
 namespace std
 {
        template<> struct hash<IoTDeviceAddress>
@@ -17,4 +20,21 @@ bool operator==(const IoTDeviceAddress& lhs, const IoTDeviceAddress& rhs) {
     return lhs.hash(lhs) == rhs.hash(rhs);
 }
 
+
+namespace std
+{
+       template<> struct hash<LightBulbTest>
+       {
+               size_t operator()(LightBulbTest const& device) const
+               {
+                       return device.hash(device);
+               }
+       };
+}
+
+
+bool operator==(const LightBulbTest& lhs, const LightBulbTest& rhs) {
+       return lhs.hash(lhs) == rhs.hash(rhs);
+}
+
 #endif