From: jyong2.kim Date: Thu, 25 Jun 2015 04:13:53 +0000 (+0900) Subject: Update Caching cancel logic. X-Git-Tag: 1.2.0+RC1~1430^2~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=0516c617d970e7d39fe59b57cde0cb6ccfbc1858;p=platform%2Fupstream%2Fiotivity.git Update Caching cancel logic. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/1421 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka Reviewed-by: Hun-je Yeon Reviewed-by: Younghyun Joo Reviewed-by: Uze Choi --- diff --git a/service/SConscript b/service/SConscript index 02142f6..656a198 100644 --- a/service/SConscript +++ b/service/SConscript @@ -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') diff --git a/service/resource-manipulation/SConscript b/service/resource-manipulation/SConscript index 4d7e052..81085eb 100644 --- a/service/resource-manipulation/SConscript +++ b/service/resource-manipulation/SConscript @@ -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') diff --git a/service/resource-manipulation/modules/resourceCache/include/ResourceCacheManager.h b/service/resource-manipulation/modules/resourceCache/include/ResourceCacheManager.h index fa54b1f..040c3fc 100755 --- a/service/resource-manipulation/modules/resourceCache/include/ResourceCacheManager.h +++ b/service/resource-manipulation/modules/resourceCache/include/ResourceCacheManager.h @@ -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; diff --git a/service/resource-manipulation/modules/resourceCache/src/ResourceCacheManager.cpp b/service/resource-manipulation/modules/resourceCache/src/ResourceCacheManager.cpp index c174919..aa36896 100755 --- a/service/resource-manipulation/modules/resourceCache/src/ResourceCacheManager.cpp +++ b/service/resource-manipulation/modules/resourceCache/src/ResourceCacheManager.cpp @@ -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(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