Fix to apply Coding convention on services.
authorKIM JungYong <jyong2.kim@samsung.com>
Tue, 27 Sep 2016 13:55:35 +0000 (22:55 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 28 Sep 2016 23:25:25 +0000 (23:25 +0000)
Change-Id: I9bdb0e8147bcbbad6a28a6635cd7c4c3c16d9359
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12345
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit 88bbfc3785ac7b4991b645dad9f699d209a15435)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12459

45 files changed:
service/resource-container/bundle-api/include/BundleActivator.h
service/resource-container/bundle-api/include/NotificationReceiver.h
service/resource-container/bundle-api/include/ProtocolBridgeConnector.h
service/resource-container/bundle-api/include/ProtocolBridgeResource.h
service/resource-container/examples/BMISensorBundle/src/BMISensorResource.cpp
service/resource-container/examples/ContainerSample.cpp
service/resource-container/examples/ContainerSampleClient.cpp
service/resource-container/examples/HueSampleBundle/src/HueConnector.cpp
service/resource-container/include/RCSBundleInfo.h
service/resource-container/src/BundleResource.cpp
service/resource-container/src/Configuration.cpp
service/resource-container/src/DiscoverResourceUnit.cpp
service/resource-container/src/DiscoverResourceUnit.h
service/resource-container/src/RemoteResourceUnit.cpp
service/resource-container/src/ResourceContainerImpl.cpp
service/resource-container/src/SoftSensorResource.cpp
service/resource-container/unittests/ResourceContainerTest.cpp
service/resource-container/unittests/ResourceContainerTestSimulator.h
service/resource-container/unittests/TestBundle/include/TestBundleActivator.h
service/resource-encapsulation/examples/linux/NestedAttributesClient.cpp
service/resource-encapsulation/examples/linux/NestedAttributesServer.cpp
service/resource-encapsulation/examples/linux/SampleResourceClient.cpp
service/resource-encapsulation/examples/linux/SampleResourceServer.cpp
service/resource-encapsulation/examples/linux/SeparateResponseServer.cpp
service/resource-encapsulation/src/common/expiryTimer/unittests/ExpiryTimerTest.cpp
service/resource-encapsulation/src/common/primitiveResource/unittests/PresenceSubscriberTest.cpp
service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp
service/resource-encapsulation/src/resourceBroker/unittest/DeviceAssociationUnitTest.cpp
service/resource-encapsulation/src/resourceBroker/unittest/DevicePresenceUnitTest.cpp
service/resource-encapsulation/src/resourceBroker/unittest/ResourceBrokerUnitTest.cpp
service/resource-encapsulation/src/resourceBroker/unittest/ResourcePresenceUnitTest.cpp
service/resource-encapsulation/src/resourceCache/unittests/DataCacheTest.cpp
service/resource-encapsulation/src/resourceCache/unittests/ResourceCacheTest.cpp
service/resource-encapsulation/unittests/DiscoveryManagerTest.cpp
service/resource-hosting/SampleApp/linux/sampleConsumer/SampleConsumer.cpp
service/resource-hosting/src/HostingObject.cpp
service/resource-hosting/src/RequestObject.cpp
service/resource-hosting/src/ResourceHosting.cpp
service/things-manager/sampleapp/linux/configuration/FactorySetCollection.cpp
service/things-manager/sampleapp/linux/configuration/con-client.cpp
service/things-manager/sdk/src/ActionSet.cpp
service/things-manager/sdk/src/GroupManager.cpp
service/things-manager/sdk/src/ThingsConfiguration.cpp
service/things-manager/sdk/src/ThingsMaintenance.cpp
service/things-manager/unittests/ThingsManagerTest.cpp

index 5a69fb1ce446531ddb9ee9a73a04fbe79c856687..d5bea5aa099d5b40d9ef834a74b4722d6645f990 100644 (file)
@@ -43,12 +43,18 @@ namespace OIC
                 /**
                 * Constructor for BundleActivator
                 */
-                BundleActivator() { };
+                BundleActivator()
+                {
+
+                };
 
                 /**
                 * Virtual destructor for BundleActivator
                 */
-                virtual ~BundleActivator() { };
+                virtual ~BundleActivator()
+                {
+
+                };
 
                 /**
                 * Activate the Bundle to make bundle work and create bundle resources
index a1d25a183b2de0d986a34ac79c870e2a8d77e5ea..1cd63573df66771ac6b0e040f896e5ec3c08026d 100644 (file)
@@ -41,12 +41,18 @@ namespace OIC
                 /**
                 * Constructor for NotificationReceiver
                 */
-                NotificationReceiver() {};
+                NotificationReceiver()
+                {
+
+                };
 
                 /**
                 * destructor for NotificationReceiver
                 */
-                ~NotificationReceiver() {};
+                ~NotificationReceiver()
+                {
+
+                };
 
                 /**
                 * Callback method for getting notification from bundle resources
index a549d2ef8b77feaae3bf443e03f83e03b011495e..5f9361cffc9119784b1dfcecb89f84e3fbfe3382 100644 (file)
@@ -43,12 +43,18 @@ namespace OIC
                 /**
                 * Constructor for ProtocolBridgeConnector
                 */
-                ProtocolBridgeConnector() { };
+                ProtocolBridgeConnector()
+                {
+
+                };
 
                 /**
                 * Virtual destructor for ProtocolBridgeConnector
                 */
-                virtual ~ProtocolBridgeConnector() { };
+                virtual ~ProtocolBridgeConnector()
+                {
+
+                };
 
                 /**
                 * Execute the logic needed for connection with different protocol from IoTivity
index bc846e4a3c04a8faccb883b74bea8f67c6fc98db..c020ca68efe646edc603c10ca25cf4a26cace20a 100644 (file)
@@ -43,12 +43,18 @@ namespace OIC
                 /**
                 * Constructor for ProtocolBridgeResource
                 */
-                ProtocolBridgeResource() { };
+                ProtocolBridgeResource()
+                {
+
+                };
 
                 /**
                 * Virtual destructor for ProtocolBridgeResource
                 */
-                virtual ~ProtocolBridgeResource() { };
+                virtual ~ProtocolBridgeResource()
+                {
+
+                };
 
                 /**
                 * Initialize attributes of the resource
index 2a527b55d491e2f621409315f442157c4e98f86a..968863dddae1614441ed2b15582a095821773443 100644 (file)
@@ -51,7 +51,9 @@ void BMISensorResource::executeLogic()
     std::string strBMIResult;
 
     if (m_pBMISensor->executeBMISensorLogic(&m_mapInputData, &strBMIResult) != -1)
+    {
         setAttribute("BMIresult", RCSResourceAttributes::Value(strBMIResult.c_str()));
+    }
 }
 
 void BMISensorResource::onUpdatedInputResource(const std::string attributeName,
@@ -61,10 +63,14 @@ void BMISensorResource::onUpdatedInputResource(const std::string attributeName,
     m_mapInputData.clear();
 
     if (!attributeName.compare("weight"))
+    {
         m_mapInputData.insert(std::make_pair("weight", values.back().get< std::string >()));
+    }
 
     if (!attributeName.compare("height"))
+    {
         m_mapInputData.insert(std::make_pair("height", values.back().get< std::string >()));
+    }
 
     executeLogic();
 }
index 420119acf8eb5e05aeac3f542f4b97be5f98c7d8..4d1c2df243ff701bd114d23478078b63ffb3cb90 100644 (file)
@@ -46,7 +46,9 @@ namespace
         EXIT = 11
     } APPMenu;
 
-    struct CloseApp {};
+    struct CloseApp
+    {
+    };
 
     const int MAX_PATH = 2048;
 
@@ -69,7 +71,9 @@ void getCurrentPath(std::string *pPath)
     char buffer[MAX_PATH];
 
     if (!pPath->empty())
+    {
         pPath->clear();
+    }
 
 #if defined(__linux__)
     char *strPath = NULL;
@@ -81,7 +85,9 @@ void getCurrentPath(std::string *pPath)
         strPath = strrchr(buffer, '/');
 
         if (strPath != NULL)
+        {
             *strPath = '\0';
+        }
     }
 #endif
     pPath->append(buffer);
@@ -94,7 +100,9 @@ int processUserInput(int min, int max)
     std::cin >> input;
 
     if (!std::cin.fail() && min <= input && input <= max)
+    {
         return input;
+    }
 
     std::cin.clear();
     std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
@@ -141,7 +149,9 @@ bool checkBundleRegistered(std::string bundleId)
         for (auto &bundle : bundleList)
         {
             if (bundle->getID().compare(bundleId) == 0)
+            {
                 return true;
+            }
         }
     }
 
@@ -160,7 +170,9 @@ bool checkResourceRegistered(std::string bundleId, std::string resourceUri)
         for (auto &resource : resourceList)
         {
             if (resource.compare(resourceUri) == 0)
+            {
                 return true;
+            }
         }
     }
 
@@ -237,7 +249,9 @@ void StopSampleBundle()
             g_bSampleBundleStarted = false;
         }
         else
+        {
             std::cout << "Sample Bundle is not started." << std::endl;
+        }
     }
     else
     {
@@ -250,7 +264,9 @@ void RemoveSampleBundle()
     if (g_pResourceContainer && g_bContainerStarted)
     {
         if (checkBundleRegistered(EXAMPLE_BUNDLE_ID))
+        {
             g_pResourceContainer->removeBundle(EXAMPLE_BUNDLE_ID);
+        }
     }
     else
     {
@@ -273,7 +289,9 @@ void AddSampleBundleResource()
                                                     resourceParams);
         }
         else
+        {
             std::cout << "Sample Bundle is not started." << std::endl;
+        }
     }
     else
     {
@@ -287,9 +305,13 @@ void RemoveSampleBundleResource()
     {
         if (checkResourceRegistered(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI)
             && g_bSampleBundleStarted)
+        {
             g_pResourceContainer->removeResourceConfig(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI);
+        }
         else
+        {
             std::cout << "Sample Bundle is not started." << std::endl;
+        }
     }
     else
     {
@@ -434,7 +456,9 @@ int main()
     }
 
     if (g_bContainerStarted)
+    {
         g_pResourceContainer->stopContainer();
+    }
 
     g_pResourceContainer = nullptr;
 
index 3a8bf4e5d0757b0ec9d4f5160baa3b4eb1910c26..d4d2729bf2b5224c898c509cb2fd1928360cd43a 100644 (file)
@@ -180,9 +180,13 @@ void onPost2(const HeaderOptions &headerOptions, const OCRepresentation &rep, co
             }
 
             if (OBSERVE_TYPE_TO_USE == ObserveType::Observe)
+            {
                 std::cout << std::endl << "Observe is used." << std::endl << std::endl;
+            }
             else if (OBSERVE_TYPE_TO_USE == ObserveType::ObserveAll)
+            {
                 std::cout << std::endl << "ObserveAll is used." << std::endl << std::endl;
+            }
 
             curResource->observe(OBSERVE_TYPE_TO_USE, QueryParamsMap(), &onObserve);
 
index 5a5a9566c6aa6e40812f5287798d9467e19cd432..de7121baca3444c559f0f9db5cd660ccf66d85ac 100644 (file)
@@ -95,7 +95,9 @@ std::string HueConnector::transmit(std::string target, std::string payload)
         res = curl_easy_perform(curl);
         /* Check for errors */
         if (res != CURLE_OK)
