[IOT-2810][IS]Static analysis coding style issues 03/22903/4
authorHarry <h.marappa@samsung.com>
Wed, 18 Oct 2017 15:28:46 +0000 (20:58 +0530)
committerUze Choi <uzchoi@samsung.com>
Thu, 19 Oct 2017 01:55:45 +0000 (01:55 +0000)
Changes are mostly related to indentation, adding curly
braces to single line conditional blocks.

Change-Id: I4fcade68805dc3c1a6970a34683e519708a609f7
Signed-off-by: Harry <h.marappa@samsung.com>
54 files changed:
service/simulator/examples/client/simulator_client.cpp
service/simulator/examples/server/simulator_server.cpp
service/simulator/inc/simulator_resource_model_schema.h
service/simulator/inc/simulator_uncopyable.h
service/simulator/java/jni/jni_listener_holder.h
service/simulator/java/jni/jni_queryparam.cpp
service/simulator/java/jni/jni_vector.cpp
service/simulator/java/jni/simulator_collection_resource_jni.cpp
service/simulator/java/jni/simulator_device_info_jni.cpp
service/simulator/java/jni/simulator_init_jni.cpp
service/simulator/java/jni/simulator_manager_jni.cpp
service/simulator/java/jni/simulator_platform_info_jni.cpp
service/simulator/java/jni/simulator_remote_resource_jni.cpp
service/simulator/java/jni/simulator_resource_attribute_jni.cpp
service/simulator/java/jni/simulator_resource_jni.cpp
service/simulator/java/jni/simulator_resource_model_jni.cpp
service/simulator/java/jni/simulator_resource_model_schema_jni.cpp
service/simulator/java/jni/simulator_resource_utils_jni.cpp
service/simulator/java/jni/simulator_single_resource_jni.cpp
service/simulator/ramlparser/raml/IncludeResolver.cpp
service/simulator/ramlparser/raml/RamlParser.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/Definitions.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/Definitions.h
service/simulator/ramlparser/raml/jsonSchemaParser/JsonSchema.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/JsonSchema.h
service/simulator/ramlparser/raml/jsonSchemaParser/Properties.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/Properties.h
service/simulator/ramlparser/raml/model/AbstractParam.cpp
service/simulator/ramlparser/raml/model/Action.cpp
service/simulator/ramlparser/raml/model/Raml.cpp
service/simulator/ramlparser/raml/model/RamlResource.cpp
service/simulator/ramlparser/raml/model/RequestResponseBody.cpp
service/simulator/ramlparser/raml/model/RequestResponseBody.h
service/simulator/ramlparser/raml/model/Response.cpp
service/simulator/src/client/post_request_generator.cpp
service/simulator/src/client/query_param_generator.cpp
service/simulator/src/client/request_automation_manager.cpp
service/simulator/src/client/request_generation.h
service/simulator/src/client/simulator_remote_resource_impl.cpp
service/simulator/src/common/attribute_generator.cpp
service/simulator/src/common/attribute_value_generator.cpp
service/simulator/src/common/request_model.cpp
service/simulator/src/common/request_model_builder.cpp
service/simulator/src/common/resource_model_schema_builder.cpp
service/simulator/src/common/simulator_logger.cpp
service/simulator/src/common/simulator_resource_model.cpp
service/simulator/src/common/simulator_resource_model_schema.cpp
service/simulator/src/common/simulator_utils.cpp
service/simulator/src/server/oc_interface_details.cpp
service/simulator/src/server/resource_update_automation.cpp
service/simulator/src/server/simulator_collection_resource_impl.cpp
service/simulator/src/server/simulator_resource_factory.cpp
service/simulator/src/server/simulator_single_resource_impl.cpp
service/simulator/src/simulator_manager.cpp

index 869bd6f..898d9a9 100644 (file)
@@ -149,10 +149,14 @@ class ClientController
                 // Add to local list
                 std::lock_guard<std::recursive_mutex> lock(m_mutex);
                 if (m_resList.end() == m_resList.find(resource->getID()))
+                {
                     m_resList[resource->getID()] = resource;
+                }
                 else
+                {
                     std::cout << "Resource with UID: " << resource->getID() << "already exist in the list!" <<
                               std::endl;
+                }
             };
 
             try
@@ -180,7 +184,10 @@ class ClientController
 
         void displayResource(SimulatorRemoteResourceSP resource)
         {
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             std::cout << "#############################" << std::endl;
             std::cout << "URI: " << resource->getURI().c_str() << std::endl;
@@ -200,7 +207,10 @@ class ClientController
         void observeResource()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                 return;
+            }
 
             // callback implementaion
             SimulatorRemoteResource::ObserveNotificationCallback callback =
@@ -251,7 +261,10 @@ class ClientController
         void sendGet()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             // callback implementaion
             SimulatorRemoteResource::ResponseCallback callback =
@@ -289,7 +302,10 @@ class ClientController
         void sendPut()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             // callback implementaion
             SimulatorRemoteResource::ResponseCallback callback =
@@ -331,7 +347,10 @@ class ClientController
         void sendPost()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             // callback implementaion
             SimulatorRemoteResource::ResponseCallback callback =
@@ -373,7 +392,10 @@ class ClientController
         void sendAllGETRequests()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             SimulatorRemoteResource::AutoRequestGenerationCallback callback =
                 [] (const std::string & uid, int sessionId, OperationState state)
