Update Caching cancel logic.
authorjyong2.kim <jyong2.kim@samsung.com>
Thu, 25 Jun 2015 04:13:53 +0000 (13:13 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 30 Jun 2015 05:06:17 +0000 (05:06 +0000)
Modify unused parameter in cancelResourceCache().
Change return type of cancelResourceCache() to CacheID
Fix Sconscript for Resource Manipulation.

Change-Id: I3723619599d40a081c58133d12a75d487ddcc8cc
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1421
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Younghyun Joo <yh_.joo@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/SConscript
service/resource-manipulation/SConscript
service/resource-manipulation/modules/resourceCache/include/ResourceCacheManager.h
service/resource-manipulation/modules/resourceCache/src/ResourceCacheManager.cpp

index 02142f6..656a198 100644 (file)
@@ -41,8 +41,8 @@ if target_os not in ['arduino','darwin','ios']:
        # Build notification manager project
        SConscript('notification-manager/SConscript')
 
-        # Build resource-manipulation project
-        #SCconscript('resource-manipulation/SConscript')
+       # Build resource-manipulation project
+       #SConscript('resource-manipulation/SConscript')
 #else:
 #      SConscript('notification-manager/SampleApp/arduino/SConscript')
 
index 4d7e052..81085eb 100644 (file)
@@ -25,11 +25,11 @@ import platform
 
 Import('env')
 
-SConscript('common/SConscript')
-#SConscript('resourceBroker/SConscript')
-#SConscript('resourceCache/SConscript')
-SConscript('serverBuilder/SConscript')
-SConscript('resourceContainer/SConscript')
+SConscript('modules/common/SConscript')
+#SConscript('modules/resourceBroker/SConscript')
+#SConscript('modules/resourceCache/SConscript')
+SConscript('modules/serverBuilder/SConscript')
+SConscript('modules/resourceContainer/SConscript')
 #SConscript('sdk/SConscript')
 
 
index fa54b1f..040c3fc 100755 (executable)
@@ -39,7 +39,7 @@ public:
     CacheID requestResourceCache(
             PrimitiveResourcePtr pResource,
                 CacheCB func = NULL, REPORT_FREQUENCY rf = REPORT_FREQUENCY::NONE, long time = 0l);
-    OCStackResult cancelResourceCache(PrimitiveResourcePtr pResource, CacheID id);
+    CacheID cancelResourceCache(CacheID id);
     OCStackResult updateResourceCache(PrimitiveResourcePtr pResource);
 
     const ResourceAttributes getCachedData(PrimitiveResourcePtr pResource) const;
index c174919..aa36896 100755 (executable)
@@ -42,7 +42,6 @@ ResourceCacheManager::~ResourceCacheManager()
     }
 }
 
-
 ResourceCacheManager * ResourceCacheManager::getInstance()
 {
     if(s_instance == nullptr)
@@ -61,13 +60,13 @@ CacheID ResourceCacheManager::requestResourceCache(
         PrimitiveResourcePtr pResource, CacheCB func,
         REPORT_FREQUENCY rf, long reportTime)
 {
-    CacheID ret = 0;
+    CacheID retID = 0;
 
     if(rf != REPORT_FREQUENCY::NONE)
     {
         if(func == NULL)
         {
-            return ret;
+            return retID;
         }
         if(!reportTime)
         {
@@ -82,38 +81,30 @@ CacheID ResourceCacheManager::requestResourceCache(
         newHandler = std::make_shared<DataCache>(pResource, func, rf, reportTime);
         s_cacheDataList->push_back(newHandler);
     }
-    ret = newHandler->addSubscriber(func, rf, reportTime);
+    retID = newHandler->addSubscriber(func, rf, reportTime);
 
-    return ret;
+    return retID;
 }
 
-OCStackResult ResourceCacheManager::cancelResourceCache(PrimitiveResourcePtr pResource, CacheID id)
+CacheID ResourceCacheManager::cancelResourceCache(CacheID id)
 {
-    OCStackResult ret = OC_STACK_ERROR;
-
+    CacheID retID = 0;
     if(id == 0)
     {
-        return ret;
+        return retID;
     }
 
-    // TODO cancel cache
-    CacheID retID = 0;
-    DataCachePtr deleteCacheHandler = findDataCache(pResource);
-    if(deleteCacheHandler == nullptr)
+    DataCachePtr foundCacheHandler = findDataCache(id);
+    if(foundCacheHandler == nullptr)
     {
-        return ret;
+        return retID;
     }
     else
     {
-        retID = deleteCacheHandler->deleteSubscriber(id);
+        retID = foundCacheHandler->deleteSubscriber(id);
     }
 
-    if(retID == id)
-    {
-        ret = OC_STACK_OK;
-    }
-
-    return ret;
+    return retID;
 }
 
 DataCachePtr ResourceCacheManager::findDataCache(PrimitiveResourcePtr pResource) const