+        {
             fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
+        }
 
         /* always cleanup */
         curl_easy_cleanup(curl);
index 3a11445c3d1eb9d3e50f3c60a1a1ac54f19bced2..7f30b1c2ba640229066207ddbd06ee3f7afd0f79 100644 (file)
@@ -90,8 +90,12 @@ namespace OIC
                 */
                 virtual bool isActivated() = 0;
 
-                RCSBundleInfo(){};
-                virtual ~RCSBundleInfo(){};
+                RCSBundleInfo()
+                {
+                };
+                virtual ~RCSBundleInfo()
+                {
+                };
             protected:
                 std::string m_ID, m_path, m_version;
 
index f39e77c377543ce56d4174d909c6c5fe072e05d2..a5aacfb9575f94aeb15aa97a965f750237fd1374 100644 (file)
@@ -51,7 +51,8 @@ namespace OIC
         {
             std::list< std::string > ret;
 
-            for (auto &it : m_resourceAttributes){
+            for (auto &it : m_resourceAttributes)
+            {
                 ret.push_back(it.key());
             }
 
@@ -81,12 +82,14 @@ namespace OIC
                 m_resourceAttributes[it.key()] = it.value();
             }
 
-            if(notify){
+            if(notify)
+            {
                 // asynchronous notification
                 auto notifyFunc = [](NotificationReceiver *notificationReceiver,
                                         std::string uri)
                 {
-                    if (notificationReceiver){
+                    if (notificationReceiver)
+                    {
                         notificationReceiver->onNotificationReceived(uri);
                     }
                 };
@@ -104,12 +107,14 @@ namespace OIC
             std::lock_guard<std::mutex> lock(m_resourceAttributes_mutex);
             m_resourceAttributes[key] = std::move(value);
 
-            if(notify){
+            if(notify)
+            {
                 // asynchronous notification
                 auto notifyFunc = [](NotificationReceiver *notificationReceiver,
                                         std::string uri)
                 {
-                    if (notificationReceiver){
+                    if (notificationReceiver)
+                    {
                         notificationReceiver->onNotificationReceived(uri);
                     }
                 };
index 7fcd077d4a103ff902d3a6208f746e4ea80395e4..fc5e1ae7ae27391916c5623ad9f832691a7a9556 100644 (file)
@@ -152,7 +152,8 @@ namespace OIC
                             {
                                 strBundleId = bundle->first_node(BUNDLE_ID)->value();
                             }
-                            else{
+                            else
+                            {
                                 strBundleId = "";
                             }
 
@@ -161,19 +162,23 @@ namespace OIC
                                 bundleConfigMap.insert(std::make_pair(BUNDLE_ID, trim_both(strBundleId)));
 
                                 // <path>
-                                if (bundle->first_node(BUNDLE_PATH)){
+                                if (bundle->first_node(BUNDLE_PATH))
+                                {
                                     strPath = bundle->first_node(BUNDLE_PATH)->value();
                                 }
-                                else{
+                                else
+                                {
                                     strPath = "";
                                 }
                                 bundleConfigMap.insert(std::make_pair(BUNDLE_PATH, trim_both(strPath)));
 
                                 // <version>
-                                if (bundle->first_node(BUNDLE_VERSION)){
+                                if (bundle->first_node(BUNDLE_VERSION))
+                                {
                                     strVersion = bundle->first_node(BUNDLE_VERSION)->value();
                                 }
-                                else{
+                                else
+                                {
                                     strVersion = "";
                                 }
                                 bundleConfigMap.insert(
@@ -195,7 +200,8 @@ namespace OIC
         }
 
         void Configuration::getResourceConfiguration(std::string bundleId, std::string resourceUri,
-                        resourceInfo *resourceInfoOut){
+                        resourceInfo *resourceInfoOut)
+        {
             rapidxml::xml_node< char > *bundle;
             rapidxml::xml_node< char > *resource;
             rapidxml::xml_node< char > *item, *subItem, *subItem2;
@@ -227,7 +233,8 @@ namespace OIC
                                 OIC_LOG_V(INFO, CONTAINER_TAG, "Inspecting");
                                 // <resourceInfo>
                                 bundle = bundle->first_node(OUTPUT_RESOURCES_TAG);
-                                if (bundle){
+                                if (bundle)
+                                {
                                     for (resource = bundle->first_node(OUTPUT_RESOURCE_INFO);
                                          resource; resource = resource->next_sibling())
                                     {
@@ -254,10 +261,14 @@ namespace OIC
                                             }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_ADDR))
+                                            {
                                                 resourceInfoOut->address = trim_both(strValue);
+                                            }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_TYPE))
+                                            {
                                                 resourceInfoOut->resourceType = trim_both(strValue);
+                                            }
 
                                             else
                                             {
@@ -307,7 +318,8 @@ namespace OIC
                     OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what());
                 }
             }
-            else{
+            else
+            {
                 OIC_LOG(INFO, CONTAINER_TAG, "config is not loaded yet !!");
             }
         }
@@ -360,16 +372,24 @@ namespace OIC
                                             strValue = item->value();
 
                                             if (!strKey.compare(OUTPUT_RESOURCE_NAME))
+                                            {
                                                 tempResourceInfo.name = trim_both(strValue);
+                                            }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_URI))
+                                            {
                                                 tempResourceInfo.uri = trim_both(strValue);
+                                            }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_ADDR))
+                                            {
                                                 tempResourceInfo.address = trim_both(strValue);
+                                            }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_TYPE))
+                                            {
                                                 tempResourceInfo.resourceType = trim_both(strValue);
+                                            }
 
                                             else
                                             {
@@ -420,7 +440,8 @@ namespace OIC
                     OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what());
                 }
             }
-            else{
+            else
+            {
                 OIC_LOG(INFO, CONTAINER_TAG, "config is not loaded yet !!");
             }
         }
index 36c2bc6e95cb1bd1faf61888b8e55560b41086c4..3ffeb8f22bd645a78c5828ad1da55b3b6c053c80 100644 (file)
@@ -89,7 +89,8 @@ void DiscoverResourceUnit::discoverdCB(RCSRemoteResourceObject::Ptr remoteObject
     if (remoteObject && !isAlreadyDiscoveredResource(remoteObject))
     {
         OIC_LOG_V(DEBUG, DISCOVER_TAG, "Discovered - uri: %s", uri.c_str());
-        if (uri.empty() || uri.compare(remoteObject->getUri()) == 0){
+        if (uri.empty() || uri.compare(remoteObject->getUri()) == 0)
+        {
             RemoteResourceUnit::Ptr newDiscoveredResource =
                        RemoteResourceUnit::createRemoteResourceInfo(remoteObject,
                                pUpdatedCBFromServer);
@@ -99,7 +100,8 @@ void DiscoverResourceUnit::discoverdCB(RCSRemoteResourceObject::Ptr remoteObject
 
             OIC_LOG_V(DEBUG, DISCOVER_TAG, "Created remote resource unit");
         }
-        else{
+        else
+        {
             OIC_LOG_V(DEBUG, DISCOVER_TAG, "URI is not matching - uri: %s", uri.c_str());
         }
     }
index 38a440b4b7b24df623daede22a8b817858a647a5..00ad5be7d7af303121229442f8a838f1dc0d471a 100644 (file)
@@ -44,9 +44,15 @@ namespace OIC
                 struct DiscoverResourceInfo
                 {
                     DiscoverResourceInfo()
-                        : resourceUri(), resourceType(), attributeName() {}
+                        : resourceUri(), resourceType(), attributeName()
+                    {
+
+                    }
                     DiscoverResourceInfo(std::string uri, std::string type, std::string name)
-                        : resourceUri(uri), resourceType(type), attributeName(name) {}
+                        : resourceUri(uri), resourceType(type), attributeName(name)
+                    {
+
+                    }
                     std::string resourceUri;
                     std::string resourceType;
                     std::string attributeName;
index 7a5bda33967fb449123eff7e28b1ab5a956f2da6..6c785b63e9cfeb6adf5fc2324914d0045a56b575 100644 (file)
@@ -39,19 +39,23 @@ RemoteResourceUnit::~RemoteResourceUnit()
     {
         if(remoteObject->isCaching())
         {
-            try{
+            try
+            {
                 remoteObject->stopCaching();
             }
-            catch(std::exception &e){
+            catch(std::exception &e)
+            {
                 OIC_LOG_V(ERROR, CONTAINER_TAG, "%s", e.what());
             }
         }
         if(remoteObject->isMonitoring())
         {
-            try{
+            try
+            {
                 remoteObject->stopMonitoring();
             }
-            catch(std::exception &e){
+            catch(std::exception &e)
+            {
                 OIC_LOG_V(ERROR, CONTAINER_TAG, "%s", e.what());
             }
         }
index 93be5f9aea765f164e5672040a03b0807625ce0b..e22692dc365e3385d21cd630f9aa95ac597e9097 100644 (file)
@@ -68,7 +68,8 @@ namespace OIC
 
 
             activationLock.lock();
-            try{
+            try
+            {
                 if (!configFile.empty())
                 {
                     m_config = new Configuration(configFile);
@@ -111,7 +112,9 @@ namespace OIC
                 }
 
                 OIC_LOG(INFO, CONTAINER_TAG, "Resource container started.");
-            }catch(...){
+            }
+            catch (...)
+            {
                 OIC_LOG(INFO, CONTAINER_TAG, "Resource container failed starting.");
             }
             activationLock.unlock();
@@ -142,7 +145,9 @@ namespace OIC
             }
 
             if (m_config)
+            {
                 delete m_config;
+            }
         }
 
         void ResourceContainerImpl::activateBundle(shared_ptr<RCSBundleInfo> bundleInfo)
@@ -175,10 +180,12 @@ namespace OIC
                      std::string(m_bundles[id]->getID()).c_str());
 
             activationLock.lock();
-            try{
+            try
+            {
                 activateBundleThread(id);
             }
-            catch(...){
+            catch (...)
+            {
                 OIC_LOG_V(INFO, CONTAINER_TAG, "Activating bundle: (%s) failed",
                                      std::string(m_bundles[id]->getID()).c_str());
             }
@@ -222,14 +229,15 @@ namespace OIC
                 registerExtBundle(bundleInfo);
 #endif
             }
-            else if(has_suffix(bundleInfo->getPath(), ".so"))
+            else if (has_suffix(bundleInfo->getPath(), ".so"))
             {
                 bundleInfoInternal->setSoBundle(true);
                 bundleInfoInternal->setJavaBundle(false);
                 registerSoBundle(bundleInfo);
             }
             // other cases might be for example .apk for android, which are loaded in the wrapper
-            else{
+            else
+            {
                 bundleInfoInternal->setSoBundle(false);
                 bundleInfoInternal->setJavaBundle(false);
                 registerExtBundle(bundleInfo);
@@ -246,7 +254,7 @@ namespace OIC
                 {
                     unregisterBundleSo(bundleInfo->getID());
                 }
-                else if(bundleInfoInternal->getJavaBundle())
+                else if (bundleInfoInternal->getJavaBundle())
                 {
 #if(JAVA_SUPPORT)
                     unregisterBundleJava(bundleInfo->getID());
@@ -290,7 +298,8 @@ namespace OIC
             registrationLock.lock();
             if (m_mapResources.find(strUri) == m_mapResources.end())
             {
-                if (strInterface.empty()) {
+                if (strInterface.empty())
+                {
                     strInterface = "oic.if.baseline";
                 }
 
@@ -321,7 +330,8 @@ namespace OIC
                               strResourceType).c_str());
                         discoverInputResource(strUri);
                     }
-                    else{
+                    else
+                    {
                         OIC_LOG_V(INFO, CONTAINER_TAG, "Resource has no input (%s)",
                                  std::string(strUri + ", " +
                                  strResourceType).c_str());
@@ -395,7 +405,8 @@ namespace OIC
             {
                 m_config->getResourceConfiguration(bundleId, configOutput);
             }
-            else{
+            else
+            {
                 OIC_LOG_V(DEBUG, CONTAINER_TAG, "no config present ");
             }
         }
@@ -499,7 +510,9 @@ namespace OIC
             if (m_bundles.find(bundleId) != m_bundles.end())
             {
                 if (!m_bundles[bundleId]->isActivated())
+                {
                     activateBundle(m_bundles[bundleId]);
+                }
                 else
                 {
                     OIC_LOG(ERROR, CONTAINER_TAG, "Bundle already started");
@@ -518,7 +531,9 @@ namespace OIC
             if (m_bundles.find(bundleId) != m_bundles.end())
             {
                 if (m_bundles[bundleId]->isActivated())
+                {
                     deactivateBundle(m_bundles[bundleId]);
+                }
                 else
                 {
                     OIC_LOG(ERROR, CONTAINER_TAG, "Bundle not activated");
@@ -540,7 +555,9 @@ namespace OIC
             (void) bundleUri;
 
             if (m_bundles.find(bundleId) != m_bundles.end())
+            {
                 OIC_LOG(ERROR, CONTAINER_TAG, "BundleId already exist");
+            }
 
             else
             {
@@ -571,10 +588,14 @@ namespace OIC
             {
                 shared_ptr<BundleInfoInternal> bundleInfo = m_bundles[bundleId];
                 if (bundleInfo->isActivated())
+                {
                     deactivateBundle(bundleInfo);
+                }
 
                 if (bundleInfo->isLoaded())
+                {
                     unregisterBundle(bundleInfo);
+                }
             }
             else
             {
@@ -611,11 +632,17 @@ namespace OIC
                     newResourceInfo.uri = resourceUri;
 
                     if (params.find(OUTPUT_RESOURCE_NAME) != params.end())
+                    {
                         newResourceInfo.name = params[OUTPUT_RESOURCE_NAME];
+                    }
                     if (params.find(OUTPUT_RESOURCE_TYPE) != params.end())
+                    {
                         newResourceInfo.resourceType = params[OUTPUT_RESOURCE_TYPE];
+                    }
                     if (params.find(OUTPUT_RESOURCE_ADDR) != params.end())
+                    {
                         newResourceInfo.address = params[OUTPUT_RESOURCE_ADDR];
+                    }
 
                     addSoBundleResource(bundleId, newResourceInfo);
                 }
@@ -691,7 +718,8 @@ namespace OIC
                 {
                   OIC_LOG_V(ERROR, CONTAINER_TAG, "Error while loading .so bundle: (%s)", error);
                 }
-                else{
+                else
+                {
                   OIC_LOG_V(DEBUG, CONTAINER_TAG, "Looked up %s", ("" +
                           bundleInfoInternal->getActivatorName()
                           + "_externalActivateBundle").c_str());
@@ -704,7 +732,8 @@ namespace OIC
                 {
                   OIC_LOG_V(ERROR, CONTAINER_TAG, "Error while loading .so bundle: (%s)", error);
                 }
-                else{
+                else
+                {
                   OIC_LOG_V(DEBUG, CONTAINER_TAG, "Looked up %s", ("" +
                           bundleInfoInternal->getActivatorName()
                           + "_externalDeactivateBundle").c_str());
@@ -717,7 +746,8 @@ namespace OIC
                 {
                   OIC_LOG_V(ERROR, CONTAINER_TAG, "Error while loading .so bundle: (%s)", error);
                 }
-                else{
+                else
+                {
                   OIC_LOG_V(DEBUG, CONTAINER_TAG, "Looked up %s", ("" +
                           bundleInfoInternal->getActivatorName()
                           + "_externalCreateResource").c_str());
@@ -730,7 +760,8 @@ namespace OIC
                 {
                   OIC_LOG_V(ERROR, CONTAINER_TAG, "Error while loading .so bundle: (%s)", error);
                 }
-                else{
+                else
+                {
                   OIC_LOG_V(DEBUG, CONTAINER_TAG, "Looked up %s", ("" +
                           bundleInfoInternal->getActivatorName()
                           + "_externalDestroyResource").c_str());
@@ -763,7 +794,8 @@ namespace OIC
             OIC_LOG_V(DEBUG, CONTAINER_TAG, "Register SO bundle finished");
         }
 
-        void ResourceContainerImpl::registerExtBundle(shared_ptr<RCSBundleInfo> bundleInfo){
+        void ResourceContainerImpl::registerExtBundle(shared_ptr<RCSBundleInfo> bundleInfo)
+        {
             OIC_LOG_V(INFO, CONTAINER_TAG, "Registering ext bundle (%s)",
                                  std::string(bundleInfo->getID()).c_str());
             OIC_LOG_V(INFO, CONTAINER_TAG, "Activator name (%s)",
@@ -955,7 +987,7 @@ namespace OIC
                 activateJavaBundle(id);
 #endif
             }
-            else if(m_bundles[id]->getSoBundle())
+            else if (m_bundles[id]->getSoBundle())
             {
                 activateSoBundle (id);
             }
index 753dd6988c30ee36432279b6d1b04bfa656213e8..e289a744aff730e448deb05b9b0ee389915248ee 100644 (file)
@@ -50,7 +50,9 @@ namespace OIC
             // initialize output attributes
             for (itor = m_mapResourceProperty[SS_RESOURCE_OUTPUT].begin();
                  itor != m_mapResourceProperty[SS_RESOURCE_OUTPUT].end(); itor++)
+            {
                 BundleResource::setAttribute((*itor)[SS_RESOURCE_OUTPUTNAME], nullptr);
+            }
         }
     }
 }
index 6739f82bbdad68629011e4913305400f9d79a6f9..94415c3ea79e036e34fcfad01ba0f0ca78fc5e25 100644 (file)
@@ -69,7 +69,9 @@ void getCurrentPath(std::string *pPath)
         strPath = strrchr(buffer, '/');
 
         if (strPath != NULL)
+        {
             *strPath = '\0';
+        }
     }
 #endif
     pPath->append(buffer);
@@ -98,7 +100,9 @@ dynamic_unique_ptr_cast( std::unique_ptr<Base, Del>&& p )
 class TestBundleResource: public BundleResource
 {
     public:
-        virtual void initAttributes() { }
+        virtual void initAttributes()
+        {
+        }
 
         virtual void handleSetAttributesRequest(const RCSResourceAttributes &attr,
                                                 const std::map< std::string, std::string > &queryParams)
@@ -119,7 +123,8 @@ class TestBundleResource: public BundleResource
 class TestBundleResourceWithAttrs: public BundleResource
 {
     public:
-        virtual void initAttributes() {
+        virtual void initAttributes()
+        {
             setAttribute("attrib1", RCSResourceAttributes::Value("test"));
             setAttribute("attrib2", RCSResourceAttributes::Value(1));
             setAttribute("attrib3", RCSResourceAttributes::Value(true));
@@ -145,7 +150,8 @@ class TestBundleResourceWithAttrs: public BundleResource
 class TestSoftSensorResource: public SoftSensorResource
 {
     public:
-        virtual void initAttributes() {
+        virtual void initAttributes()
+        {
             SoftSensorResource::initAttributes();
         }
 
@@ -163,13 +169,13 @@ class TestSoftSensorResource: public SoftSensorResource
             return BundleResource::getAttributes();
         }
 
-        virtual void executeLogic(){
-
+        virtual void executeLogic()
+        {
         }
 
         virtual void onUpdatedInputResource(
-                std::string, std::vector<OIC::Service::RCSResourceAttributes::Value>){
-
+                std::string, std::vector<OIC::Service::RCSResourceAttributes::Value>)
+        {
         }
 };
 
@@ -445,7 +451,8 @@ TEST_F(ResourceContainerBundleAPITest, RequestHandlerForResourceServerSetWhenReg
 {
     mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
         RCSResourceObject::Ptr(m_pResourceObject, [](RCSResourceObject *)
-    {}));
+        {
+        }));
 
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setSetRequestHandler);
@@ -459,7 +466,8 @@ TEST_F(ResourceContainerBundleAPITest, BundleResourceUnregisteredWhenUnregisterR
 {
     mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
         RCSResourceObject::Ptr(m_pResourceObject, [](RCSResourceObject *)
-    {}));
+        {
+        }));
 
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setSetRequestHandler);
@@ -477,7 +485,8 @@ TEST_F(ResourceContainerBundleAPITest,
 {
     mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
         RCSResourceObject::Ptr(m_pResourceObject, [](RCSResourceObject *)
-    {}));
+        {
+        }));
 
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, RCSResourceObject::setSetRequestHandler);
@@ -694,7 +703,9 @@ class DiscoverResourceUnitTest: public TestWithMock
             testObject->createResource();
             m_bundleId = "/a/TempHumSensor/Container";
             m_pDiscoverResourceUnit = std::make_shared< DiscoverResourceUnit >( m_bundleId );
-            m_updatedCB = ([](const std::string, std::vector< RCSResourceAttributes::Value >) { });
+            m_updatedCB = ([](const std::string, std::vector< RCSResourceAttributes::Value >)
+                    {
+                    });
         }
 
         void TearDown()
@@ -733,7 +744,9 @@ TEST_F(DiscoverResourceUnitTest, onUpdateCalled)
 
 namespace
 {
-    void onCacheCB(const RCSResourceAttributes &) { }
+    void onCacheCB(const RCSResourceAttributes &)
+    {
+    }
 }
 
 class RemoteResourceUnitTest: public TestWithMock
@@ -755,7 +768,9 @@ class RemoteResourceUnitTest: public TestWithMock
             testObject = std::make_shared<ResourceContainerTestSimulator>();
             testObject->defaultRunSimulator();
             m_pRCSRemoteResourceObject = testObject->getRemoteResource();
-            m_updatedCBFromServer = ([](RemoteResourceUnit::UPDATE_MSG, RCSRemoteResourceObject::Ptr) {});
+            m_updatedCBFromServer = ([](RemoteResourceUnit::UPDATE_MSG, RCSRemoteResourceObject::Ptr) 
+                {
+                });
         }
 
         void TearDown()
index 5d6ccd0ad9885ef0a34e0b03833d477547056b45..03a0bc7131cca120a44477b851a27d977c03a146 100644 (file)
@@ -64,7 +64,8 @@ class ResourceContainerTestSimulator
               RESOURCEINTERFACE("oic.if.baseline"),
               ATTR_KEY("TestResourceContainer"),
               ATTR_VALUE(0)
-        { }
+        {
+        }
 
         ~ResourceContainerTestSimulator()
         {
@@ -184,7 +185,9 @@ class ResourceContainerTestSimulator
         {
             std::chrono::milliseconds interval(DEFAULT_WAITTIME);
             if (server != nullptr)
+            {
                 server->setAttribute(ATTR_KEY, ATTR_VALUE + 10);
+            }
             std::this_thread::sleep_for(interval);
         }
 
@@ -192,7 +195,9 @@ class ResourceContainerTestSimulator
         {
             std::chrono::milliseconds interval(DEFAULT_WAITTIME);
             if (server != nullptr)
+            {
                 server = nullptr;
+            }
             std::this_thread::sleep_for(interval);
         }
 
index 6657014e304023bd49ac1edbc8792c866d5a03a7..4490884f72698c70c27d8257cfb134f810d001ff 100644 (file)
@@ -50,7 +50,10 @@ class TestBundleActivator : public BundleActivator
 class TestBundleResource : public BundleResource
 {
     public:
-        void initAttributes() { };
+        void initAttributes()
+        {
+
+        };
 
         RCSResourceAttributes handleGetAttributesRequest(
             const std::map< std::string, std::string > &queryParams)
index 5c764f73af3103f189f443346a8daccdd36a2315..8188e01d35f2fc7b5a49b922112cf1562a3ef700 100644 (file)
@@ -238,7 +238,9 @@ void process()
         displayMenu();
 
         if (selectClientMenu(processUserInput()) == QUIT_INPUT)
+        {
             break;
+        }
     }
 }
 
index fc579e7ead4a4b4209c001b7bd0a51e44d721933..770304bdefe69719ac4e6c33a685567454cb73f4 100644 (file)
@@ -293,15 +293,24 @@ void process()
 
         int ret = selectServerMenu();
 
-        if (ret == QUIT) return;
-        if (ret == CORRECT_INPUT) break;
+        if (ret == QUIT)
+        {
+            return;
+        }
+        if (ret == CORRECT_INPUT)
+        {
+            break;
+        }
     }
 
     while (true)
     {
         displayControlMenu();
 
-        if (selectControlMenu() == QUIT) return;
+        if (selectControlMenu() == QUIT)
+        {
+            return;
+        }
     }
 }
 
index 1d15dc8eee9ed9305d678d1e9201f27a9342a68e..cf0ff401610b1dcc440f1b1ecb015cedefe752f8 100644 (file)
@@ -92,7 +92,10 @@ int processUserInput(int min = std::numeric_limits<int>::min(),
     std::cin >> input;
     std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
 
-    if (!std::cin.fail() && min <= input && input <= max) return input;
+    if (!std::cin.fail() && min <= input && input <= max)
+    {
+        return input;
+    }
 
     std::cin.clear();
     std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
@@ -115,7 +118,7 @@ void displayItems(const std::vector<T>& items)
 
     const auto width = (items.size() + 1) / 10 + 1;
 
-    for(size_t i = 0; i < items.size(); ++i)
+    for (size_t i = 0; i < items.size(); ++i)
     {
         displayItem(width, i + 1, items[i]);
     }
@@ -127,7 +130,10 @@ void selectItem(const std::vector<T>& items)
 {
     int selected = processUserInput(1, items.size() + 1) - 1;
 
-    if(selected == static_cast<int>(items.size())) throw CloseApp();
+    if (selected == static_cast<int>(items.size()))
+    {
+        throw CloseApp();
+    }
 
     onSelected(items[selected]);
 }
@@ -176,7 +182,7 @@ void printAttributes(const RCSResourceAttributes& attributes)
        std::cout << "\tattributes is empty" << std::endl;
     }
 
-    for(const auto& attr : attributes)
+    for (const auto& attr : attributes)
     {
         printAttribute(attr.key(), attr.value());
     }
@@ -191,7 +197,7 @@ void print(const std::string& name, const std::vector< std::string >& elements)
     }
 
     std::cout << "\t" << name << " : " << std::endl;
-    for(const auto& item : elements)
+    for (const auto& item : elements)
     {
         std::cout << item << " ";
     }
@@ -200,7 +206,7 @@ void print(const std::string& name, const std::vector< std::string >& elements)
 
 void printUri(const std::string& uri)
 {
-    if(uri.empty())
+    if (uri.empty())
     {
         std::cout << "\turi is empty" << std::endl;
     }
@@ -219,14 +225,14 @@ void printRepresentation(const RCSRepresentation& rep)
 
     const auto& children = rep.getChildren();
 
-    if(children.empty())
+    if (children.empty())
     {
         std::cout << "\tchildren is empty" << std::endl;
     }
     else
     {
         int cnt = 0;
-        for(const auto& child : children)
+        for (const auto& child : children)
         {
             std::cout << "========================================================" << std::endl;
             std::cout << ++cnt << " chlid" << std::endl;
@@ -240,7 +246,7 @@ void onResourceStateChanged(ResourceState resourceState)
 {
     std::cout << "onResourceStateChanged callback" << std::endl;
 
-    switch(resourceState)
+    switch (resourceState)
     {
         case ResourceState::NONE:
             std::cout << "\tState changed to : NOT_MONITORING" << std::endl;
@@ -398,7 +404,7 @@ void getCachedAttribute()
 
 void stopCaching()
 {
-    if(!g_selectedResource->isCaching())
+    if (!g_selectedResource->isCaching())
     {
         std::cout << "\tCaching not started..." << std::endl;
         return;
@@ -418,12 +424,16 @@ std::string selectResourceType()
     switch (processUserInput(RESOURCE_TEMP, RESOURCE_LIGHT))
     {
     case RESOURCE_TEMP:
+    {
         g_attrKey = "Temperature";
         return RESOURCE_TYPE_TEMP;
+    }
     case RESOURCE_LIGHT:
+    {
         g_attrKey = "Brightness";
         return RESOURCE_TYPE_LIGHT;
     }
+    }
 
     throw std::logic_error("unreachable");
 }
@@ -436,7 +446,10 @@ RCSAddress inputAddress()
 
     std::string address;
 
-    if(std::cin.peek() != '\n') std::cin >> address;
+    if (std::cin.peek() != '\n')
+    {
+        std::cin >> address;
+    }
 
     return address.empty() ? RCSAddress::multicast() : RCSAddress::unicast(address);
 }
@@ -469,7 +482,7 @@ void discoverResource()
     auto discoveryTask = RCSDiscoveryManager::getInstance()->discoverResourceByType(address,
             resourceType, onResourceDiscovered);
 
-    while(processUserInput() != 1);
+    while (processUserInput() != 1);
 
     discoveryTask->cancel();
 }
@@ -509,7 +522,10 @@ void runDiscovery()
 
     handleItems(discoveryMenuItems);
 
-    if (g_discoveredResources.empty()) throw std::runtime_error("No resource found!");
+    if (g_discoveredResources.empty())
+    {
+        throw std::runtime_error("No resource found!");
+    }
 
     g_currentRun = runResourceSelection;
 }
index 3c03da338ac49dcd1384965b656f3fca7e4b3b9a..2c95ee9d3b9e47c54b551785c2ff3ac539edd945 100644 (file)
@@ -59,8 +59,14 @@ int processUserInput(int min, int max)
 
     if (!std::cin.fail())
     {
-        if(input == max + 1) throw CloseApp();
-        if(min <= input && input <= max) return input;
+        if (input == max + 1)
+        {
+            throw CloseApp();
+        }
+        if (min <= input && input <= max)
+        {
+            return input;
+        }
     }
 
     std::cin.clear();
@@ -89,7 +95,7 @@ void displayControlLightMenu()
 
 void printAttributes(const RCSResourceAttributes& attrs)
 {
-    for(const auto& attr : attrs)
+    for (const auto& attr : attrs)
     {
         std::cout << "\tkey : " << attr.key() << "\n\tvalue : "
                   << attr.value().toString() << std::endl;
@@ -144,7 +150,7 @@ void updateAttribute(const std::string& attrKey, int control)
         attrs[attrKey] = attrs[attrKey].get<int>() + diff;
     }
 
-    if(control == INCREASE)
+    if (control == INCREASE)
     {
         std::cout << attrKey << " increased." << std::endl;
     }
@@ -237,17 +243,17 @@ int main(void)
 {
     g_currentRun = runPresenceSelection;
 
-    while(true)
+    while (true)
     {
         try
         {
             g_currentRun();
         }
-        catch(const std::exception& e)
+        catch (const std::exception& e)
         {
             std::cout << e.what() << std::endl;
         }
-        catch(const CloseApp&)
+        catch (const CloseApp&)
         {
             break;
         }
@@ -256,7 +262,7 @@ int main(void)
 
     g_resource.reset();
 
-    if(g_isPresenceStarted)
+    if (g_isPresenceStarted)
     {
         stopPresence();
     }
index 9edf5919df5e550774d390f1545cdd538d28047d..f01d1e8366d131bbbc2ec0fa4aacdbc058986f96 100755 (executable)
@@ -45,7 +45,10 @@ void handleRequestWithDelay(int delayInMillis, const RCSRequest& request,
         auto& resAttrs = resObject->getAttributes();
         for (const auto& kv : requestedAttrs)
         {
-            if (resAttrs.contains(kv.key())) resAttrs[kv.key()] = kv.value();
+            if (resAttrs.contains(kv.key()))
+            {
+                resAttrs[kv.key()] = kv.value();
+            }
         }
     }
 
@@ -75,7 +78,10 @@ int processUserInput(int min, int max)
 
         if (!std::cin.fail())
         {
-            if(min <= input && input <= max) return input;
+            if(min <= input && input <= max)
+            {
+                return input;
+            }
         }
 
         std::cin.clear();
index bf96c772e931ebc0afaf08db07603736a21d39aa..c91597b667829bdd894ed1d015c018da399c4212 100644 (file)
@@ -34,9 +34,15 @@ constexpr int TOLERANCE_IN_MILLIS{ 50 };
 class FunctionObject
 {
 public:
-    virtual ~FunctionObject() { }
+    virtual ~FunctionObject()
+    {
+
+    }
 
-    virtual void execute(ExpiryTimerImpl::Id) { }
+    virtual void execute(ExpiryTimerImpl::Id)
+    {
+
+    }
 };
 
 class ExpiryTimerImplTest: public TestWithMock
@@ -61,7 +67,10 @@ private:
 
 TEST_F(ExpiryTimerImplTest, PostThrowsIfDelayIsNegative)
 {
-    ASSERT_THROW(ExpiryTimerImpl::getInstance()->post(-1, [](ExpiryTimerImpl::Id){}), RCSException);
+    ASSERT_THROW(ExpiryTimerImpl::getInstance()->post(-1,
+            [](ExpiryTimerImpl::Id)
+            {
+            }), RCSException);
 }
 
 TEST_F(ExpiryTimerImplTest, PostThrowsIfCallbackIsEmpty)
@@ -74,7 +83,8 @@ TEST_F(ExpiryTimerImplTest, CallbackBeInvokedWithinTolerance)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Do(
-            [this](ExpiryTimerImpl::Id){
+            [this](ExpiryTimerImpl::Id)
+            {
                 Proceed();
             }
     );
@@ -91,11 +101,13 @@ TEST_F(ExpiryTimerImplTest, CallbackBeInvokedWithTimerId)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Match(
-            [this, &returnedId](ExpiryTimerImpl::Id id){
+            [this, &returnedId](ExpiryTimerImpl::Id id)
+            {
                 return returnedId == id;
             }
     ).Do(
-            [this](ExpiryTimerImpl::Id){
+            [this](ExpiryTimerImpl::Id)
+            {
                 Proceed();
             }
     );
@@ -133,7 +145,8 @@ TEST_F(ExpiryTimerImplTest, CancelReturnsFalseIfAlreadyExecuted)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Do(
-        [this](ExpiryTimerImpl::Id){
+        [this](ExpiryTimerImpl::Id)
+        {
             Proceed();
         }
     );
@@ -193,7 +206,10 @@ private:
 
 TEST_F(ExpiryTimerTest, PostThrowsIfDelayIsNegative)
 {
-    ASSERT_THROW(timer.post(-1, [](ExpiryTimer::Id){}), RCSException);
+    ASSERT_THROW(timer.post(-1,
+            [](ExpiryTimer::Id)
+            {
+            }), RCSException);
 }
 
 TEST_F(ExpiryTimerTest, PostThrowsIfCallbackIsEmpty)
@@ -206,7 +222,8 @@ TEST_F(ExpiryTimerTest, CallbackBeInvokedWithinTolerance)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Do(
-            [this](ExpiryTimer::Id){
+            [this](ExpiryTimer::Id)
+            {
                 Proceed();
             }
     );
@@ -223,11 +240,13 @@ TEST_F(ExpiryTimerTest, CallbackBeInvokedWithTimerId)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Match(
-            [this, &returnedId](ExpiryTimer::Id id){
+            [this, &returnedId](ExpiryTimer::Id id)
+            {
                 return returnedId == id;
             }
     ).Do(
-            [this](ExpiryTimer::Id){
+            [this](ExpiryTimer::Id)
+            {
                 Proceed();
             }
     );
@@ -262,7 +281,8 @@ TEST_F(ExpiryTimerTest, CancelReturnsFalseIfAlreadyExecuted)
     FunctionObject* functor = mocks.Mock< FunctionObject >();
 
     mocks.ExpectCall(functor, FunctionObject::execute).Do(
-        [this](ExpiryTimer::Id){
+        [this](ExpiryTimer::Id)
+        {
             Proceed();
         }
     );
index 191e8eca1c6a68489d0e710a364229bbd0c0b5fd..5d12ad6b0f27dfa00230b02ae695603cea25f1dc 100644 (file)
@@ -77,7 +77,8 @@ TEST_F(PresenceSubscriberNonMemberTest, UnsubscribePresenceThrowIfResultIsNotOK)
 class PresenceSubscriberTest: public TestWithMock
 {
 protected:
-    void SetUp() {
+    void SetUp()
+    {
         mocks.OnCallFuncOverload(
                 static_cast< SubscribePresence1 >(OC::OCPlatform::subscribePresence)).Do(
 
index acb87328ea7ea9ee8007e29022f60d1af53b4640..ec1fde491d1b907f476a07246fff0bba6ae741bb 100644 (file)
@@ -165,7 +165,8 @@ TEST_F(ResourceAttributesIteratorTest, CanIteratesWithForeach)
 
     int count = 0;
 
-    for (auto& i : resourceAttributes) {
+    for (auto& i : resourceAttributes)
+    {
         i.key();
         ++count;
     }
@@ -178,7 +179,8 @@ TEST_F(ResourceAttributesIteratorTest, IteratesWithRef)
     const char arbitraryStr[] { "ftryb457" };
     resourceAttributes[KEY] = 1;
 
-    for (auto& i : resourceAttributes) {
+    for (auto& i : resourceAttributes)
+    {
         i.value() = arbitraryStr;
     }
 
index ed6225cdcd8b3faeaa71fd4a8f8d70b0fe460ca5..524445d932cdf2b7289fa8d64d9e782c465a76b1 100644 (file)
@@ -69,7 +69,10 @@ protected:
         TestWithMock::SetUp();
         instance = DeviceAssociation::getInstance();
         device = (DevicePresencePtr)new DevicePresence();
-        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
+        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                [](PrimitiveResource*)
+                {
+                });
     }
 
     void TearDown()
index e773f15b47c74bd35627b9449f0eb54959361bc0..65646fe33afc4c449c1e7b5e55f0a6a05f72f886 100644 (file)
@@ -52,8 +52,15 @@ protected:
     {
         TestWithMock::SetUp();
         instance = (DevicePresence*)new DevicePresence();
-        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
-        cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
+        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                                           [](PrimitiveResource*)
+                                           {
+
+                                           });
+        cb = ([](BROKER_STATE)->OCStackResult
+                {
+                    return OC_STACK_OK;
+                });
         id = 0;
     }
 
@@ -85,7 +92,8 @@ TEST_F(DevicePresenceTest,SubscribeCB_NormalHandlingIfMessageOC_STACK_OK)
    mocks.OnCall(pResource.get(), PrimitiveResource::getHost).Return(std::string());
    mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Do(
             [](OC::OCPlatform::OCPresenceHandle&,
-                    const std::string&, OCConnectivityType, SubscribeCallback callback)->OCStackResult{
+                    const std::string&, OCConnectivityType, SubscribeCallback callback)->OCStackResult
+    {
 
         callback(OC_STACK_OK,0,std::string());
         return OC_STACK_OK;
index 2cddd25548ba230debdad615e1aaf1acb0a7bcf7..478f716dc261fb79bbaeb077daed6c6f0eca8a58 100644 (file)
@@ -48,8 +48,15 @@ protected:
     {
         TestWithMock::SetUp();
         brokerInstance = ResourceBroker::getInstance();
-        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
-        cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
+        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                                           [](PrimitiveResource*)
+                                           {
+
+                                           });
+        cb = ([](BROKER_STATE)->OCStackResult
+                {
+                    return OC_STACK_OK;
+                });
         id = 0;
     }
 
@@ -179,7 +186,10 @@ TEST_F(ResourceBrokerTest,getResourceState_NormalErrorHandlingIfAbnormalResource
 
     for(int i=0;i!=3;i++)
     {
-        resource[i] = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
+        resource[i] = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                [](PrimitiveResource*)
+                {
+                });
         mocks.OnCall(resource[i].get(), PrimitiveResource::requestGet);
         mocks.OnCall(resource[i].get(), PrimitiveResource::getHost).Return(std::string());
         mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Return(OC_STACK_OK);
index 31ca22e26329283c928c5f656d65e155e9730879..d87d186e37238ac0eeca9fefda2cbf888d0a70fb 100644 (file)
@@ -59,8 +59,15 @@ protected:
     {
         TestWithMock::SetUp();
         instance.reset(new ResourcePresence());
-        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
-        cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
+        pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                                           [](PrimitiveResource*)
+                                           {
+
+                                           });
+        cb = ([](BROKER_STATE)->OCStackResult
+                {
+                    return OC_STACK_OK;
+                });
         id = 0;
     }
 
@@ -75,7 +82,11 @@ protected:
 
     void MockingFunc()
     {
-        mocks.OnCall(pResource.get(), PrimitiveResource::requestGet).Do([](GetCallback){});
+        mocks.OnCall(pResource.get(), PrimitiveResource::requestGet).Do(
+                [](GetCallback)
+                {
+
+                });
         mocks.OnCall(pResource.get(), PrimitiveResource::getHost).Return(std::string());
         mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Return(OC_STACK_OK);
     }
@@ -218,30 +229,32 @@ TEST_F(ResourcePresenceTest,getCB_NormalHandlingIfMessageOC_STACK_OK)
 {
 
     mocks.ExpectCall(pResource.get(), PrimitiveResource::requestGet).Do(
-                [](GetCallback callback){
-
-        OIC::Service::HeaderOptions op;
-        RCSResourceAttributes attr;
-        OIC::Service::ResponseStatement res(attr);
+                [](GetCallback callback)
+                {
+                    OIC::Service::HeaderOptions op;
+                    RCSResourceAttributes attr;
+                    OIC::Service::ResponseStatement res(attr);
 
-        callback(op,res,OC_STACK_OK);
+                    callback(op,res,OC_STACK_OK);
 
-    });
+                });
 
     mocks.OnCall(pResource.get(), PrimitiveResource::requestGet).Do(
-                                [](GetCallback){
-        std::cout <<"End call requestGetFunc()\n";
-                    });
+                [](GetCallback)
+                {
+                    std::cout <<"End call requestGetFunc()\n";
+                });
     mocks.OnCall(pResource.get(), PrimitiveResource::getHost).Return("address1");
 
     mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Do(
             [](OC::OCPlatform::OCPresenceHandle&,
-                    const std::string&, OCConnectivityType, SubscribeCallback callback)->OCStackResult{
-
-        callback(OC_STACK_OK,0,std::string());
-        return OC_STACK_OK;
+                    const std::string&, OCConnectivityType, SubscribeCallback callback)->OCStackResult
+                {
+                    callback(OC_STACK_OK,0,std::string());
+                    return OC_STACK_OK;
 
-    }).Return(OC_STACK_OK);
+                }
+    ).Return(OC_STACK_OK);
 
     instance->initializeResourcePresence(pResource);
     sleep(3);
index 41029b753cead1f9673deba0a63081412500edfe..b7a8d5673714009d201c84c21d721669b75b568e 100644 (file)
@@ -50,11 +50,18 @@ class DataCacheTest : public TestWithMock
         virtual void SetUp()
         {
             TestWithMock::SetUp();
-            pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {});
+            pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                                               [](PrimitiveResource *)
+                                               {
+
+                                               });
 
             mocks.OnCall(pResource.get(), PrimitiveResource::isObservable).Return(false);
             cacheHandler.reset(new DataCache());
-            cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
+            cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult
+                    {
+                        return OC_STACK_OK;
+                    });
         }
 
         virtual void TearDown()
index 5bf9f748a13505386d389cbffb18bf16bc20524e..43bfe4172f0352f4d140b87d6bb9bf8efeabc24d 100644 (file)
@@ -40,9 +40,16 @@ class ResourceCacheManagerTest : public TestWithMock
         {
             TestWithMock::SetUp();
             cacheInstance = ResourceCacheManager::getInstance();
-            pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {});
+            pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(),
+                                               [](PrimitiveResource *)
+                                               {
+
+                                               });
             mocks.OnCall(pResource.get(), PrimitiveResource::isObservable).Return(false);
-            cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
+            cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult
+                    {
+                        return OC_STACK_OK;
+                    });
         }
 
         virtual void TearDown()
index 757202278d4a95f9ced7636cd1ff9ac2da004577..84624e1addbe48e6bad51286878aef6a2759e660 100755 (executable)
@@ -40,7 +40,10 @@ constexpr char RESOURCE_URI[]{ "/a/TemperatureSensor" };
 constexpr char RESOURCE_TYPE[]{ "resource.type" };
 constexpr char SECOND_RESOURCETYPE[]{ "resource.type.second" };
 
-void onResourceDiscovered(RCSRemoteResourceObject::Ptr) {}
+void onResourceDiscovered(RCSRemoteResourceObject::Ptr)
+{
+
+}
 
 class ScopedTask
 {
@@ -52,7 +55,10 @@ public:
 
     ~ScopedTask()
     {
-        if (m_task) m_task->cancel();
+        if (m_task)
+        {
+            m_task->cancel();
+        }
     }
 
     RCSDiscoveryManager::DiscoveryTask* operator->()
@@ -126,7 +132,8 @@ TEST(DiscoveryManagerTest, TaskCanBeCanceled)
     ASSERT_TRUE(aTaskToBeCanceled->isCanceled());
 }
 
-TEST(DiscoveryManagerTest, CallbackWouldNotBeCalledForSameRemoteResource) {
+TEST(DiscoveryManagerTest, CallbackWouldNotBeCalledForSameRemoteResource)
+{
     FindCallback callback;
 
     MockRepository mocks;
index c9b9e9bb9c3009b70dbda66855cde808307a5b2d..e01cb84203d08dcc5c0e8afd9fe57f378d42bc80 100644 (file)
@@ -95,7 +95,9 @@ void startObserve(std::shared_ptr< OCResource > resource)
 
     QueryParamsMap test;
     if (OC_STACK_OK != resource->observe(ObserveType::Observe , test , &onObserve))
+    {
         std::cout << "To Fail resource observe() process" << std::endl;
+    }
 }
 
 void startGet(std::shared_ptr< OCResource > resource)
@@ -110,7 +112,9 @@ void startGet(std::shared_ptr< OCResource > resource)
     QueryParamsMap test;
     std::cout << "URI :" << resource->uri() << std::endl;
     if (OC_STACK_OK != resource->get(test, &onGet))
+    {
         std::cout << "To Fail resource get() process" << std::endl;
+    }
 }
 
 void startPost(std::shared_ptr< OCResource > resource)
@@ -128,7 +132,9 @@ void startPost(std::shared_ptr< OCResource > resource)
 
     QueryParamsMap test;
     if (OC_STACK_OK != resource->post(rep, test, &onPost))
+    {
         std::cout << "To Fail resource post() process" << std::endl;
+    }
 }
 
 void startDelete(std::shared_ptr< OCResource > resource)
@@ -141,7 +147,9 @@ void startDelete(std::shared_ptr< OCResource > resource)
 
     g_curResource = resource;
     if (OC_STACK_OK != resource->deleteResource(&onDelete))
+    {
         std::cout << "To Fail resource delete() process" << std::endl;
+    }
 }
 
 int observe_count()
@@ -368,7 +376,8 @@ int main()
             continue;
         }
 
-        try {
+        try
+        {
             switch ((int)in)
             {
                 case OBSERVE:
@@ -384,7 +393,9 @@ int main()
                     std::cout << "Invalid input, please try again" << std::endl;
                     break;
             }
-        }catch(OCException & e) {
+        }
+        catch(OCException & e)
+        {
             std::cout<< "Caught OCException [Code: "<<e.code()<<" Reason: "<<e.reason()<<std::endl;
         }
     }
index ffbd056639754c578b4e52552532972796888f40..1fc42fe69b025c9f9c5d3c4b7e02504463e18596 100644 (file)
@@ -76,7 +76,10 @@ namespace OIC
 
         void HostingObject::destroyHostingObject()
         {
-            if (pDestroyCB) pDestroyCB();
+            if (pDestroyCB)
+            {
+                pDestroyCB();
+            }
         }
 
         void HostingObject::stateChangedCB(ResourceState state)
@@ -117,9 +120,11 @@ namespace OIC
                 break;
             }
             default:
+            {
                 // not support of state
                 break;
             }
+            }
         }
 
         void HostingObject::dataChangedCB(const RCSResourceAttributes & attributes)
@@ -178,7 +183,8 @@ namespace OIC
                         std::bind(&HostingObject::setRequestHandler, this,
                                 std::placeholders::_1, std::placeholders::_2));
                 return retResource;
-            } catch (...)
+            }
+            catch (...)
             {
                 OIC_HOSTING_LOG(DEBUG, "[HostingObject::createMirroredServer] %s", "Exception");
                 throw;
@@ -193,7 +199,8 @@ namespace OIC
                 RequestObject::invokeRequest(getRemoteResource(),
                         primitiveRequest, RequestObject::RequestMethod::Set, resourceAttibutes);
 
-            } catch (const RCSPlatformException & e)
+            }
+            catch (const RCSPlatformException & e)
             {
                 OIC_HOSTING_LOG(DEBUG,
                         "[HostingObject::setRequestHandler] PlatformException:%s",
index c3215f41005d013d19ff0713822d596b891d7d3b..df8ffaa9961c1194aa397ec860a3152162394cc8 100644 (file)
@@ -57,9 +57,11 @@ namespace OIC
             case RequestMethod::Get:
             case RequestMethod::Delete:
             default:
+            {
                 // unknown type of method.
                 break;
             }
+            }
         }
 
         void RequestObject::setRequestCB(
@@ -67,7 +69,10 @@ namespace OIC
                 const RCSRequest & request, RequestObject::Ptr /*this_ptr*/)
         {
             auto server = request.getResourceObject().lock();
-            if (!server) return;
+            if (!server)
+            {
+                return;
+            }
 
             RCSResourceObject::LockGuard guard(server);
             server->getAttributes() = RCSResourceAttributes(returnedAttributes);
index 2ead1e4cf6616cb352663b43cb9273caddd476d8..fa7ab7224cfac59e294064c09de4ee14c1239ec9 100755 (executable)
@@ -51,14 +51,20 @@ namespace OIC
 
         void ResourceHosting::startHosting()
         {
-            if (m_isStartedHosting) return;
+            if (m_isStartedHosting)
+            {
+                return;
+            }
             m_isStartedHosting = true;
             createDiscoveryListener();
         }
 
         void ResourceHosting::stopHosting()
         {
-            if (!m_isStartedHosting) return;
+            if (!m_isStartedHosting)
+            {
+                return;
+            }
 
             if (!m_discoveryTask->isCanceled())
             {
@@ -89,7 +95,10 @@ namespace OIC
             }
 
             auto foundHostingObject = findRemoteResource(remoteResource);
-            if (foundHostingObject != nullptr) return;
+            if (foundHostingObject != nullptr)
+            {
+                return;
+            }
 
             try
             {
@@ -100,7 +109,8 @@ namespace OIC
                 RHLock lock(m_mutexForList);
                 m_hostingObjects.insert(std::make_pair(key, foundHostingObject));
 
-            } catch (const RCSException & e)
+            }
+            catch (const RCSException & e)
             {
                 OIC_HOSTING_LOG(DEBUG,
                         "[ResourceHosting::discoverHandler]InvalidParameterException:%s", e.what());
@@ -112,7 +122,10 @@ namespace OIC
             RHLock lock(m_mutexForList);
 
             auto iter = m_hostingObjects.find(generateHostingObjectKey(remoteResource));
-            if (iter != m_hostingObjects.end()) return iter->second;
+            if (iter != m_hostingObjects.end())
+            {
+                return iter->second;
+            }
 
             return nullptr;
         }
index acef45ba68f9674ad8609094f5b01a899f4e9cc8..39090b2b9f91d37e4b349f0ae1ed995241efa95b 100755 (executable)
@@ -42,7 +42,9 @@ FactorySetResource::FactorySetResource()
     m_configurationRep.setResourceTypes(m_configurationTypes);
 }
 
-FactorySetResource::~FactorySetResource(){}
+FactorySetResource::~FactorySetResource()
+{
+}
 
 /// This function internally calls registerResource API.
 void FactorySetResource::createResources(ResourceEntityHandler callback)
index d83e86d8b8ddcbc4d9bd378452ef6a3a803e0a87..5ba9877dbcc9e418c3a7a355357bbc71873ccc3a 100755 (executable)
@@ -114,15 +114,25 @@ void onUpdate(const HeaderOptions& /*headerOptions*/, const OCRepresentation& re
     std::cout << "\tResource URI: " << rep.getUri() << std::endl;
 
     if (rep.hasAttribute("n"))
+    {
         std::cout << "\t\tDeviceName:" << rep.getValue< std::string >("n") << std::endl;
+    }
     if (rep.hasAttribute("loc"))
+    {
         std::cout << "\t\tLocation:" << rep.getValue< std::string >("loc") << std::endl;
+    }
     if (rep.hasAttribute("locn"))
+    {
         std::cout << "\t\tLocationName:" << rep.getValue< std::string >("locn") << std::endl;
+    }
     if (rep.hasAttribute("c"))
+    {
         std::cout << "\t\tCurrency:" << rep.getValue< std::string >("c") << std::endl;
+    }
     if (rep.hasAttribute("r"))
+    {
         std::cout << "\t\tRegion:" << rep.getValue< std::string >("r") << std::endl;
+    }
 }
 
 void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
@@ -139,15 +149,25 @@ void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep,
     std::cout << "\tResource URI: " << rep.getUri() << std::endl;
 
     if (rep.hasAttribute("n"))
+    {
         std::cout << "\t\tDeviceName:" << rep.getValue< std::string >("n") << std::endl;
+    }
     if (rep.hasAttribute("loc"))
+    {
         std::cout << "\t\tLocation:" << rep.getValue< std::string >("loc") << std::endl;
+    }
     if (rep.hasAttribute("locn"))
+    {
         std::cout << "\t\tLocationName:" << rep.getValue< std::string >("locn") << std::endl;
+    }
     if (rep.hasAttribute("c"))
+    {
         std::cout << "\t\tCurrency:" << rep.getValue< std::string >("c") << std::endl;
+    }
     if (rep.hasAttribute("r"))
+    {
         std::cout << "\t\tRegion:" << rep.getValue< std::string >("r") << std::endl;
+    }
 }
 
 // Callback to found collection resource
@@ -165,11 +185,17 @@ void onFoundCollectionResource(std::vector< std::shared_ptr< OCResource > > reso
             if (resource)
             {
                 if (resource->uri() == "/core/a/configuration/resourceset")
+                {
                     g_configurationCollection = resource;
+                }
                 else if (resource->uri() == "/core/a/maintenance/resourceset")
+                {
                     g_maintenanceCollection = resource;
+                }
                 else if (resource->uri() == "/core/a/factoryset/resourceset")
+                {
                     g_setCollection = resource;
+                }
                 else
                 {
                     pthread_mutex_lock(&mutex_lock);
@@ -232,20 +258,26 @@ void onFoundCandidateResource(std::vector< std::shared_ptr< OCResource > > resou
                             OCPlatform::bindResource(configurationCollectionHandle,
                                     foundResourceHandle);
                             if (g_configurationResource == NULL)
+                            {
                                 g_configurationResource = resource;
+                            }
                         }
                         else if (resource->uri() == "/oic/mnt")
                         {
                             OCPlatform::bindResource(maintenanceCollectionHandle,
                                     foundResourceHandle);
                             if (g_maintenanceResource == NULL)
+                            {
                                 g_maintenanceResource = resource;
+                            }
                         }
                         else if (resource->uri() == "/factoryset")
                         {
                             OCPlatform::bindResource(setCollectionHandle, foundResourceHandle);
                             if (g_setResource == NULL)
+                            {
                                 g_setResource = resource;
+                            }
                         }
 
                         resourceHandleVector.push_back(foundResourceHandle);
@@ -517,7 +549,8 @@ int main()
 
             }
         }
-    }catch (OCException e)
+    }
+    catch (OCException e)
     {
         std::cout << "Exception in main: " << e.what();
     }
index e925ca95af3c35d8ed6b84e8dff8f2c7748e59e5..d2f431c8c2b4bed2e401cb8b7b190a925b51bbd3 100755 (executable)
@@ -55,9 +55,13 @@ void Time::setTime(unsigned int yy, unsigned int mm, unsigned int dd,
 void Time::setDayOfWeekForRecursive(int day)
 {
     if (day != -1)
+    {
         type = RECURSIVE;
+    }
     else
+    {
         return;
+    }
 
     setTime(0, 0, 0, 0, 0, 0, day);
 }
@@ -87,8 +91,10 @@ unsigned int Time::getSec()
 }
 long int Time::getSecondsFromAbsoluteTime()
 {
-    if(mTime.tm_year > 1900)
+    if (mTime.tm_year > 1900)
+    {
         mTime.tm_year -= 1900;
+    }
 
     mTime.tm_mon -= 1;
 
@@ -100,8 +106,10 @@ long int Time::getSecAbsTime()
 }
 long int Time::getSecondsForWeeklySchedule()
 {
-    if(mTime.tm_year > 1900)
+    if (mTime.tm_year > 1900)
+    {
         mTime.tm_year -= 1900;
+    }
 
     mTime.tm_mon -= 1;
     return getRelativeIntervalOfWeek(&mTime);
@@ -109,7 +117,7 @@ long int Time::getSecondsForWeeklySchedule()
 
 void Time::setDelay(long int seconds)
 {
-    if(type != NONE)
+    if (type != NONE)
     {
         mDelay = seconds;
     }
index 15684478ba3f244889eac28e3b50d35c4038b90f..fcaa5e6a43e6698973f3b6ab4f0ab4be8099aef6 100755 (executable)
@@ -266,7 +266,7 @@ OCStackResult GroupManager::bindResourceToGroup(OCResourceHandle& childHandle, s
     }
 
     return result;
- }
+}
 
 
 
@@ -370,7 +370,8 @@ void GroupManager::checkCollectionRepresentation(const OCRepresentation& rep,
                             std::bind(&GroupManager::collectionPresenceHandler, this,
                                     std::placeholders::_1, std::placeholders::_2,
                                     std::placeholders::_3, hostAddress, oit->getUri())));
-        }catch(OCException& e)
+        }
+        catch(OCException& e)
         {
             std::cout<< "Exception in subscribePresence: "<< e.what() << std::endl;
         }
@@ -437,7 +438,9 @@ std::string GroupManager::getStringFromActionSet(const ActionSet *newActionSet)
     std::string message = "";
 
     if(newActionSet == NULL)
+    {
         return message;
+    }
 
     message = newActionSet->actionsetName;
     message.append("*");
@@ -458,7 +461,9 @@ std::string GroupManager::getStringFromActionSet(const ActionSet *newActionSet)
             message.append((*iterCapa)->status);
 
             if (iterCapa + 1 != (*iterAction)->listOfCapability.end())
+            {
                 message.append("|");
+            }
         }
 
         if (iterAction + 1 != newActionSet->listOfAction.end())
@@ -470,12 +475,14 @@ std::string GroupManager::getStringFromActionSet(const ActionSet *newActionSet)
     return message;
 }
 
-#define DELETE(p) { \
+#define DELETE(p) \
+{ \
     delete p; \
     p = NULL; \
 }
 
-#define DELETEARRAY(p) { \
+#define DELETEARRAY(p) \
+{ \
     delete[] p; \
     p = NULL; \
 }
@@ -517,7 +524,9 @@ ActionSet* GroupManager::getActionSetfromString(std::string description)
         actionset->actionsetName = std::string(token);
 
         if((actionset->actionsetName).empty())
+        {
             goto exit;
+        }
 
         // Find the second token
         token = strtok_r(NULL, ACTION_DELIMITER, &plainPtr);
@@ -618,14 +627,20 @@ ActionSet* GroupManager::getActionSetfromString(std::string description)
                         token = strtok_r(NULL, ATTR_DELIMITER, &attrPtr);
 
                         if( token == NULL )
+                        {
                             goto exit;
+                        }
 
                         capa->status = std::string(token);
 
                         if (action != NULL)
+                        {
                             action->listOfCapability.push_back(capa);
+                        }
                         else
+                        {
                             goto exit;
+                        }
                     }
 
                     token = strtok_r(NULL, ATTR_DELIMITER, &attrPtr);
@@ -640,7 +655,9 @@ ActionSet* GroupManager::getActionSetfromString(std::string description)
                 action = NULL;
             }
             else
+            {
                 goto exit;
+            }
             //delete action;
         }
         else
index 1d938834dc252c206774c85633a722a7cb2ba3b7..02e32346aa055a038ff3f63aae666426230c0f6a 100755 (executable)
@@ -80,10 +80,14 @@ namespace OIC
         { "c","Currency", "/oic/con" } };
 
         for (int i = 0; i < NUMCONFUNIT; i++)
+        {
             ConfigurationUnitTable.push_back(unit[i]);
+        }
     }
 
-    ThingsConfiguration::~ThingsConfiguration(void){}
+    ThingsConfiguration::~ThingsConfiguration(void)
+    {
+    }
 
     void ThingsConfiguration::setGroupManager(GroupManager *groupmanager)
     {
@@ -113,7 +117,9 @@ namespace OIC
         for (auto it = ConfigurationUnitTable.begin(); ConfigurationUnitTable.end() != it; it++)
         {
             if ((*it).m_name == name)
+            {
                 return (*it).m_attribute;
+            }
         }
 
         return "";
@@ -124,7 +130,9 @@ namespace OIC
         for (auto it = ConfigurationUnitTable.begin(); ConfigurationUnitTable.end() != it; it++)
         {
             if ((*it).m_name == name)
+            {
                 return (*it).m_uri;
+            }
         }
 
         return "";
@@ -136,9 +144,13 @@ namespace OIC
                 configurationRequestTable.find(conf);
 
         if (it == configurationRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_updateVal;
+        }
 
     }
     std::shared_ptr< OCResource > ThingsConfiguration::getResource(std::string conf)
@@ -147,9 +159,13 @@ namespace OIC
                 configurationRequestTable.find(conf);
 
         if (it == configurationRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_resource;
+        }
     }
 
     ConfigurationCallback ThingsConfiguration::getCallback(std::string conf)
@@ -158,9 +174,13 @@ namespace OIC
                 configurationRequestTable.find(conf);
 
         if (it == configurationRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_callback;
+        }
     }
 
     std::string ThingsConfiguration::getListOfSupportedConfigurationUnits()
@@ -176,9 +196,13 @@ namespace OIC
             it++;
 
             if (it == ConfigurationUnitTable.end())
+            {
                 break;
+            }
             else
+            {
                 res += ",";
+            }
         }
 
         res += "]}";
@@ -192,9 +216,13 @@ namespace OIC
         std::string newUri;
 
         if ((f = oldUri.find("/factoryset/oic/")) != string::npos)
+        {
             newUri = oldUri.replace(f, oldUri.size(), "");
+        }
         else if ((f = oldUri.find("/oic/")) != string::npos)
+        {
             newUri = oldUri.replace(f, oldUri.size(), "");
+        }
 
         return newUri;
     }
@@ -249,7 +277,9 @@ namespace OIC
         std::string attrKey = conf;
 
         if (uri == "")
+        {
             return;
+        }
 
         if (resource)
         {
@@ -309,12 +339,18 @@ namespace OIC
         std::string uri = getUriByConfigurationName(conf);
 
         if (uri == "")
+        {
             return;
+        }
 
         if (uri == "/factoryset" || uri == "/factoryset/oic/con")
+        {
             m_if.push_back(BATCH_INTERFACE);
+        }
         else
+        {
             m_if.push_back(DEFAULT_INTERFACE);
+        }
 
         std::vector < OCRepresentation > children = rep.getChildren();
         for (auto oit = children.begin(); oit != children.end(); ++oit)
@@ -333,7 +369,8 @@ namespace OIC
                         oit->getResourceTypes(), m_if);
 
                 p_resources.push_back(tempResource);
-            } catch (std::exception& e)
+            }
+            catch (std::exception& e)
             {
                 std::cout << "Exception: " << e.what() << std::endl;
             }
