Working C++ IoTSlave for both IoTSet and IoTRelation; threading works for C++ LifxLig...
[iot2.git] / benchmarks / drivers / Cpp / LifxLightBulb / LightBulb_Skeleton.hpp
index 936ea21f5c82c634f58c015b05452f89054641d4..be35d65a00d38db55bfe7c39cf970252a6bc59a9 100644 (file)
@@ -31,7 +31,13 @@ class LightBulb_Skeleton : public LightBulb
                mainObj = _mainObj;
                callbackAddress = _callbackAddress;
                // Logging
-               log.open("LightBulb_Skeleton_cpp.log");
+               int i=0;
+               string file = "LightBulb_Skeleton_cpp" + to_string(i) + ".log";
+               while (ifstream(file.c_str())) {
+                       i++;
+                       file = "LightBulb_Skeleton_cpp" + to_string(i) + ".log";
+               }
+               log.open(file);
                log << "Callback address: " << callbackAddress << endl;
                log << "Port: " << _port << endl;
                rmiObj = new IoTRMIObject(_port, &_bResult);