@@ -443,7 +465,10 @@ class ClientController
         void sendAllPOSTRequests()
         {
             SimulatorRemoteResourceSP resource = selectResource();
-            if (!resource) return;
+            if (!resource)
+            {
+                return;
+            }
 
             SimulatorRemoteResource::AutoRequestGenerationCallback callback =
                 [] (const std::string & uid, int sessionId, OperationState state)
@@ -479,7 +504,9 @@ class ClientController
         {
             SimulatorRemoteResourceSP resource = selectResource();
             if (!resource)
+            {
                 return;
+            }
 
             try
             {
@@ -505,7 +532,9 @@ class ClientController
         {
             SimulatorRemoteResourceSP resource = selectResource();
             if (!resource)
+            {
                 return;
+            }
 
             try
             {
@@ -539,7 +568,9 @@ class ClientController
         {
             SimulatorRemoteResourceSP resource = selectResource();
             if (!resource)
+            {
                 return;
+            }
 
             try
             {
@@ -610,7 +641,9 @@ void setLogger()
         case 1:
             {
                 if (false == SimulatorManager::getInstance()->setConsoleLogger())
+                {
                     std::cout << "Failed to set the default console logger" << std::endl;
+                }
             }
             break;
 
@@ -620,7 +653,9 @@ void setLogger()
                 std::cout << "Enter the file path (without file name) : ";
                 std::cin >> filePath;
                 if (false == SimulatorManager::getInstance()->setFileLogger(filePath))
+                {
                     std::cout << "Failed to set default file logger" << std::endl;
+                }
             }
             break;
 
index fe9ebdd..baca8c0 100644 (file)
@@ -146,7 +146,9 @@ void displayResource()
 {
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
 
@@ -168,7 +170,9 @@ void startResource()
 {
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
     resource->start();
@@ -179,7 +183,9 @@ void stopResource()
 {
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
     resource->stop();
@@ -197,14 +203,18 @@ void automateResourceUpdate()
 
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     AutoUpdateType type = AutoUpdateType::ONE_TIME;
     int choice = 0;
     std::cout << "Press 1 if you want recurrent automation: ";
     std::cin >> choice;
     if (1 == choice)
+    {
         type = AutoUpdateType::REPEAT;
+    }
 
     try
     {
@@ -230,7 +240,9 @@ void automateAttributeUpdate()
 
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
     std::map<std::string, SimulatorResourceAttribute> attributes =
@@ -274,7 +286,9 @@ void automateAttributeUpdate()
     std::cout << "Press 1 if you want recurrent automation: ";
     std::cin >> choice;
     if (1 == choice)
+    {
         type = AutoUpdateType::REPEAT;
+    }
 
     std::cout << "Requesting attribute automation for " << attributeName <<
               std::endl;
@@ -295,7 +309,9 @@ void stopAutomation()
 {
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
 
@@ -326,7 +342,9 @@ void getObservers()
 {
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
 
@@ -380,7 +398,9 @@ void setLogger()
         case 1:
             {
                 if (false == SimulatorManager::getInstance()->setConsoleLogger())
+                {
                     std::cout << "Failed to set the default console logger" << std::endl;
+                }
             } break;
         case 2:
             {
@@ -388,7 +408,9 @@ void setLogger()
                 std::cout << "Enter the file path (without file name) : ";
                 std::cin >> filePath;
                 if (false == SimulatorManager::getInstance()->setFileLogger(filePath))
+                {
                     std::cout << "Failed to set default file logger" << std::endl;
+                }
             } break;
         case 3: SimulatorManager::getInstance()->setLogger(gAppLogger);
     }
@@ -446,7 +468,9 @@ void addInterface()
 
     int index = selectResource();
     if (-1 == index)
+    {
         return;
+    }
 
     SimulatorSingleResourceSP resource = g_singleResources[index - 1];
     resource->addInterface(OC_RSRVD_INTERFACE_SENSOR);
index cd0bf98..13e0da8 100644 (file)
@@ -46,21 +46,68 @@ class AttributeProperty
         };
 
         explicit AttributeProperty(Type type);
-        virtual ~AttributeProperty() {};
+        virtual ~AttributeProperty() {}
 
         Type getType() const;
-        virtual bool isInteger() const { return false; }
-        virtual bool isDouble() const { return false; }
-        virtual bool isBoolean() const { return false; }
-        virtual bool isString() const { return false; }
-        virtual bool isArray() const { return false; }
-        virtual bool isModel() const { return false; }
-        virtual std::shared_ptr<IntegerProperty> asInteger() { return nullptr; }
-        virtual std::shared_ptr<DoubleProperty> asDouble() { return nullptr; }
-        virtual std::shared_ptr<BooleanProperty> asBoolean() { return nullptr; }
-        virtual std::shared_ptr<StringProperty> asString() { return nullptr; }
-        virtual std::shared_ptr<ArrayProperty> asArray() { return nullptr; }
-        virtual std::shared_ptr<ModelProperty> asModel() { return nullptr; }
+        virtual bool isInteger() const
+        {
+            return false;
+        }
+
+        virtual bool isDouble() const
+        {
+            return false;
+        }
+
+        virtual bool isBoolean() const
+        {
+            return false;
+        }
+
+        virtual bool isString() const
+        {
+            return false;
+        }
+
+        virtual bool isArray() const
+        {
+            return false;
+        }
+
+        virtual bool isModel() const
+        {
+            return false;
+        }
+
+        virtual std::shared_ptr<IntegerProperty> asInteger()
+        {
+            return nullptr;
+        }
+
+        virtual std::shared_ptr<DoubleProperty> asDouble()
+        {
+            return nullptr;
+        }
+
+        virtual std::shared_ptr<BooleanProperty> asBoolean()
+        {
+            return nullptr;
+        }
+
+        virtual std::shared_ptr<StringProperty> asString()
+        {
+            return nullptr;
+        }
+
+        virtual std::shared_ptr<ArrayProperty> asArray()
+        {
+            return nullptr;
+        }
+
+        virtual std::shared_ptr<ModelProperty> asModel()
+        {
+            return nullptr;
+        }
 
         virtual bool validate(const AttributeValueVariant &value) = 0;
         virtual AttributeValueVariant buildValue() = 0;
index 08e9fa3..2b69ca1 100644 (file)
@@ -38,7 +38,7 @@ class UnCopyable
         UnCopyable() = default;
         UnCopyable(const UnCopyable &) = delete;
         UnCopyable &operator=(const UnCopyable &) = delete;
-        virtual ~UnCopyable() {};
+        virtual ~UnCopyable() {}
 };
 
 #endif
index 092dfe7..6f9e8dc 100644 (file)
@@ -28,7 +28,9 @@ class JniListenerHolder
         {
             JNIEnv *env = GetEnv();
             if (!env)
+            {
                 return;
+            }
             env->DeleteGlobalRef(m_listener);
             ReleaseEnv();
         }
index af6f142..6ba2371 100644 (file)
@@ -28,7 +28,9 @@ std::map<std::string, std::string> JniQueryParameter::toCpp(jobject jQueryParams
 {
     std::map<std::string, std::string> result;
     if (!jQueryParams)
+    {
         return result;
+    }
 
     static jmethodID entrySetMethodID = m_env->GetMethodID(gSimulatorClassRefs.mapCls, "entrySet",
                                         "()Ljava/util/Set;");
@@ -46,7 +48,9 @@ std::map<std::string, std::string> JniQueryParameter::toCpp(jobject jQueryParams
     jobject entrySet = m_env->CallObjectMethod(jQueryParams, entrySetMethodID);
     jobject iterator = m_env->CallObjectMethod(entrySet, iteratorMethodID);
     if (!entrySet || !iterator || m_env->ExceptionCheck())
+    {
         return result;
+    }
 
     while (m_env->CallBooleanMethod(iterator, hasNextMethodID))
     {
index 386a801..1ab726d 100644 (file)
@@ -38,7 +38,9 @@ jobject JniVector::toJava(std::vector<std::string> &cppVector)
 
     jobject vectorObject = toJava();
     if (!vectorObject)
+    {
         return nullptr;
+    }
 
     for (size_t index = 0; index < cppVector.size(); index++)
     {
@@ -98,4 +100,4 @@ void JniVector::addElementsCpp(jobject vector, int size, std::vector<std::string
         JniString value(m_env, stringObject);
         result.push_back(value.get());
     }
-}
\ No newline at end of file
+}
index 36e7a68..47b17d7 100644 (file)
@@ -37,7 +37,9 @@ static SimulatorCollectionResourceSP simulatorCollectionResourceToCpp(JNIEnv *en
     JniSharedObjectHolder<SimulatorCollectionResource> *jniResource =
         getHandle<JniSharedObjectHolder<SimulatorCollectionResource>>(env, object);
     if (jniResource)
+    {
         return jniResource->get();
+    }
     return nullptr;
 }
 
index 1eb4cb0..3ec9521 100644 (file)
@@ -26,7 +26,9 @@ extern SimulatorClassRefs gSimulatorClassRefs;
 jobject JniDeviceInfo::toJava(DeviceInfo &deviceInfo)
 {
     if (!m_env)
+    {
         return nullptr;
+    }
 
     static jmethodID deviceInfoCtor = m_env->GetMethodID(gSimulatorClassRefs.deviceInfoCls, "<init>",
                                       "()V");
index cb34eba..67c2419 100644 (file)
@@ -95,7 +95,9 @@ JNIEnv *GetEnv()
 {
     std::unique_lock<std::mutex> lock(gJvmMutex);
     if (!gJavaVM)
+    {
         return nullptr;
+    }
 
     JNIEnv *env = nullptr;
     jint ret = gJavaVM->GetEnv((void **)&env, JNI_VERSION_1_6);
@@ -105,7 +107,9 @@ JNIEnv *GetEnv()
             return env;
         case JNI_EDETACHED:
             if (!gJavaVM->AttachCurrentThread((void **)&env, NULL))
+            {
                 return env;
+            }
     }
 
     return nullptr;
@@ -115,7 +119,9 @@ void ReleaseEnv()
 {
     std::unique_lock<std::mutex> lock(gJvmMutex);
     if (!gJavaVM)
+    {
         return;
+    }
     gJavaVM->DetachCurrentThread();
 }
 
@@ -136,11 +142,15 @@ extern "C" {
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
 {
     if (!vm)
+    {
         return JNI_ERR;
+    }
 
     JNIEnv *env = nullptr;
     if (JNI_OK != vm->GetEnv((void **) &env, JNI_VERSION_1_6))
+    {
         return JNI_ERR;
+    }
 
     // Get the class references
     getClassRef(env, OBJECT_CLS, gSimulatorClassRefs.objectCls);
@@ -222,11 +232,15 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void * /*reserved*/)
 {
     if (!vm)
+    {
         return;
+    }
 
     JNIEnv *env = nullptr;
     if (JNI_OK != vm->GetEnv((void **) &env, JNI_VERSION_1_6))
+    {
         return;
+    }
 
     // Release the class global references
     env->DeleteGlobalRef(gSimulatorClassRefs.objectCls);
index b5f8b07..130fb69 100644 (file)
@@ -42,7 +42,9 @@ class JNILogger : public ILogger
         {
             JNIEnv *env = GetEnv();
             if (nullptr == env)
+            {
                 return;
+            }
 
             jobject logger = env->NewLocalRef(m_logger);
             if (!logger)
@@ -82,7 +84,9 @@ static void onResourceFound(jobject listener, SimulatorRemoteResourceSP remoteRe
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID callbackMethod = env->GetMethodID(listenerCls, "onResourceFound",
@@ -90,7 +94,9 @@ static void onResourceFound(jobject listener, SimulatorRemoteResourceSP remoteRe
 
     jobject resource = CreateSimulatorRemoteResource(env, remoteResource);
     if (!resource)
+    {
         return;
+    }
 
     env->CallVoidMethod(listener, callbackMethod, resource);
     ReleaseEnv();
@@ -101,7 +107,9 @@ static void onDeviceInfoReceived(jobject listener, const std::string &hostUri,
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onDeviceFound",
@@ -131,7 +139,9 @@ static void onPlatformInfoReceived(jobject listener, const std::string &hostUri,
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onPlatformFound",
@@ -432,4 +442,4 @@ Java_org_oic_simulator_SimulatorManager_nativeSetLogger
 
 #ifdef __cplusplus
 }
-#endif
\ No newline at end of file
+#endif
index 05b3383..8049adb 100644 (file)
@@ -27,7 +27,9 @@ extern SimulatorClassRefs gSimulatorClassRefs;
 jobject JniPlatformInfo::toJava(PlatformInfo &platformInfo)
 {
     if (!m_env)
+    {
         return nullptr;
+    }
 
     static jmethodID platformInfoCtor = m_env->GetMethodID(gSimulatorClassRefs.platformInfoCls,
                                         "<init>", "()V");
@@ -52,7 +54,9 @@ PlatformInfo JniPlatformInfo::toCpp(jobject jPlatformInfo)
 {
     PlatformInfo platformInfo;
     if (!m_env || !jPlatformInfo)
+    {
         return platformInfo;
+    }
 
     platformInfo.setPlatformID(getFieldValue(jPlatformInfo, "mPlatformId"));
     platformInfo.setManufacturerName(getFieldValue(jPlatformInfo, "mManufacturerName"));
index 477e877..c70dfe5 100644 (file)
@@ -40,7 +40,9 @@ static SimulatorRemoteResourceSP simulatorRemoteResourceToCpp(
     JniSharedObjectHolder<SimulatorRemoteResource> *jniResource =
         getHandle<JniSharedObjectHolder<SimulatorRemoteResource>>(env, object);
     if (jniResource)
+    {
         return jniResource->get();
+    }
     return nullptr;
 }
 
@@ -49,7 +51,9 @@ static void onObserveCallback(jobject listener, const std::string &uid, Simulato
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onObserveNotification",
@@ -66,7 +70,9 @@ static void onGetCallback(jobject listener, const std::string &uid, SimulatorRes
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onGetResponse",
@@ -85,7 +91,9 @@ static void onPutCallback(jobject listener, const std::string &uid, SimulatorRes
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onPutResponse",
@@ -104,7 +112,9 @@ static void onPostCallback(jobject listener, const std::string &uid, SimulatorRe
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = env->GetMethodID(listenerCls, "onPostResponse",
@@ -123,7 +133,9 @@ static void onVerificationCallback(jobject listener, const std::string &uid, int
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethodId = nullptr;
@@ -149,7 +161,9 @@ static void onVerificationCallback(jobject listener, const std::string &uid, int
     }
 
     if (OP_COMPLETE == opState || OP_ABORT == opState)
+    {
         env->DeleteGlobalRef(listener);
+    }
     ReleaseEnv();
 }
 
index 49c2188..22dd2c0 100644 (file)
@@ -44,7 +44,9 @@ bool SimulatorResourceAttributeToCpp(JNIEnv *env, jobject jAttribute,
                                      SimulatorResourceAttribute &attribute)
 {
     if (!jAttribute)
+    {
         return false;
+    }
 
     static jfieldID nameFID = env->GetFieldID(gSimulatorClassRefs.simulatorResourceAttributeCls,
                               "mName", "Ljava/lang/String;");
@@ -58,7 +60,9 @@ bool SimulatorResourceAttributeToCpp(JNIEnv *env, jobject jAttribute,
     jobject jAttrProperty = env->GetObjectField(jAttribute, propertyFID);
 
     if (!jAttrName || !jAttrValue)
+    {
         return false;
+    }
 
     JniString attrName(env, jAttrName);
     AttributeValueVariant value;
@@ -90,4 +94,4 @@ jobject SimulatorResourceAttributesToJava(JNIEnv *env,
     }
 
     return jAttributesMap.get();
-}
\ No newline at end of file
+}
index 2adfd65..3140f90 100644 (file)
@@ -36,7 +36,9 @@ SimulatorResourceSP SimulatorResourceToCpp(JNIEnv *env, jobject object)
     JniSharedObjectHolder<SimulatorResource> *jniResource =
         getHandle<JniSharedObjectHolder<SimulatorResource>>(env, object);
     if (jniResource)
+    {
         return jniResource->get();
+    }
     return nullptr;
 }
 
@@ -58,7 +60,9 @@ static jobject createObserverInfoVector(JNIEnv *env,
 {
     jobject vectorObject = JniVector(env).toJava();
     if (!vectorObject)
+    {
         return nullptr;
+    }
 
     static jmethodID addMethod = env->GetMethodID(gSimulatorClassRefs.vectorCls,
                                  "add", "(Ljava/lang/Object;)Z");
@@ -74,7 +78,9 @@ static void onObserverChange(jobject listener, const std::string &uri,
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethod = nullptr;
@@ -101,7 +107,9 @@ static void onResourceModelChange(jobject listener, const std::string &uri,
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethod = env->GetMethodID(listenerCls, "onResourceModelChanged",
index a186d76..870f22c 100644 (file)
@@ -106,7 +106,9 @@ class ValueConverterJava : public boost::static_visitor<jobject>
         {
             jobjectArray jArray = m_env->NewObjectArray(values.size(), getClass(values), nullptr);
             if (!jArray)
+            {
                 return nullptr;
+            }
 
             for (size_t index = 0; index < values.size(); index++)
             {
@@ -122,7 +124,9 @@ class ValueConverterJava : public boost::static_visitor<jobject>
         {
             jobjectArray jArray = m_env->NewObjectArray(values.size(), getClass(values), nullptr);
             if (!jArray)
+            {
                 return nullptr;
+            }
 
             for (size_t index = 0; index < values.size(); index++)
             {
@@ -138,7 +142,9 @@ class ValueConverterJava : public boost::static_visitor<jobject>
         {
             jobjectArray jArray = m_env->NewObjectArray(values.size(), getClass(values), nullptr);
             if (!jArray)
+            {
                 return nullptr;
+            }
 
             for (size_t index = 0; index < values.size(); index++)
             {
@@ -306,7 +312,7 @@ class ValueConverterCpp
             {
                 jobject jElement = m_env->GetObjectArrayElement(array, i);
 
-                int element;
+                int element = 0;
                 getValue(jElement, element);
                 value.push_back(element);
             }
@@ -356,7 +362,7 @@ class ValueConverterCpp
             {
                 jobject jElement = m_env->GetObjectArrayElement(array, i);
 
-                double element;
+                double element = 0;
                 getValue(jElement, element);
                 value.push_back(element);
             }
@@ -406,7 +412,7 @@ class ValueConverterCpp
             {
                 jobject jElement = m_env->GetObjectArrayElement(array, i);
 
-                bool element;
+                bool element = false;
                 getValue(jElement, element);
                 value.push_back(element);
             }
@@ -608,7 +614,9 @@ jobject SimulatorResourceModelToJava(JNIEnv *env, const SimulatorResourceModel &
 bool SimulatorResourceModelToCpp(JNIEnv *env, jobject jResModel, SimulatorResourceModel &resModel)
 {
     if (!jResModel)
+    {
         return false;
+    }
 
     static jfieldID valuesFID = env->GetFieldID(gSimulatorClassRefs.simulatorResourceModelCls,
                                 "mValues", "Ljava/util/Map;");
@@ -659,7 +667,9 @@ bool AttributeValueToCpp(JNIEnv *env, jobject jAttributeValue,
                          AttributeValueVariant &jValue)
 {
     if (!jAttributeValue)
+    {
         return false;
+    }
 
     jValue = JniAttributeValue::toCpp(env, jAttributeValue);
     return true;
index d7e42a1..07db098 100644 (file)
@@ -42,7 +42,9 @@ class JniIntegerProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<IntegerProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java IntegerProperty.Builder object
             jobject jPropertyBuilder = nullptr;
@@ -138,7 +140,9 @@ class JniDoubleProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<DoubleProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java DoubleProperty.Builder object
             jobject jPropertyBuilder = nullptr;
@@ -235,7 +239,9 @@ class JniBooleanProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<BooleanProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java BooleanProperty.Builder object
             jobject jPropertyBuilder = nullptr;
@@ -270,7 +276,9 @@ class JniStringProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<StringProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java StringProperty.Builder object
             jobject jPropertyBuilder = nullptr;
@@ -343,7 +351,9 @@ class JniStringProperty
                 jint min = env->GetIntField(jProperty, minFID);
                 jint max = env->GetIntField(jProperty, maxFID);
                 if (min >= 0 && max >= 0)
+                {
                     stringProperty->setRange(static_cast<size_t>(min), static_cast<size_t>(max));
+                }
             }
             else
             {
@@ -373,7 +383,9 @@ class JniArrayProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<ArrayProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java ArrayProperty.Builder object
             jobject jPropertyBuilder = nullptr;
@@ -453,7 +465,9 @@ class JniArrayProperty
                 jint min = env->GetIntField(jProperty, minFID);
                 jint max = env->GetIntField(jProperty, maxFID);
                 if (min >= 0 && max >= 0)
+                {
                     arrayProperty->setRange(static_cast<size_t>(min), static_cast<size_t>(max));
+                }
             }
 
             if (jElementProperty)
@@ -471,7 +485,9 @@ class JniModelProperty
         static jobject toJava(JNIEnv *env, const std::shared_ptr<ModelProperty> &property)
         {
             if (!property)
+            {
                 return nullptr;
+            }
 
             // Create Java ModelProperty object
             jobject jModelProperty = nullptr;
@@ -547,7 +563,9 @@ jobject AttributePropertyToJava(JNIEnv *env,
                                 const std::shared_ptr<AttributeProperty> &property)
 {
     if (!property)
+    {
         return nullptr;
+    }
 
     if (property->isInteger())
     {
@@ -581,7 +599,9 @@ std::shared_ptr<AttributeProperty> AttributePropertyToCpp(JNIEnv *env,
         jobject &jProperty)
 {
     if (!jProperty)
+    {
         return nullptr;
+    }
 
     switch (getType(env, jProperty))
     {
index 10eee4c..aafe0c8 100644 (file)
 jobject CreateSingleResource(JNIEnv *env, SimulatorResourceSP singleResource)
 {
     if (!singleResource)
+    {
         return nullptr;
+    }
 
     auto *objectHolder = JniSharedObjectHolder<SimulatorResource>::create(singleResource);
     if (!objectHolder)
+    {
         return nullptr;
+    }
 
     static jmethodID simulatorSingleResourceCtor = env->GetMethodID(
                 gSimulatorClassRefs.simulatorSingleResourceCls, "<init>", "(J)V");
@@ -49,11 +53,15 @@ jobject CreateSingleResource(JNIEnv *env, SimulatorResourceSP singleResource)
 jobject CreateCollectionResource(JNIEnv *env, SimulatorResourceSP collectionResource)
 {
     if (!collectionResource)
+    {
         return nullptr;
+    }
 
     auto *objectHolder = JniSharedObjectHolder<SimulatorResource>::create(collectionResource);
     if (!objectHolder)
+    {
         return nullptr;
+    }
 
     static jmethodID simulatorCollectionResourceCtor = env->GetMethodID(
                 gSimulatorClassRefs.simulatorCollectionResourceCls, "<init>", "(J)V");
@@ -71,21 +79,29 @@ jobject CreateCollectionResource(JNIEnv *env, SimulatorResourceSP collectionReso
 jobject CreateSimulatorResource(JNIEnv *env, SimulatorResourceSP resource)
 {
     if (!resource)
+    {
         return nullptr;
+    }
 
     if (SimulatorResource::Type::COLLECTION_RESOURCE == resource->getType())
+    {
         return CreateCollectionResource(env, resource);
+    }
     return CreateSingleResource(env, resource);
 }
 
 jobject CreateSimulatorResourceVector(JNIEnv *env, std::vector<SimulatorResourceSP> &resources)
 {
     if (!resources.size())
+    {
         return nullptr;
+    }
 
     jobject vectorObject = JniVector(env).toJava();
     if (!vectorObject)
+    {
         return nullptr;
+    }
 
     static jmethodID addMethod = env->GetMethodID(gSimulatorClassRefs.vectorCls,
                                  "add", "(Ljava/lang/Object;)Z");
@@ -99,11 +115,15 @@ jobject CreateSimulatorResourceVector(JNIEnv *env, std::vector<SimulatorResource
 jobject CreateSimulatorRemoteResource(JNIEnv *env, SimulatorRemoteResourceSP &remoteResource)
 {
     if (!remoteResource)
+    {
         return nullptr;
+    }
 
     auto *objectHolder = JniSharedObjectHolder<SimulatorRemoteResource>::create(remoteResource);
     if (!objectHolder)
+    {
         return nullptr;
+    }
 
     static jmethodID simulatorRemoteResourceCtor = env->GetMethodID(
                 gSimulatorClassRefs.simulatorRemoteResourceCls, "<init>", "(J)V");
@@ -155,4 +175,4 @@ jobject CreateSimulatorRemoteResource(JNIEnv *env, SimulatorRemoteResourceSP &re
     env->SetBooleanField(resource, isObservableID, remoteResource->isObservable());
 
     return resource;
-}
\ No newline at end of file
+}
index a2dc1a1..7c638ca 100644 (file)
@@ -37,7 +37,9 @@ static SimulatorSingleResourceSP simulatorSingleResourceToCpp(JNIEnv *env, jobje
     JniSharedObjectHolder<SimulatorSingleResource> *jniResource =
         getHandle<JniSharedObjectHolder<SimulatorSingleResource>>(env, object);
     if (jniResource)
+    {
         return jniResource->get();
+    }
     return nullptr;
 }
 
@@ -54,7 +56,9 @@ static void onAutoUpdationComplete(jobject listener, const std::string &uri, con
 {
     JNIEnv *env = GetEnv();
     if (!env)
+    {
         return;
+    }
 
     jclass listenerCls = env->GetObjectClass(listener);
     jmethodID listenerMethod = env->GetMethodID(listenerCls, "onUpdateComplete",
@@ -81,7 +85,9 @@ Java_org_oic_simulator_server_SimulatorSingleResource_nativeGetAttribute
     JniString jniAttrName(env, jAttrName);
     SimulatorResourceAttribute attribute;
     if (singleResource->getAttribute(jniAttrName.get(), attribute))
+    {
         return SimulatorResourceAttributeToJava(env, attribute);
+    }
     return nullptr;
 }
 
index 0dbf0bb..2cf3266 100644 (file)
@@ -64,11 +64,17 @@ namespace RAML
             std::string extension = value.substr(found + 1);\r
             if (std::find(Keys::AllowedRamlYamlTypes.begin(), Keys::AllowedRamlYamlTypes.end(),\r
                           extension) != Keys::AllowedRamlYamlTypes.end())\r
+            {\r
                 fileType = IncludeResolver::FileType::NODE;\r
+            }\r
             else if (extension == Keys::Json)\r
+            {\r
                 fileType = IncludeResolver::FileType::JSON;\r
+            }\r
             else\r
+            {\r
                 fileType = IncludeResolver::FileType::FILE;\r
+            }\r
         }\r
         return fileType;\r
     }\r
@@ -83,7 +89,9 @@ namespace RAML
         std::string val = file.as<std::string>();\r
         std::ifstream fin((m_path + val).c_str());\r
         if (!fin)\r
+        {\r
             throw RamlParserException("Error Include File not present " + m_path + val);\r
+        }\r
         std::stringstream buffer;\r
         buffer << fin.rdbuf();\r
         return buffer.str();\r
@@ -92,7 +100,9 @@ namespace RAML
     {\r
         std::ifstream fin((m_path + jsonFileName).c_str());\r
         if (!fin)\r
+        {\r
             throw JsonException("Error Json Referenced File not present " + m_path + jsonFileName);\r
+        }\r
         std::stringstream buffer;\r
         buffer << fin.rdbuf();\r
         std::string str = buffer.str();\r
index 07a57c9..9a36e09 100644 (file)
@@ -108,7 +108,9 @@ namespace RAML
                             for (; iter != schemas.end(); iter++)\r
                             {\r
                                 if (((*iter).first) == schemaValue)\r
+                                {\r
                                     break;\r
+                                }\r
                             }\r
                             if (iter != schemas.end())\r
                             {\r
@@ -136,17 +138,23 @@ namespace RAML
             for (; iter != resourceTypes.end(); iter++)\r
             {\r
                 if (((*iter).first) == typeValue)\r
+                {\r
                     break;\r
+                }\r
             }\r
             if (iter != resourceTypes.end())\r
             {\r
                 if ((*iter).second->getActions().empty())\r
+                {\r
                     return;\r
+                }\r
 \r
                 for (auto resActions : (*iter).second->getActions())\r
                 {\r
                     if (it.second->getActions().count(resActions.first) == 0)\r
+                    {\r
                         it.second->setAction(resActions.first, std::make_shared<Action>(*(resActions.second)));\r
+                    }\r
                 }\r
             }\r
             setTypes(it.second->getResources());\r
@@ -169,24 +177,32 @@ namespace RAML
                     for (; iter != trait.end(); iter++)\r
                     {\r
                         if (((*iter).first) == traitValue)\r
+                        {\r
                             break;\r
+                        }\r
                     }\r
                     if (iter != trait.end())\r
                     {\r
                         for (auto head : (*iter).second->getHeaders())\r
                         {\r
                             if (act.second->getHeaders().count(head.first) == 0)\r
+                            {\r
                                 act.second->setHeader(head.first, head.second);\r
+                            }\r
                         }\r
                         for (auto query : (*iter).second->getQueryParameters())\r
                         {\r
                             if (act.second->getQueryParameters().count(query.first) == 0)\r
+                            {\r
                                 act.second->setQueryParameter(query.first, query.second);\r
+                            }\r
                         }\r
                         for (auto resp : (*iter).second->getResponses())\r
                         {\r
                             if (act.second->getResponses().count(resp.first) == 0)\r
+                            {\r
                                 act.second->setResponse(resp.first, resp.second);\r
+                            }\r
                         }\r
                     }\r
                 }\r
@@ -197,7 +213,9 @@ namespace RAML
                 for (; iter != trait.end(); iter++)\r
                 {\r
                     if (((*iter).first) == traitValue)\r
+                    {\r
                         break;\r
+                    }\r
                 }\r
                 if (iter != trait.end())\r
                 {\r
@@ -206,17 +224,23 @@ namespace RAML
                         for (auto head : (*iter).second->getHeaders())\r
                         {\r
                             if (act.second->getHeaders().count(head.first) == 0)\r
+                            {\r
                                 act.second->setHeader(head.first, head.second);\r
+                            }\r
                         }\r
                         for (auto query : (*iter).second->getQueryParameters())\r
                         {\r
                             if (act.second->getQueryParameters().count(query.first) == 0)\r
+                            {\r
                                 act.second->setQueryParameter(query.first, query.second);\r
+                            }\r
                         }\r
                         for (auto resp : (*iter).second->getResponses())\r
                         {\r
                             if (act.second->getResponses().count(resp.first) == 0)\r
+                            {\r
                                 act.second->setResponse(resp.first, resp.second);\r
+                            }\r
                         }\r
                     }\r
                 }\r
index f662469..4426504 100644 (file)
@@ -59,7 +59,9 @@ namespace RAML
         for (; it != m_required.end(); ++it)\r
         {\r
             if (*it == reqValue)\r
+            {\r
                 break;\r
+            }\r
         }\r
         if (m_required.end() == it)\r
         {\r
index b6afe8a..f5aa47c 100644 (file)
@@ -124,7 +124,10 @@ namespace RAML
                  *\r
                  * @return size of Properties map\r
                  */\r
-            int propertiesSize() const { return m_properties.size(); }\r
+            int propertiesSize() const\r
+            {\r
+                return m_properties.size();\r
+            }\r
 \r
             /**\r
                  * This method is for getting Properties from Definitions.\r
index bbd1aaf..766178a 100644 (file)
@@ -32,7 +32,9 @@ namespace RAML
     void JsonSchema::readJson()\r
     {\r
         if (! m_cjson)\r
+        {\r
             return;\r
+        }\r
 \r
         cJSON *jsonId = cJSON_GetObjectItem(m_cjson, "id");\r
         if (jsonId)\r
@@ -90,9 +92,13 @@ namespace RAML
 \r
         cJSON *jsonAdditionalProperties = cJSON_GetObjectItem(m_cjson, "additionalProperties");\r
         if (jsonAdditionalProperties)\r
+        {\r
             m_additionalProperties = (jsonAdditionalProperties->type == cJSON_True);\r
+        }\r
         else\r
+        {\r
             m_additionalProperties = true;\r
+        }\r
 \r
         cJSON *jsonReference = cJSON_GetObjectItem(m_cjson, "$ref");\r
         if (jsonReference)\r
@@ -109,7 +115,9 @@ namespace RAML
                 setRequiredValue(it);\r
             }\r
             if (m_type.empty())\r
+            {\r
                 m_type = param.getType();\r
+            }\r
         }\r
         cJSON *jsonAllOf = cJSON_GetObjectItem(m_cjson, "allOf");\r
         if (jsonAllOf)\r
@@ -127,7 +135,9 @@ namespace RAML
                 setRequiredValue(it);\r
             }\r
             if (m_type.empty())\r
+            {\r
                 m_type = param.getType();\r
+            }\r
         }\r
         cJSON *jsonRequiredValues = cJSON_GetObjectItem(m_cjson, "required");\r
         if (jsonRequiredValues)\r
@@ -195,7 +205,9 @@ namespace RAML
                 definition->setRequiredValue(it);\r
             }\r
             if (definition->getType().empty())\r
+            {\r
                 definition->setType(param.getType());\r
+            }\r
         }\r
         cJSON *defAllOf = cJSON_GetObjectItem(childDefinitions, "allOf");\r
         if (defAllOf)\r
@@ -212,7 +224,9 @@ namespace RAML
                 definition->setRequiredValue(it);\r
             }\r
             if (definition->getType().empty())\r
+            {\r
                 definition->setType(param.getType());\r
+            }\r
         }\r
         return definition;\r
     }\r
@@ -267,9 +281,13 @@ namespace RAML
         else if (defaultValue->type == cJSON_Number)\r
         {\r
             if (attType == "number")\r
+            {\r
                 property->setValue((double)defaultValue->valuedouble);\r
+            }\r
             else\r
+            {\r
                 property->setValue((int)defaultValue->valueint );\r
+            }\r
         }\r
         else if (defaultValue->type == cJSON_True)\r
         {\r
@@ -296,7 +314,9 @@ namespace RAML
             while ( ++idx < size);\r
             property->setValueProperty(std::make_shared<ValueProperty>(allwdValues));\r
             if (attType.empty())\r
+            {\r
                 attType = "string";\r
+            }\r
         }\r
         else if ((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_Number)\r
         {\r
@@ -322,7 +342,9 @@ namespace RAML
                 while ( ++idx < size);\r
                 property->setValueProperty(std::make_shared<ValueProperty>(allwdValues));\r
                 if (attType.empty())\r
+                {\r
                     attType = "integer";\r
+                }\r
             }\r
         }\r
         else if (((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_True)\r
@@ -334,14 +356,20 @@ namespace RAML
             do\r
             {\r
                 if (cJSON_GetArrayItem(allowedvalues, idx)->type != cJSON_False)\r
+                {\r
                     allwdValues.push_back(true);\r
+                }\r
                 else\r
+                {\r
                     allwdValues.push_back(false);\r
+                }\r
             }\r
             while ( ++idx < size);\r
             property->setValueProperty(std::make_shared<ValueProperty>(allwdValues));\r
             if (attType.empty())\r
+            {\r
                 attType = "boolean";\r
+            }\r
         }\r
     }\r
 \r
@@ -380,12 +408,18 @@ namespace RAML
             if (exclusiveMax)\r
             {\r
                 if (exclusiveMax->type == cJSON_True)\r
+                {\r
                     max = --(stringMax->valueint);\r
+                }\r
                 else\r
+                {\r
                     max = stringMax->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 max = stringMax->valueint;\r
+            }\r
         }\r
         cJSON *stringMin = cJSON_GetObjectItem(childProperties, "minLength");\r
         if (stringMin)\r
@@ -394,15 +428,24 @@ namespace RAML
             if (exclusiveMin)\r
             {\r
                 if (exclusiveMin->type == cJSON_True)\r
+                {\r
                     min = ++(stringMin->valueint);\r
+                }\r
                 else\r
+                {\r
                     min = stringMin->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 min = stringMin->valueint;\r
+            }\r
         }\r
+\r
         if (min != INT_MIN || max != INT_MAX)\r
+        {\r
             property->setValueProperty(std::make_shared<ValueProperty>(min, max, 0));\r
+        }\r
 \r
         cJSON *stringFormat = cJSON_GetObjectItem(childProperties, "format");\r
         if (stringFormat)\r
@@ -429,12 +472,18 @@ namespace RAML
             if (exclusiveMax)\r
             {\r
                 if (exclusiveMax->type == cJSON_True)\r
+                {\r
                     max = --(Max->valueint);\r
+                }\r
                 else\r
+                {\r
                     max = Max->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 max = Max->valueint;\r
+            }\r
         }\r
         cJSON *Min = cJSON_GetObjectItem(childProperties, "minimum");\r
         if (Min)\r
@@ -443,12 +492,18 @@ namespace RAML
             if (exclusiveMin)\r
             {\r
                 if (exclusiveMin->type == cJSON_True)\r
+                {\r
                     min = ++(Min->valueint);\r
+                }\r
                 else\r
+                {\r
                     min = Min->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 min = Min->valueint;\r
+            }\r
         }\r
         cJSON *MultipleOff = cJSON_GetObjectItem(childProperties, "multipleOf");\r
         if (MultipleOff)\r
@@ -456,8 +511,9 @@ namespace RAML
             multipleOf = MultipleOff->valueint;\r
         }\r
         if (min != INT_MIN || max != INT_MAX)\r
+        {\r
             property->setValueProperty(std::make_shared<ValueProperty>(min, max, multipleOf));\r
-\r
+        }\r
     }\r
 \r
     void JsonSchema::readDouble(cJSON *childProperties,  PropertiesPtr &property)\r
@@ -471,12 +527,18 @@ namespace RAML
             if (exclusiveMax)\r
             {\r
                 if (exclusiveMax->type == cJSON_True)\r
+                {\r
                     max = --(Max->valuedouble);\r
+                }\r
                 else\r
+                {\r
                     max = Max->valuedouble;\r
+                }\r
             }\r
             else\r
+            {\r
                 max = Max->valuedouble;\r
+            }\r
         }\r
         cJSON *Min = cJSON_GetObjectItem(childProperties, "minimum");\r
         if (Min)\r
@@ -485,12 +547,18 @@ namespace RAML
             if (exclusiveMin)\r
             {\r
                 if (exclusiveMin->type == cJSON_True)\r
+                {\r
                     min = ++(Min->valuedouble);\r
+                }\r
                 else\r
+                {\r
                     min = Min->valuedouble;\r
+                }\r
             }\r
             else\r
+            {\r
                 min = Min->valuedouble;\r
+            }\r
         }\r
 \r
         cJSON *MultipleOff = cJSON_GetObjectItem(childProperties, "multipleOf");\r
@@ -499,8 +567,9 @@ namespace RAML
             multipleOf = MultipleOff->valueint;\r
         }\r
         if (min != INT_MIN || max != INT_MAX)\r
+        {\r
             property->setValueProperty(std::make_shared<ValueProperty>(min, max, multipleOf));\r
-\r
+        }\r
     }\r
 \r
     void JsonSchema::readArray(cJSON *childProperties,  PropertiesPtr &property)\r
@@ -534,12 +603,18 @@ namespace RAML
             if (exclusiveMax)\r
             {\r
                 if (exclusiveMax->type == cJSON_True)\r
+                {\r
                     max = --(itemsMax->valueint);\r
+                }\r
                 else\r
+                {\r
                     max = itemsMax->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 max = itemsMax->valueint;\r
+            }\r
         }\r
         cJSON *itemsMin = cJSON_GetObjectItem(childProperties, "minItems");\r
         if (itemsMin)\r
@@ -548,12 +623,18 @@ namespace RAML
             if (exclusiveMin)\r
             {\r
                 if (exclusiveMin->type == cJSON_True)\r
+                {\r
                     min = ++(itemsMin->valueint);\r
+                }\r
                 else\r
+                {\r
                     min = itemsMin->valueint;\r
+                }\r
             }\r
             else\r
+            {\r
                 min = itemsMin->valueint;\r
+            }\r
         }\r
         cJSON *uniqueItems = cJSON_GetObjectItem(childProperties, "uniqueItems");\r
         if (uniqueItems)\r
@@ -731,7 +812,9 @@ namespace RAML
         std::string name = fileName;\r
         std::transform(name.begin(), name.end(), name.begin(), ::tolower);\r
         if (name.compare("oic.baseresource.json") == 0)\r
+        {\r
             return;\r
+        }\r
 \r
         cJSON *json = m_includeResolver->readToJson(fileName);\r
         JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
@@ -746,14 +829,18 @@ namespace RAML
         std::string name = fileName;\r
         std::transform(name.begin(), name.end(), name.begin(), ::tolower);\r
         if (name.compare("oic.baseresource.json") == 0)\r
+        {\r
             return;\r
+        }\r
 \r
         cJSON *json = m_includeResolver->readToJson(fileName);\r
         JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
 \r
         DefinitionsPtr definition = Refparser->getDefinition(defName);\r
         if (definition == nullptr)\r
+        {\r
             throw JsonException("Definition Name Incorrect");\r
+        }\r
 \r
         param.addProperties(definition->getProperties());\r
         param.addRequired(definition->getRequiredValues());\r
@@ -813,7 +900,9 @@ namespace RAML
                 if (!(defName.empty()))\r
                 {\r
                     if (getDefinition(defName) == nullptr)\r
+                    {\r
                         throw JsonException("Definition Name Incorrect");\r
+                    }\r
                     param.addProperties(getDefinition(defName)->getProperties());\r
                     param.addRequired(getDefinition(defName)->getRequiredValues());\r
                     param.setType(getDefinition(defName)->getType());\r
index 333e571..9f8463b 100644 (file)
@@ -255,25 +255,49 @@ namespace RAML
             class JsonParameters\r
             {\r
                 public:\r
-                    std::map<std::string, PropertiesPtr > getProperties() const { return m_properties; }\r
-                    void addProperties(const std::string &name, const PropertiesPtr &prop) { m_properties[name] = prop; }\r
+                    std::map<std::string, PropertiesPtr > getProperties() const\r
+                    {\r
+                        return m_properties;\r
+                    }\r
+\r
+                    void addProperties(const std::string &name, const PropertiesPtr &prop)\r
+                    {\r
+                        m_properties[name] = prop;\r
+                    }\r
+\r
                     void addProperties(const std::map<std::string, PropertiesPtr > &properties)\r
                     {\r
                         for (auto prop : properties)\r
                             m_properties[prop.first] = prop.second;\r
                     }\r
-                    std::vector<std::string> getRequired() const { return m_required; }\r
-                    void addRequired(const std::string &req) { m_required.push_back(req); }\r
+\r
+                    std::vector<std::string> getRequired() const\r
+                    {\r
+                        return m_required;\r
+                    }\r
+\r
+                    void addRequired(const std::string &req)\r
+                    {\r
+                        m_required.push_back(req);\r
+                    }\r
+\r
                     void addRequired(const std::vector<std::string> &required)\r
                     {\r
                         for (auto req : required)\r
                             m_required.push_back(req);\r
                     }\r
-                    std::string getType() const { return m_type; }\r
+\r
+                    std::string getType() const\r
+                    {\r
+                        return m_type;\r
+                    }\r
+\r
                     void setType(const std::string &type)\r
                     {\r
                         if (m_type.empty())\r
+                        {\r
                             m_type = type;\r
+                        }\r
                     }\r
 \r
                 private:\r
index 8905525..9f1a9a8 100644 (file)
@@ -121,13 +121,21 @@ namespace RAML
         else if (!m_typeString.empty()) //to read properties even if default value is not present\r
         {\r
             if (m_typeString == "string")\r
+            {\r
                 return Properties::TypeInfo(VariantType::STRING, VariantType::STRING, 0);\r
+            }\r
             else if (m_typeString == "integer")\r
+            {\r
                 return Properties::TypeInfo(VariantType::INTEGER, VariantType::INTEGER, 0);\r
+            }\r
             else if (m_typeString == "number")\r
+            {\r
                 return Properties::TypeInfo(VariantType::DOUBLE, VariantType::DOUBLE, 0);\r
+            }\r
             else if (m_typeString == "boolean")\r
+            {\r
                 return Properties::TypeInfo(VariantType::BOOLEAN, VariantType::BOOLEAN, 0);\r
+            }\r
         }\r
         return Properties::TypeInfo();\r
     }\r
@@ -161,7 +169,9 @@ namespace RAML
     {\r
         if (m_type == rhs.type() && m_baseType == rhs.baseType()\r
             && m_depth == rhs.depth())\r
+        {\r
             return true;\r
+        }\r
         return false;\r
     }\r
 \r
@@ -170,14 +180,18 @@ namespace RAML
     {\r
         if (m_type != rhs.type() || m_baseType != rhs.baseType()\r
             || m_depth != rhs.depth())\r
+        {\r
             return true;\r
+        }\r
         return false;\r
     }\r
 \r
     ValueVariant Properties::getValue() const\r
     {\r
         if (!isDefaultValue())\r
+        {\r
             throw JsonException("Reading Empty Property Value");\r
+        }\r
         return *m_value;\r
     }\r
 \r
@@ -218,7 +232,9 @@ namespace RAML
         for (; it != m_required.end(); ++it)\r
         {\r
             if (*it == reqValue)\r
+            {\r
                 break;\r
+            }\r
         }\r
         if (m_required.end() == it)\r
         {\r
@@ -346,10 +362,14 @@ namespace RAML
             m_type = ValueProperty::Type::ARRAY;\r
 \r
             if (minItems > 0)\r
+            {\r
                 m_minItems = minItems;\r
+            }\r
 \r
             if (maxItems != INT_MAX && maxItems > m_minItems)\r
+            {\r
                 m_maxItems = maxItems;\r
+            }\r
 \r
             m_unique = unique;\r
             m_additionalItems = additionalItems;\r
index dd784d8..aa231ea 100644 (file)
@@ -405,7 +405,10 @@ namespace RAML
              *\r
              * @return true if present and false if not present\r
              */\r
-            bool isDefaultValue() const { return ((m_value != nullptr) ? true : false); }\r
+            bool isDefaultValue() const\r
+            {\r
+                return ((m_value != nullptr) ? true : false);\r
+            }\r
 \r
             /**\r
              * This method is for getting ValueProperty from Properties.\r
index f77add3..cc46300 100644 (file)
@@ -159,36 +159,60 @@ namespace RAML
             std::string key = READ_NODE_AS_STRING(it->first);\r
 \r
             if (key == Keys::Description)\r
+            {\r
                 setDescription(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Default)\r
+            {\r
                 setDefaultValue(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::DisplayName)\r
+            {\r
                 setDisplayName(READ_NODE_AS_STRING(it->second));\r
-\r
+            }\r
             else if (key == Keys::Example)\r
+            {\r
                 setExample(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Maximum)\r
+            {\r
                 setMaximum(READ_NODE_AS_LONG(it->second));\r
+            }\r
             else if (key == Keys::Minimum)\r
+            {\r
                 setMinimum(READ_NODE_AS_LONG(it->second));\r
+            }\r
             else if (key == Keys::MaxLength)\r
+            {\r
                 setMaxLength(READ_NODE_AS_INT(it->second));\r
+            }\r
             else if (key == Keys::MinLength)\r
+            {\r
                 setMinLength(READ_NODE_AS_INT(it->second));\r
-\r
+            }\r
             else if (key == Keys::Pattern)\r
+            {\r
                 setPattern(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Repeat)\r
+            {\r
                 setRepeat(READ_NODE_AS_BOOL(it->second));\r
+            }\r
             else if (key == Keys::Required)\r
+            {\r
                 setRequired(READ_NODE_AS_BOOL(it->second));\r
+            }\r
             else if (key == Keys::Type)\r
+            {\r
                 setType(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Enum)\r
             {\r
                 YAML::Node enumNode = it->second;\r
                 for ( YAML::const_iterator tt = enumNode.begin(); tt != enumNode.end(); ++tt )\r
+                {\r
                     setEnumeration(READ_NODE_AS_STRING(*tt));\r
+                }\r
             }\r
         }\r
     }\r
index 2ff29ee..a0b00f8 100644 (file)
@@ -121,7 +121,9 @@ namespace RAML
             std::string key = READ_NODE_AS_STRING(it->first);\r
 \r
             if (key == Keys::Description)\r
+            {\r
                 setDescription(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Responses)\r
             {\r
                 YAML::Node responseNode = it->second;\r
index d455a5a..aabaa31 100644 (file)
@@ -181,10 +181,13 @@ namespace RAML
                             std::string key = READ_NODE_AS_STRING(tt->first);\r
 \r
                             if (key == Keys::Title)\r
+                            {\r
                                 title = READ_NODE_AS_STRING(tt->second);\r
+                            }\r
                             else if (key == Keys::Content)\r
+                            {\r
                                 content = READ_NODE_AS_STRING(tt->second);\r
-\r
+                            }\r
                         }\r
                         setDocumentationItem(std::make_shared<DocumentationItem>(title, content));\r
                     }\r
index 1474796..717d091 100644 (file)
@@ -126,9 +126,13 @@ namespace RAML
             std::string key = READ_NODE_AS_STRING(it->first);\r
 \r
             if (key == Keys::DisplayName)\r
+            {\r
                 setDisplayName(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Description)\r
+            {\r
                 setDescription(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (std::find(Keys::ActionType.begin(), Keys::ActionType.end(), key) !=\r
                      Keys::ActionType.end())\r
             {\r
index a140cee..47831df 100644 (file)
@@ -80,7 +80,9 @@ namespace RAML
                 }\r
             }\r
             else if (key == Keys::Example)\r
+            {\r
                 setExample(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::FormParameters)\r
             {\r
                 YAML::Node paramNode = it->second;\r
index 0e0e80d..0c628de 100644 (file)
@@ -126,7 +126,9 @@ namespace RAML
             RequestResponseBody(const std::string &type, const YAML::Node &yamlNode,\r
                                 const IncludeResolverPtr &includeResolver): m_schema(NULL),\r
                 m_includeResolver(includeResolver)\r
-            { readRequestResponseBody(type, yamlNode); }\r
+            {\r
+                readRequestResponseBody(type, yamlNode);\r
+            }\r
 \r
         private:\r
             virtual void readRequestResponseBody(const std::string &type,\r
index 4897dc4..2d55285 100644 (file)
@@ -63,7 +63,9 @@ namespace RAML
             std::string key = READ_NODE_AS_STRING(it->first);\r
 \r
             if (key == Keys::Description)\r
+            {\r
                 setDescription(READ_NODE_AS_STRING(it->second));\r
+            }\r
             else if (key == Keys::Body)\r
             {\r
                 YAML::Node responseBody = it->second;\r
index bc0cda0..cb27d47 100644 (file)
@@ -82,14 +82,19 @@ void POSTRequestGenerator::SendAllRequests()
 
         for (auto &attributeGen : attributeGenList)
         {
-            if (m_stopRequested) break;
+            if (m_stopRequested)
+            {
+                break;
+            }
 
             while (!m_stopRequested && attributeGen.hasNext())
             {
                 SimulatorResourceModel repModel;
                 SimulatorResourceAttribute attribute;
                 if (true == attributeGen.next(attribute))
+                {
                     repModel.add(attribute.getName(), attribute.getValue());
+                }
 
                 // Send the request
                 m_requestSender.send(queryParam, repModel,
@@ -128,4 +133,4 @@ void POSTRequestGenerator::completed()
             m_callback(m_id, OP_COMPLETE);
         }
     }
-}
\ No newline at end of file
+}
index 1e51e7e..a5cf2db 100644 (file)
@@ -50,10 +50,14 @@ std::map<std::string, std::string> QPGenerator::next()
 {
     std::map<std::string, std::string> queryParams;
     if (!hasNext())
+    {
         return queryParams;
+    }
 
     for (auto ele : m_qpDetails)
+    {
         queryParams[ele.key] = ele.values[ele.index];
+    }
 
     for (int index = m_qpDetails.size() - 1; index >= 0; index--)
     {
@@ -70,4 +74,4 @@ std::map<std::string, std::string> QPGenerator::next()
     }
 
     return queryParams;
-}
\ No newline at end of file
+}
index 7749ab5..4e9830c 100644 (file)
@@ -186,7 +186,9 @@ void RequestAutomationMngr::onProgressChange(int sessionId, OperationState state
         RequestGeneration::ProgressStateCallback clientCallback)
 {
     if (!isValid(sessionId))
+    {
         return;
+    }
 
     // Remove the request generator from list if it is completed
     if (state == OP_COMPLETE || state == OP_ABORT)
@@ -215,7 +217,9 @@ bool RequestAutomationMngr::isInProgress(RequestType type)
     for (auto &session : m_requestGenList)
     {
         if ((session.second)->type() == type)
+        {
             return true;
+        }
     }
 
     return false;
index eae6082..7c098bd 100644 (file)
@@ -30,8 +30,14 @@ class RequestGeneration
 
         RequestGeneration(RequestType type, int id,
                           ProgressStateCallback callback);
-        RequestType type() const { return m_type;}
-        int id() const {return m_id;}
+        RequestType type() const
+        {
+            return m_type;
+        }
+        int id() const
+        {
+            return m_id;
+        }
         void start();
         void stop();
 
index aacc6b0..221d609 100644 (file)
@@ -149,13 +149,17 @@ void SimulatorRemoteResourceImpl::observe(ObserveType type,
 
     OC::ObserveType observeType = OC::ObserveType::Observe;
     if (type == ObserveType::OBSERVE_ALL)
+    {
         observeType = OC::ObserveType::ObserveAll;
+    }
 
     try
     {
         OCStackResult ocResult = m_ocResource->observe(observeType, queryParams, observeCallback);
         if (OC_STACK_OK != ocResult)
+        {
             throw SimulatorException(static_cast<SimulatorResult>(ocResult), OC::OCException::reason(ocResult));
+        }
 
         SIM_LOG(ILogger::INFO, "[URI: " << getURI() << "] Sent OBSERVE request.")
     }
index 50a18ca..adf9b79 100644 (file)
@@ -42,14 +42,18 @@ AttributeGenerator::AttributeGenerator(const std::string &name,
 bool AttributeGenerator::hasNext()
 {
     if (m_valueGen)
+    {
         return m_valueGen->hasNext();
+    }
     return false;
 }
 
 bool AttributeGenerator::next(SimulatorResourceAttribute &attribute)
 {
     if (!hasNext())
+    {
         return false;
+    }
 
     if (m_valueGen)
     {
@@ -74,7 +78,9 @@ SimulatorResourceAttribute AttributeGenerator::current()
 void AttributeGenerator::reset()
 {
     if (m_valueGen)
+    {
         m_valueGen->reset();
+    }
 }
 
 AttributeCombinationGen::AttributeCombinationGen(
@@ -126,7 +132,9 @@ bool AttributeCombinationGen::next(SimulatorResourceModel &resModel)
             if (!m_attrGenList[index].hasNext())
             {
                 if (!index)
+                {
                     return false;
+                }
 
                 m_attrGenList[index].reset();
                 updateAttributeInModel(index);
@@ -148,5 +156,7 @@ void AttributeCombinationGen::updateAttributeInModel(int index)
 {
     SimulatorResourceAttribute attribute;
     if (m_attrGenList[index].next(attribute))
+    {
         m_resModel.update(attribute.getName(), attribute.getValue());
+    }
 }
index 188b615..b47886b 100644 (file)
@@ -24,7 +24,9 @@ std::unique_ptr<AttributeValueGen> AttributeValueGenFactory::create(
     const std::shared_ptr<AttributeProperty> &property)
 {
     if (!property)
+    {
         return nullptr;
+    }
 
     if (property->isInteger())
     {
index b277b1a..bbb344d 100644 (file)
@@ -52,7 +52,9 @@ std::shared_ptr<SimulatorResourceModelSchema> RequestModel::getRequestRepSchema(
 ResponseModelSP RequestModel::getResponseModel(int code)
 {
     if (m_responseList.end() != m_responseList.find(code))
+    {
         return m_responseList[code];
+    }
 
     return nullptr;
 }
@@ -66,7 +68,9 @@ void RequestModel::setQueryParams(const std::string &key,
                                   const std::vector<std::string> &values)
 {
     if (0 != values.size())
+    {
         m_queryParams[key] = values;
+    }
 }
 
 void RequestModel::addQueryParam(const std::string &key, const std::string &value)
@@ -77,7 +81,9 @@ void RequestModel::addQueryParam(const std::string &key, const std::string &valu
 void RequestModel::setResponseModel(int code, ResponseModelSP &responseModel)
 {
     if (responseModel)
+    {
         m_responseList[code] = responseModel;
+    }
 }
 
 void RequestModel::setRequestBodyModel(const std::shared_ptr<SimulatorResourceModelSchema>
index ff62586..51257a9 100644 (file)
@@ -57,7 +57,9 @@ std::unordered_map<std::string, RequestModelSP> RequestModelBuilder::build(
     {
         // Pick the resource based on the resource uri.
         if (std::string::npos == uri.find((resource.second)->getResourceUri()))
+        {
             continue;
+        }
 
         // Construct Request and Response Model from RAML::Action
         for (auto &action :  (resource.second)->getActions())
index 372287e..6549976 100644 (file)
@@ -48,7 +48,9 @@ std::shared_ptr<SimulatorResourceModelSchema> ResourceModelSchemaBuilder::build(
         auto attributeProperty = buildAttribute(property);
 
         if (!attributeProperty)
+        {
             return nullptr;
+        }
 
         modelSchema->add(property->getName(), attributeProperty);
     }
index d2b89f5..f52e799 100644 (file)
@@ -42,14 +42,18 @@ class FileLogger : public ILogger
         bool open()
         {
             if (!m_out.is_open())
+            {
                 m_out.open(m_filePath, std::ofstream::out);
+            }
             return m_out.is_open();
         }
 
         void close()
         {
             if (m_out.is_open())
+            {
                 m_out.close();
+            }
         }
 
         void write(std::string time, ILogger::Level level, std::string message)
@@ -65,7 +69,9 @@ class FileLogger : public ILogger
 bool Logger::setDefaultConsoleTarget()
 {
     if (nullptr != m_target)
+    {
         return false;
+    }
 
     m_target = std::make_shared<ConsoleLogger>();
     return true;
@@ -74,12 +80,16 @@ bool Logger::setDefaultConsoleTarget()
 bool Logger::setDefaultFileTarget(const std::string &path)
 {
     if (nullptr != m_target || path.empty())
+    {
         return false;
+    }
 
     time_t timeInfo = time(NULL);
     struct tm *localTime = localtime(&timeInfo);
     if (nullptr == localTime)
+    {
         return false;
+    }
     std::ostringstream newFileName;
     newFileName << path << "/Simulator_";
     newFileName << localTime->tm_year << localTime->tm_mon << localTime->tm_mday << localTime->tm_hour
@@ -108,7 +118,9 @@ void Logger::write(ILogger::Level level, std::ostringstream &str)
         time_t timeInfo = time(NULL);
         struct tm *localTime = localtime(&timeInfo);
         if (nullptr == localTime)
+        {
             return;
+        }
         std::ostringstream timeStr;
         timeStr << localTime->tm_hour << "." << localTime->tm_min << "." << localTime->tm_sec;
         m_target->write(timeStr.str(), level, str.str());
index 7aa00e0..1eec038 100644 (file)
@@ -349,7 +349,9 @@ class SimulatorResourceModelBuilder
                 {
                     std::vector<SimulatorResourceModel> innerArray1(ocSubRepArray[i].size());
                     for  (size_t j = 0; j < ocSubRepArray[i].size(); j++)
+                    {
                         handleRepresentationType(innerArray1[j], ocSubRepArray[i][j]);
+                    }
                     subResModelArray[i] = innerArray1;
                 }
 
@@ -533,7 +535,9 @@ bool SimulatorResourceModel::TypeInfo::operator==(
 {
     if (m_type == rhs.m_type && m_baseType == rhs.m_baseType
         && m_depth == rhs.m_depth)
+    {
         return true;
+    }
     return false;
 }
 
index f17a22b..d19f53a 100644 (file)
@@ -64,7 +64,9 @@ struct UniquenessChecker<T, typename std::enable_if<
         std::vector<T> valueCopy = value;
         std::sort(valueCopy.begin(), valueCopy.end());
         if(valueCopy.end() != std::unique(valueCopy.begin(), valueCopy.end()))
+        {
             return false;
+        }
         return true;
     }
 };
@@ -168,7 +170,9 @@ class ArrayValidator : public boost::static_visitor<bool>
                 {
                     AttributeValueVariant element = value[index];
                     if (!elementProperty->validate(element))
+                    {
                         return false;
+                    }
                 }
             }
 
@@ -273,7 +277,9 @@ int IntegerProperty::getDefaultValue() const
 bool IntegerProperty::getRange(int &min, int &max) const
 {
     if (!m_hasRange)
+    {
         return false;
+    }
 
     min = m_min;
     max = m_max;
@@ -283,7 +289,9 @@ bool IntegerProperty::getRange(int &min, int &max) const
 bool IntegerProperty::getValues(std::vector<int> &values) const
 {
     if (!m_values.size())
+    {
         return false;
+    }
 
     values  = m_values;
     return true;
@@ -301,7 +309,9 @@ void IntegerProperty::setDefaultValue(int value)
         m_defaultValue = m_values[0];
     }
     else
+    {
         m_defaultValue = value;
+    }
 }
 
 void IntegerProperty::setRange(int min, int max)
@@ -333,7 +343,9 @@ bool IntegerProperty::validate(const int &value)
     else if (m_values.size() > 0)
     {
         if (m_values.end() == std::find(m_values.begin(), m_values.end(), value))
+        {
             return false;
+        }
     }
 
     return true;
@@ -384,7 +396,9 @@ double DoubleProperty::getDefaultValue() const
 bool DoubleProperty::getRange(double &min, double &max) const
 {
     if (!m_hasRange)
+    {
         return false;
+    }
 
     min = m_min;
     max = m_max;
@@ -394,7 +408,9 @@ bool DoubleProperty::getRange(double &min, double &max) const
 bool DoubleProperty::getValues(std::vector<double> &values) const
 {
     if (!m_values.size())
+    {
         return false;
+    }
 
     values  = m_values;
     return true;
@@ -412,7 +428,9 @@ void DoubleProperty::setDefaultValue(double value)
         m_defaultValue = m_values[0];
     }
     else
+    {
         m_defaultValue = value;
+    }
 }
 
 void DoubleProperty::setRange(double min, double max)
@@ -444,7 +462,9 @@ bool DoubleProperty::validate(const double &value)
     else if (m_values.size() > 0)
     {
         if (m_values.end() == std::find(m_values.begin(), m_values.end(), value))
+        {
             return false;
+        }
     }
 
     return true;
@@ -534,7 +554,9 @@ std::string StringProperty::getDefaultValue() const
 bool StringProperty::getRange(size_t &min, size_t &max) const
 {
     if (!m_hasRange)
+    {
         return false;
+    }
 
     min = m_min;
     max = m_max;
@@ -544,7 +566,9 @@ bool StringProperty::getRange(size_t &min, size_t &max) const
 bool StringProperty::getValues(std::vector<std::string> &values) const
 {
     if (!m_values.size())
+    {
         return false;
+    }
 
     values  = m_values;
     return true;
@@ -560,12 +584,18 @@ void StringProperty::setDefaultValue(const std::string &value)
     else if(m_hasRange)
     {
         if(value.length() >= m_min && value.length() <= m_max)
+        {
             m_defaultValue = value;
+        }
         else
+        {
             m_defaultValue.clear();
+        }
     }
     else
+    {
         m_defaultValue = value;
+    }
 }
 
 void StringProperty::setRange(size_t min, size_t max)
@@ -654,7 +684,9 @@ void ArrayProperty::setUnique(bool state)
 bool ArrayProperty::setElementProperty(const std::shared_ptr<AttributeProperty> &property)
 {
     if (!property)
+    {
         return false;
+    }
 
     m_elementProperty = property;
     return true;
@@ -772,7 +804,9 @@ bool ModelProperty::add(const std::string &name,
                         const std::shared_ptr<AttributeProperty> &property, bool required)
 {
     if (name.empty() || !property)
+    {
         return false;
+    }
 
     m_childProperties[name] = property;
     m_requiredAttributes[name] = required;
@@ -783,7 +817,9 @@ std::shared_ptr<AttributeProperty> ModelProperty::get(
     const std::string &name)
 {
     if (m_childProperties.end() != m_childProperties.find(name))
+    {
         return m_childProperties[name];
+    }
     return nullptr;
 }
 
@@ -796,7 +832,9 @@ ModelProperty::getChildProperties()
 bool ModelProperty::isRequired(const std::string &name)
 {
     if (m_requiredAttributes.end() == m_requiredAttributes.find(name))
+    {
         return false;
+    }
 
     return m_requiredAttributes[name];
 }
@@ -804,22 +842,30 @@ bool ModelProperty::isRequired(const std::string &name)
 void ModelProperty::remove(const std::string &name)
 {
     if (m_requiredAttributes.end() != m_requiredAttributes.find(name))
+    {
         m_requiredAttributes.erase(m_requiredAttributes.find(name));
+    }
 
     if (m_childProperties.end() != m_childProperties.find(name))
+    {
         m_childProperties.erase(m_childProperties.find(name));
+    }
 }
 
 void ModelProperty::setRequired(const std::string &name)
 {
     if (m_requiredAttributes.end() != m_requiredAttributes.find(name))
+    {
         m_requiredAttributes[name] = true;
+    }
 }
 
 void ModelProperty::unsetRequired(const std::string &name)
 {
     if (m_requiredAttributes.end() != m_requiredAttributes.find(name))
+    {
         m_requiredAttributes[name] = false;
+    }
 }
 
 bool ModelProperty::validate(const AttributeValueVariant &value)
@@ -836,7 +882,9 @@ bool ModelProperty::validate(const SimulatorResourceModel &model)
         if (childProperty)
         {
             if (!childProperty->validate(attributeEntry.second))
+            {
                 return false;
+            }
         }
     }
 
index 618fda7..6625203 100644 (file)
@@ -25,7 +25,9 @@ std::string getPayloadString(const OC::OCRepresentation &rep)
 {
     OCRepPayload *payload = rep.getPayload();
     if (!payload)
+    {
         return "Empty payload";
+    }
 
     std::ostringstream payLoadString;
     while (payload)
@@ -37,7 +39,9 @@ std::string getPayloadString(const OC::OCRepresentation &rep)
 
         // URI
         if (NULL != payload->uri && strlen(payload->uri) > 0)
+        {
             payLoadString << "URI: " << payload->uri << std::endl;
+        }
 
         // Types
         std::ostringstream typeString;
@@ -48,7 +52,9 @@ std::string getPayloadString(const OC::OCRepresentation &rep)
             {
                 typeString << ocTypes->value;
                 if (ocTypes->next)
+                {
                     typeString << ", ";
+                }
             }
 
             ocTypes = ocTypes->next;
@@ -68,7 +74,9 @@ std::string getPayloadString(const OC::OCRepresentation &rep)
             {
                 interfaceString << ocInterfaces->value;
                 if (ocInterfaces->next)
+                {
                     interfaceString << ", ";
+                }
             }
 
             ocInterfaces = ocInterfaces->next;
@@ -97,7 +105,9 @@ std::string getPayloadString(const OC::OCRepresentation &rep)
 
         payload = payload->next;
         if (payload)
+        {
             payLoadString << "----------------" << std::endl;
+        }
     }
 
     return payLoadString.str();
index 96f1599..a6270a1 100644 (file)
@@ -38,7 +38,9 @@ OCInterfaceDetails *OCInterfaceDetails::getInstance()
 bool OCInterfaceDetails::isInterface(const std::string &interfaceType)
 {
     if (m_interfaces.end() != m_interfaces.find(interfaceType))
+    {
         return true;
+    }
     return false;
 }
 
@@ -49,7 +51,9 @@ bool OCInterfaceDetails::isRequestSupported(const std::string &interfaceType,
     {
         std::vector<std::string> requests = m_interfaces[interfaceType];
         if (requests.end() != std::find(requests.begin(), requests.end(), requestType))
+        {
             return true;
+        }
     }
 
     return false;
index 8ccf78e..cdcc510 100644 (file)
@@ -44,13 +44,17 @@ AttributeUpdateAutomation::AttributeUpdateAutomation(
         m_thread(nullptr)
 {
     if (m_updateInterval < 0)
+    {
         m_updateInterval = 0;
+    }
 }
 
 AttributeUpdateAutomation::~AttributeUpdateAutomation()
 {
     if (!m_stopRequested)
+    {
         m_thread->detach();
+    }
 }
 
 void AttributeUpdateAutomation::start()
@@ -74,7 +78,9 @@ void AttributeUpdateAutomation::stop()
 
     m_condVariable.notify_one();
     if (m_thread)
+    {
         m_thread->join();
+    }
 }
 
 void AttributeUpdateAutomation::updateAttribute(SimulatorResourceAttribute attribute)
@@ -91,7 +97,9 @@ void AttributeUpdateAutomation::updateAttribute(SimulatorResourceAttribute attri
             while (!m_stopRequested && true == attributeGen.next(attribute))
             {
                 if (false == m_resource->updateAttributeValue(attribute))
+                {
                     break;
+                }
 
                 // Wait for interval
                 now = std::chrono::system_clock::now();
@@ -122,7 +130,9 @@ void AttributeUpdateAutomation::updateAttribute(SimulatorResourceAttribute attri
 
     // Notify application through callback
     if (m_callback)
+    {
         m_callback(m_resource->getURI(), m_id);
+    }
 
     if (m_finishedCallback && !m_stopRequested)
     {
@@ -145,13 +155,17 @@ ResourceUpdateAutomation::ResourceUpdateAutomation(
         m_thread(nullptr)
 {
     if (m_updateInterval < 0)
+    {
         m_updateInterval = 0;
+    }
 }
 
 ResourceUpdateAutomation::~ResourceUpdateAutomation()
 {
     if (!m_stopRequested)
+    {
         m_thread->detach();
+    }
 }
 
 void ResourceUpdateAutomation::start()
@@ -180,7 +194,9 @@ void ResourceUpdateAutomation::stop()
 
     m_condVariable.notify_one();
     if (m_thread)
+    {
         m_thread->join();
+    }
 }
 
 void ResourceUpdateAutomation::updateAttributes(
@@ -220,7 +236,9 @@ void ResourceUpdateAutomation::updateAttributes(
 
     // Notify application
     if (m_callback)
+    {
         m_callback(m_resource->getURI(), m_id);
+    }
 
     if (m_finishedCallback)
     {
index 41c7309..5524618 100644 (file)
@@ -148,9 +148,13 @@ void SimulatorCollectionResourceImpl::setObservable(bool state)
     }
 
     if (state)
+    {
         m_property = static_cast<OCResourceProperty>(m_property | OC_OBSERVABLE);
+    }
     else
+    {
         m_property = static_cast<OCResourceProperty>(m_property ^ OC_OBSERVABLE);
+    }
 }
 
 void SimulatorCollectionResourceImpl::setDiscoverable(bool state)
@@ -163,9 +167,13 @@ void SimulatorCollectionResourceImpl::setDiscoverable(bool state)
     }
 
     if (state)
+    {
         m_property = static_cast<OCResourceProperty>(m_property | OC_DISCOVERABLE);
+    }
     else
+    {
         m_property = static_cast<OCResourceProperty>(m_property ^ OC_DISCOVERABLE);
+    }
 }
 
 void SimulatorCollectionResourceImpl::setObserverCallback(ObserverCallback callback)
@@ -269,7 +277,9 @@ void SimulatorCollectionResourceImpl::notify(int observerID)
 {
     std::lock_guard<std::recursive_mutex> lock(m_objectLock);
     if (!m_resourceHandle)
+    {
         return;
+    }
 
     OC::ObservationIds observers {static_cast<OCObservationId>(observerID)};
     sendNotification(observers);
@@ -279,14 +289,20 @@ void SimulatorCollectionResourceImpl::notifyAll()
 {
     std::lock_guard<std::recursive_mutex> lock(m_objectLock);
     if (!m_resourceHandle)
+    {
         return;
+    }
 
     if (!m_observersList.size())
+    {
         return;
+    }
 
     OC::ObservationIds observers;
     for (auto &observer : m_observersList)
+    {
         observers.push_back(observer.id);
+    }
     sendNotification(observers);
 }
 
@@ -310,7 +326,9 @@ void SimulatorCollectionResourceImpl::addChildResource(const SimulatorResourceSP
 
     // Notify application and observers
     if (m_modelCallback)
+    {
         m_modelCallback(m_uri, m_resModel);
+    }
     notifyAll();
 }
 
@@ -329,7 +347,9 @@ void SimulatorCollectionResourceImpl::removeChildResource(const SimulatorResourc
 
     // Notify application and observers
     if (m_modelCallback)
+    {
         m_modelCallback(m_uri, m_resModel);
+    }
     notifyAll();
 }
 
@@ -348,7 +368,9 @@ void SimulatorCollectionResourceImpl::removeChildResource(const std::string &uri
 
     // Notify application and observers
     if (m_modelCallback)
+    {
         m_modelCallback(m_uri, m_resModel);
+    }
     notifyAll();
 }
 
@@ -441,7 +463,9 @@ OCEntityHandlerResult SimulatorCollectionResourceImpl::handleRequests(
         if (response)
         {
             if (OC_STACK_OK != OC::OCPlatform::sendResponse(response))
+            {
                 return OC_EH_ERROR;
+            }
         }
         else
         {
@@ -467,7 +491,9 @@ OCEntityHandlerResult SimulatorCollectionResourceImpl::handleRequests(
             m_observersList.push_back(info);
 
             if (m_observeCallback)
+            {
                 m_observeCallback(m_uri, ObservationStatus::REGISTER, info);
+            }
         }
         else if (OC::ObserveAction::ObserveUnregister == observationInfo.action)
         {
@@ -484,7 +510,9 @@ OCEntityHandlerResult SimulatorCollectionResourceImpl::handleRequests(
             }
 
             if (m_observeCallback)
+            {
                 m_observeCallback(m_uri, ObservationStatus::UNREGISTER, info);
+            }
         }
     }
 
@@ -577,7 +605,9 @@ void SimulatorCollectionResourceImpl::addLink(const SimulatorResourceSP &resourc
 {
     std::lock_guard<std::mutex> lock(m_modelLock);
     if (!m_resModel.contains(OC_RSRVD_LINKS))
+    {
         return;
+    }
 
     // Create new OIC Link
     SimulatorResourceModel newLink;
index b5f79fd..f6d6829 100644 (file)
@@ -192,7 +192,9 @@ std::shared_ptr<SimulatorResource> SimulatorResourceFactory::buildResource(
         {\r
             interfaceTypes = resourceModel.get<std::vector<std::string>>(OC_RSRVD_INTERFACE);\r
             if (interfaceTypes.size() > 1)\r
+            {\r
                 interfaceTypes.erase(interfaceTypes.begin()+1, interfaceTypes.end());\r
+            }\r
         }\r
 \r
         resourceModel.remove(OC_RSRVD_INTERFACE);\r
@@ -221,9 +223,13 @@ std::shared_ptr<SimulatorResource> SimulatorResourceFactory::buildResource(
 \r
         collectionRes->setName(resourceName);\r
         if(!resourceType.empty())\r
+        {\r
             collectionRes->setResourceType(resourceType);\r
+        }\r
         if (interfaceTypes.size() > 0)\r
+        {\r
             collectionRes->setInterface(interfaceTypes);\r
+        }\r
         collectionRes->setURI(ResourceURIFactory::getInstance()->makeUniqueURI(resourceURI));\r
 \r
         // Set the resource model and its schema to simulated resource\r
@@ -240,9 +246,13 @@ std::shared_ptr<SimulatorResource> SimulatorResourceFactory::buildResource(
 \r
         singleRes->setName(resourceName);\r
         if(!resourceType.empty())\r
+        {\r
             singleRes->setResourceType(resourceType);\r
+        }\r
         if (interfaceTypes.size() > 0)\r
+        {\r
             singleRes->setInterface(interfaceTypes);\r
+        }\r
         singleRes->setURI(ResourceURIFactory::getInstance()->makeUniqueURI(resourceURI));\r
 \r
         // Set the resource model and its schema to simulated resource\r
@@ -289,7 +299,9 @@ std::string ResourceURIFactory::makeUniqueURI(const std::string &uri)
     std::ostringstream os;\r
     os << uri;\r
     if (!uri.empty() && '/' != uri[uri.length() - 1])\r
+    {\r
         os << '/';\r
+    }\r
     os << m_id++;\r
     updateUri(os.str());\r
     return os.str();\r
@@ -303,8 +315,12 @@ void ResourceURIFactory::updateUri(const std::string &uri)
 bool ResourceURIFactory::isUnique(const std::string &uri)\r
 {\r
     if (m_uriList.end() == m_uriList.find(uri))\r
+    {\r
         return true;\r
+    }\r
     else\r
+    {\r
         return false;\r
+    }\r
 }\r
 \r
index 5ace06a..c783ec3 100644 (file)
@@ -93,7 +93,9 @@ void SimulatorSingleResourceImpl::setInterface(const std::string &interfaceType)
     }
 
     if (interfaceType != OC::DEFAULT_INTERFACE)
+    {
         m_interfaces = {OC::DEFAULT_INTERFACE, interfaceType};
+    }
 }
 
 void SimulatorSingleResourceImpl::setInterface(const std::vector<std::string> &interfaceTypes)
@@ -111,7 +113,9 @@ void SimulatorSingleResourceImpl::setInterface(const std::vector<std::string> &i
     for (auto &interfaceType : interfaceTypes)
     {
         if (false == OCInterfaceDetails::getInstance()->isInterface(interfaceType))
+        {
             continue;
+        }
 
         if (m_interfaces.end() ==
             std::find(m_interfaces.begin(), m_interfaces.end(), interfaceType))
@@ -162,9 +166,13 @@ void SimulatorSingleResourceImpl::setObservable(bool state)
     }
 
     if (state)
+    {
         m_property = static_cast<OCResourceProperty>(m_property | OC_OBSERVABLE);
+    }
     else
+    {
         m_property = static_cast<OCResourceProperty>(m_property ^ OC_OBSERVABLE);
+    }
 }
 
 void SimulatorSingleResourceImpl::setDiscoverable(bool state)
@@ -177,9 +185,13 @@ void SimulatorSingleResourceImpl::setDiscoverable(bool state)
     }
 
     if (state)
+    {
         m_property = static_cast<OCResourceProperty>(m_property | OC_DISCOVERABLE);
+    }
     else
+    {
         m_property = static_cast<OCResourceProperty>(m_property ^ OC_DISCOVERABLE);
+    }
 }
 
 void SimulatorSingleResourceImpl::setObserverCallback(ObserverCallback callback)
@@ -552,7 +564,9 @@ bool SimulatorSingleResourceImpl::updateResourceModel(const SimulatorResourceMod
         if (!reqResModel.contains(attributeName))
         {
             if (overwrite)
+            {
                 return false;
+            }
             continue;
         }
 
@@ -602,7 +616,9 @@ void SimulatorSingleResourceImpl::notify(int observerID, const SimulatorResource
 {
     std::lock_guard<std::recursive_mutex> lock(m_objectLock);
     if (!m_resourceHandle)
+    {
         return;
+    }
 
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse);
     response->setResponseResult(OC_EH_OK);
@@ -622,10 +638,14 @@ void SimulatorSingleResourceImpl::notifyAll(const SimulatorResourceModel &resMod
 {
     std::lock_guard<std::recursive_mutex> lock(m_objectLock);
     if (!m_resourceHandle)
+    {
         return;
+    }
 
     if (!m_observersList.size())
+    {
         return;
+    }
 
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse);
     response->setResponseResult(OC_EH_OK);
@@ -719,7 +739,9 @@ void SimulatorSingleResourceImpl::addObserver(const OC::ObservationInfo &ocObser
     m_observersList.push_back(info);
 
     if (m_observeCallback)
+    {
         m_observeCallback(m_uri, ObservationStatus::REGISTER, info);
+    }
 }
 
 void SimulatorSingleResourceImpl::removeObserver(const OC::ObservationInfo &ocObserverInfo)
@@ -738,7 +760,9 @@ void SimulatorSingleResourceImpl::removeObserver(const OC::ObservationInfo &ocOb
     }
 
     if (found && m_observeCallback)
+    {
         m_observeCallback(m_uri, ObservationStatus::UNREGISTER, info);
+    }
 }
 
 void SimulatorSingleResourceImpl::removeAllObservers()
@@ -748,7 +772,9 @@ void SimulatorSingleResourceImpl::removeAllObservers()
     for (size_t index = 0; index < observerList.size(); index++)
     {
         if (m_observeCallback)
+        {
             m_observeCallback(m_uri, ObservationStatus::UNREGISTER, observerList[index]);
+        }
     }
 }
 
index ee49b05..148885e 100644 (file)
@@ -53,7 +53,9 @@ std::shared_ptr<SimulatorResource> SimulatorManager::createResource(
     {
         resource = SimulatorResourceFactory::getInstance()->createResource(configPath);
         if (!resource)
+        {
             throw SimulatorException(SIMULATOR_ERROR, "Failed to create resource!");
+        }
     }
     catch (RAML::RamlException &e)
     {
@@ -74,7 +76,9 @@ std::vector<std::shared_ptr<SimulatorResource>> SimulatorManager::createResource
     {
         resources = SimulatorResourceFactory::getInstance()->createResource(configPath, count);
         if (!resources.size())
+        {
             throw SimulatorException(SIMULATOR_ERROR, "Failed to create resource!");
+        }
     }
     catch (RAML::RamlException &e)
     {
@@ -112,7 +116,9 @@ void SimulatorManager::findResource(ResourceFindCallback callback)
                                         [](std::shared_ptr<OC::OCResource> ocResource, ResourceFindCallback callback)
     {
         if (!ocResource)
+        {
             return;
+        }
 
         callback(std::make_shared<SimulatorRemoteResourceImpl>(ocResource));
     }, std::placeholders::_1, callback);
@@ -134,7 +140,9 @@ void SimulatorManager::findResource(const std::string &resourceType,
                                         [](std::shared_ptr<OC::OCResource> ocResource, ResourceFindCallback callback)
     {
         if (!ocResource)
+        {
             return;
+        }
 
         callback(std::make_shared<SimulatorRemoteResourceImpl>(ocResource));
     }, std::placeholders::_1, callback);