@@ -406,7 +443,9 @@ namespace OIC
         for (unsigned int i = 0; i < resource->getResourceTypes().size(); ++i)
         {
             if (resource->getResourceTypes().at(i).find(".resourceset", 0) != std::string::npos)
+            {
                 return false;
+            }
         }
 
         return true;
@@ -417,7 +456,9 @@ namespace OIC
         for (unsigned int i = 0; i < resource->getResourceInterfaces().size(); ++i)
         {
             if (resource->getResourceInterfaces().at(i) == BATCH_INTERFACE)
+            {
                 return true;
+            }
         }
 
         return false;
@@ -479,7 +520,9 @@ namespace OIC
         std::map< std::string, ConfigurationRequestEntry >::iterator iter =
                 configurationRequestTable.find(conf);
         if (iter != configurationRequestTable.end())
+        {
             configurationRequestTable.erase(iter);
+        }
 
         // Create new request entry stored in the queue
         ConfigurationRequestEntry newCallback(conf, callback, resource, it->second);
@@ -538,7 +581,9 @@ namespace OIC
         std::map< std::string, ConfigurationRequestEntry >::iterator iter =
                 configurationRequestTable.find(conf);
         if (iter != configurationRequestTable.end())
+        {
             configurationRequestTable.erase(iter);
+        }
 
         // Create new request entry stored in the queue
         ConfigurationRequestEntry newCallback(conf, callback, resource, conf);
@@ -553,7 +598,9 @@ namespace OIC
             std::string m_if = DEFAULT_INTERFACE;
 
             if (hasBatchInterface(resource))
+            {
                 m_if = BATCH_INTERFACE;
+            }
 
             return resource->get(resource->getResourceTypes().at(0), m_if, query,
                     std::function<
@@ -633,9 +680,13 @@ namespace OIC
     OCStackResult ThingsConfiguration::doBootstrap(ConfigurationCallback callback)
     {
         if(callback == NULL)
+        {
             return OC_STACK_ERROR;
+        }
         else
+        {
           g_bootstrapCallback = callback;
+        }
 
         // Find bootstrap server.
         std::vector < std::string > type;
index 725591144b245b0278cc787cd07ae5480961ea65..7bf0ff3df0c879e28b2585305e84430b65c69648 100755 (executable)
@@ -72,7 +72,9 @@ namespace OIC
                 { "fr", "Factory Reset", "/oic/mnt" } };
 
         for (int i = 0; i < NUMDIAGUNIT; i++)
+        {
             MaintenanceUnitTable.push_back(unit[i]);
+        }
     }
 
     ThingsMaintenance::~ThingsMaintenance()
@@ -107,7 +109,9 @@ namespace OIC
         for (auto it = MaintenanceUnitTable.begin(); MaintenanceUnitTable.end() != it; it++)
         {
             if ((*it).m_name == name)
+            {
                 return (*it).m_attribute;
+            }
         }
 
         return "";
@@ -118,7 +122,9 @@ namespace OIC
         for (auto it = MaintenanceUnitTable.begin(); MaintenanceUnitTable.end() != it; it++)
         {
             if ((*it).m_name == name)
+            {
                 return (*it).m_uri;
+            }
         }
 
         return "";
@@ -130,9 +136,13 @@ namespace OIC
                 maintenanceRequestTable.find(mnt);
 
         if (it == maintenanceRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_updateVal;
+        }
 
     }
     std::shared_ptr< OCResource > ThingsMaintenance::getResource(std::string mnt)
@@ -141,9 +151,13 @@ namespace OIC
                 maintenanceRequestTable.find(mnt);
 
         if (it == maintenanceRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_resource;
+        }
     }
 
     MaintenanceCallback ThingsMaintenance::getCallback(std::string mnt)
@@ -152,9 +166,13 @@ namespace OIC
                 maintenanceRequestTable.find(mnt);
 
         if (it == maintenanceRequestTable.end())
+        {
             return NULL;
+        }
         else
+        {
             return it->second.m_callback;
+        }
     }
 
     std::string ThingsMaintenance::getHostFromURI(std::string oldUri)
@@ -163,9 +181,13 @@ namespace OIC
         std::string newUri;
 
         if ((f = oldUri.find("/factoryset/oic/")) != string::npos)
+        {
             newUri = oldUri.replace(f, oldUri.size(), "");
+        }
         else if ((f = oldUri.find("/oic/")) != string::npos)
+        {
             newUri = oldUri.replace(f, oldUri.size(), "");
+        }
 
         return newUri;
     }
@@ -183,9 +205,13 @@ namespace OIC
             it++;
 
             if (it == MaintenanceUnitTable.end())
+            {
                 break;
+            }
             else
+            {
                 res += ",";
+            }
         }
 
         res += "]}";
@@ -220,7 +246,9 @@ namespace OIC
         std::string attrKey = mnt;
 
         if (uri == "")
+        {
             return;
+        }
 
         if (resource)
         {
@@ -348,7 +376,9 @@ namespace OIC
         for (unsigned int i = 0; i < resource->getResourceTypes().size(); ++i)
         {
             if (resource->getResourceTypes().at(0).find(".resourceset", 0) != std::string::npos)
+            {
                 return false;
+            }
         }
 
         return true;
@@ -369,7 +399,9 @@ namespace OIC
         std::map< std::string, MaintenanceRequestEntry >::iterator iter =
                 maintenanceRequestTable.find(mnt);
         if (iter != maintenanceRequestTable.end())
+        {
             maintenanceRequestTable.erase(iter);
+        }
 
         // Create new request entry stored in the queue
         MaintenanceRequestEntry newCallback(mnt, callback, resource, "true");
@@ -422,7 +454,9 @@ namespace OIC
         std::map< std::string, MaintenanceRequestEntry >::iterator iter =
                 maintenanceRequestTable.find(mnt);
         if (iter != maintenanceRequestTable.end())
+        {
             maintenanceRequestTable.erase(iter);
+        }
 
         // Create new request entry stored in the queue
         MaintenanceRequestEntry newCallback(mnt, callback, resource, "true");
index 53812ff4e0fc10ca0f2b4611b9502b08aefe6d97..e12ebab8bf48e31ef87778024c7c8a13cc86bae2 100755 (executable)
@@ -1134,7 +1134,10 @@ TEST_F(ThingsManagerTest, testAddActionSetAllBulbOff)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1207,7 +1210,10 @@ TEST_F(ThingsManagerTest, testAddActionSetAllBulbOn)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1304,7 +1310,10 @@ TEST_F(ThingsManagerTest, testExecuteActionSetAllBulbOn)
 
     mocks.ExpectCallFunc(onPost).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1330,7 +1339,10 @@ TEST_F(ThingsManagerTest, testExecuteActionSetAllBulbOff)
 {
     mocks.ExpectCallFunc(onPost).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1360,7 +1372,10 @@ TEST_F(ThingsManagerTest, testExcecuteActionSetWithDelay)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1382,7 +1397,10 @@ TEST_F(ThingsManagerTest, testExcecuteActionSetWithDelay)
 
     mocks.ExpectCallFunc(onPost).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1404,7 +1422,10 @@ TEST_F(ThingsManagerTest, testExcecuteActionSetWithDelayEqulasZero)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1444,7 +1465,10 @@ TEST_F(ThingsManagerTest, testExcecuteActionSetWithInvalidDelay)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1485,7 +1509,10 @@ TEST_F(ThingsManagerTest, testExcecuteActionSetWithDelayWithResourceNull)
 
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     for (auto iter = lights.begin(); iter != lights.end(); ++iter)
     {
@@ -1516,7 +1543,10 @@ TEST_F(ThingsManagerTest, testCancelActionSet)
 {
     mocks.ExpectCallFunc(onPost).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1541,7 +1571,10 @@ TEST_F(ThingsManagerTest, testDeleteActionSet)
 {
     mocks.ExpectCallFunc(onPut).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1566,7 +1599,10 @@ TEST_F(ThingsManagerTest, testGetActionSet)
 {
     mocks.ExpectCallFunc(onPost).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     if (g_resource)
     {
@@ -1598,7 +1634,10 @@ TEST_F(ThingsManagerTest, testGetConfigurations)
 
     mocks.ExpectCallFunc(onGet).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     vector<string> types;
     types.push_back("oic.wk.con");
@@ -1672,7 +1711,10 @@ TEST_F(ThingsManagerTest, testDoBootstrap)
 
     mocks.ExpectCallFunc(onGetBootstrapInformation).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
     result = g_thingsConf->doBootstrap(&onGetBootstrapInformation);
     Wait();
     EXPECT_TRUE(result == OC_STACK_OK);
@@ -1702,7 +1744,10 @@ TEST_F(ThingsManagerTest, testUpdateConfiguration)
 
     mocks.ExpectCallFunc(onUpdate).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     vector<string> types;
     types.push_back("oic.wk.con");
@@ -1770,7 +1815,10 @@ TEST_F(ThingsManagerTest, testReboot)
 
     mocks.ExpectCallFunc(onReboot).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     vector<string> types;
     types.push_back("oic.wk.mnt");
@@ -1807,7 +1855,10 @@ TEST_F(ThingsManagerTest, testFactoryReset)
 
     mocks.ExpectCallFunc(onFactoryReset).
     Do([this](const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
-            const int /*eCode*/) {   Proceed();});
+            const int /*eCode*/)
+            {
+                Proceed();
+            });
 
     vector<string> types;
     types.push_back("oic.wk.mnt");