From: coderhyme Date: Fri, 24 Jul 2015 16:17:03 +0000 (+0900) Subject: Rename ResourceAttributes to RCSResourceAttributes X-Git-Tag: 1.0.0-RC1~264 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e84baa67581a368a844dfe49410bde8ee0d68e45;p=contrib%2Fiotivity.git Rename ResourceAttributes to RCSResourceAttributes Prefix is added for consistency for exposed headers. Change-Id: I4b038fe5fdd79bfbc6d5b8963491332a180b77a4 Signed-off-by: coderhyme Reviewed-on: https://gerrit.iotivity.org/gerrit/1893 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/notification-manager/NotificationManager/src/HostingObject.cpp b/service/notification-manager/NotificationManager/src/HostingObject.cpp index c831e25..c28de84 100644 --- a/service/notification-manager/NotificationManager/src/HostingObject.cpp +++ b/service/notification-manager/NotificationManager/src/HostingObject.cpp @@ -140,7 +140,7 @@ void HostingObject::stateChangedCB(ResourceState state, RemoteObjectPtr rObject) } } -void HostingObject::dataChangedCB(const ResourceAttributes & attributes, RemoteObjectPtr rObject) +void HostingObject::dataChangedCB(const RCSResourceAttributes & attributes, RemoteObjectPtr rObject) { if(attributes.empty()) { @@ -162,7 +162,7 @@ void HostingObject::dataChangedCB(const ResourceAttributes & attributes, RemoteO } } - ResourceAttributes rData; + RCSResourceAttributes rData; { RCSResourceObject::LockGuard guard(mirroredServer); rData = mirroredServer->getAttributes(); @@ -226,7 +226,7 @@ HostingObject::ResourceObjectPtr HostingObject::createMirroredServer(RemoteObjec } RCSSetResponse HostingObject::setRequestHandler(const RCSRequest & primitiveRequest, - ResourceAttributes & resourceAttibutes) + RCSResourceAttributes & resourceAttibutes) { try { diff --git a/service/notification-manager/NotificationManager/src/HostingObject.h b/service/notification-manager/NotificationManager/src/HostingObject.h index 9129c3b..efdd0f9 100644 --- a/service/notification-manager/NotificationManager/src/HostingObject.h +++ b/service/notification-manager/NotificationManager/src/HostingObject.h @@ -44,11 +44,11 @@ private: typedef std::shared_ptr PrimiteveResourcePtr; typedef std::function BrokerCallback; - typedef std::function CacheCallback; + typedef std::function CacheCallback; typedef std::function DestroyedCallback; typedef std::function< - RCSSetResponse(const RCSRequest&, ResourceAttributes&)> SetRequestHandler; + RCSSetResponse(const RCSRequest&, RCSResourceAttributes&)> SetRequestHandler; public: HostingObject(); @@ -73,10 +73,10 @@ private: ResourceObjectPtr createMirroredServer(RemoteObjectPtr rObject); void stateChangedCB(ResourceState state, RemoteObjectPtr rObject); - void dataChangedCB(const ResourceAttributes & attributes, RemoteObjectPtr rObject); + void dataChangedCB(const RCSResourceAttributes & attributes, RemoteObjectPtr rObject); RCSSetResponse setRequestHandler( - const RCSRequest & request, ResourceAttributes & attributes); + const RCSRequest & request, RCSResourceAttributes & attributes); void destroyHostingObject(); diff --git a/service/notification-manager/NotificationManager/src/RequestObject.cpp b/service/notification-manager/NotificationManager/src/RequestObject.cpp index 4d91328..b78073f 100644 --- a/service/notification-manager/NotificationManager/src/RequestObject.cpp +++ b/service/notification-manager/NotificationManager/src/RequestObject.cpp @@ -26,7 +26,7 @@ namespace Service { void RequestObject::invokeRequest(RemoteObjectPtr remoteObject, RequestMethod method, - const RCSRequest & pRequest, ResourceAttributes & resourceAttibutes) + const RCSRequest & pRequest, RCSResourceAttributes & resourceAttibutes) { try { @@ -49,8 +49,8 @@ void RequestObject::invokeRequest(RemoteObjectPtr remoteObject, RequestMethod me } } -void RequestObject::setRequestCB(const ResourceAttributes & returnedAttributes, - ResourceAttributes & putAttibutes) +void RequestObject::setRequestCB(const RCSResourceAttributes & returnedAttributes, + RCSResourceAttributes & putAttibutes) { if(putAttibutes != returnedAttributes) { diff --git a/service/notification-manager/NotificationManager/src/RequestObject.h b/service/notification-manager/NotificationManager/src/RequestObject.h index 4d716ea..073faa2 100644 --- a/service/notification-manager/NotificationManager/src/RequestObject.h +++ b/service/notification-manager/NotificationManager/src/RequestObject.h @@ -45,11 +45,11 @@ public: ~RequestObject() = default; void invokeRequest(RemoteObjectPtr remoteObject, RequestMethod method, - const RCSRequest & pRequest, ResourceAttributes & resourceAttibutes); + const RCSRequest & pRequest, RCSResourceAttributes & resourceAttibutes); private: - void setRequestCB(const ResourceAttributes & returnedAttributes, - ResourceAttributes & putAttibutes); + void setRequestCB(const RCSResourceAttributes & returnedAttributes, + RCSResourceAttributes & putAttibutes); }; } /* namespace Service */ diff --git a/service/resource-encapsulation/examples/linux/SampleResourceClient.cpp b/service/resource-encapsulation/examples/linux/SampleResourceClient.cpp index 35fd950..32225c2 100644 --- a/service/resource-encapsulation/examples/linux/SampleResourceClient.cpp +++ b/service/resource-encapsulation/examples/linux/SampleResourceClient.cpp @@ -1,7 +1,7 @@ #include #include "ResourceClient.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" #include "OCPlatform.h" using namespace std; @@ -9,7 +9,7 @@ using namespace OC; using namespace OIC::Service; std::shared_ptr resource; -ResourceAttributes resourceAttributes; +RCSResourceAttributes resourceAttributes; bool startCachingFlag; bool isReady; @@ -48,7 +48,7 @@ void OnResourceStateChanged(ResourceState resourceState) } //callback for startCaching() [uptodate] -void OnCacheUpdated(const ResourceAttributes atttribute ) +void OnCacheUpdated(const RCSResourceAttributes atttribute ) { cout << "\nOnCacheUpdated callback" << std::endl; if (atttribute.empty()) @@ -57,7 +57,7 @@ void OnCacheUpdated(const ResourceAttributes atttribute ) } else { - ResourceAttributes::const_iterator iter = atttribute.begin(); + RCSResourceAttributes::const_iterator iter = atttribute.begin(); for (unsigned int i = 0; i < atttribute.size(); ++i) { std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl; @@ -67,7 +67,7 @@ void OnCacheUpdated(const ResourceAttributes atttribute ) } //callback for getRemoteAttributes() -void OnRemoteAttributesReceivedCallback(const ResourceAttributes &atttribute) +void OnRemoteAttributesReceivedCallback(const RCSResourceAttributes &atttribute) { std::cout << "\nOnRemoteAttributesReceivedCallback callback" << std::endl; @@ -78,7 +78,7 @@ void OnRemoteAttributesReceivedCallback(const ResourceAttributes &atttribute) else { resourceAttributes = atttribute; - ResourceAttributes::const_iterator iter = atttribute.begin(); + RCSResourceAttributes::const_iterator iter = atttribute.begin(); for (unsigned int i = 0; i < atttribute.size(); ++i) { std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl; @@ -88,7 +88,7 @@ void OnRemoteAttributesReceivedCallback(const ResourceAttributes &atttribute) } //callback for setRemoteAttributes() -void OnRemoteAttributesSetCallback(const ResourceAttributes &atttribute) +void OnRemoteAttributesSetCallback(const RCSResourceAttributes &atttribute) { std::cout << "\nOnRemoteAttributesSetCallback callback" << std::endl; @@ -99,7 +99,7 @@ void OnRemoteAttributesSetCallback(const ResourceAttributes &atttribute) else { resourceAttributes = atttribute; - ResourceAttributes::const_iterator iter = atttribute.begin(); + RCSResourceAttributes::const_iterator iter = atttribute.begin(); for (unsigned int i = 0; i < atttribute.size(); ++i) { std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl; @@ -190,7 +190,7 @@ int main() } else { - ResourceAttributes::const_iterator iter = resourceAttributes.begin(); + RCSResourceAttributes::const_iterator iter = resourceAttributes.begin(); for (unsigned int i = 0; i < resourceAttributes.size(); ++i) { if ( iter->key() == "Temperature") @@ -257,14 +257,14 @@ int main() { try { - ResourceAttributes atttribute = resource->getCachedAttributes(); + RCSResourceAttributes atttribute = resource->getCachedAttributes(); if (atttribute.empty()) { cout << "Received cached attribute is empty" << std::endl; } else { - ResourceAttributes::const_iterator iter = atttribute.begin(); + RCSResourceAttributes::const_iterator iter = atttribute.begin(); for (unsigned int i = 0; i < atttribute.size(); ++i) { std::cout << "\nkey : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl; @@ -282,7 +282,7 @@ int main() std::string key = "Temperature"; try { - ResourceAttributes::Value valueObj = resource->getCachedAttribute(key); + RCSResourceAttributes::Value valueObj = resource->getCachedAttribute(key); int value = valueObj.get< int >(); cout << "\nkey : " << key << "\nValue : " << value << std::endl; } diff --git a/service/resource-encapsulation/examples/linux/SampleResourceServer.cpp b/service/resource-encapsulation/examples/linux/SampleResourceServer.cpp index cd2f88f..abb3605 100644 --- a/service/resource-encapsulation/examples/linux/SampleResourceServer.cpp +++ b/service/resource-encapsulation/examples/linux/SampleResourceServer.cpp @@ -46,12 +46,12 @@ void displayMenu() //hander for get request (if developer choose second option for resource Creation) RCSGetResponse RequestHandlerForGet(const RCSRequest &request, - ResourceAttributes &attrs) + RCSResourceAttributes &attrs) { cout << "Recieved a Get request from Client" << std::endl; RCSResourceObject::LockGuard lock(*server); - ResourceAttributes attr = server->getAttributes(); - ResourceAttributes::const_iterator iter = attr.begin(); + RCSResourceAttributes attr = server->getAttributes(); + RCSResourceAttributes::const_iterator iter = attr.begin(); cout << "\nSending response to Client : " << std::endl; for (unsigned int i = 0; i < attr.size(); ++i) { @@ -63,10 +63,10 @@ RCSGetResponse RequestHandlerForGet(const RCSRequest &request, //hander for set request (if developer choose second option for resource Creation) RCSSetResponse RequestHandlerForSet(const RCSRequest &request, - ResourceAttributes &attrs) + RCSResourceAttributes &attrs) { cout << "Recieved a Set request from Client" << std::endl; - ResourceAttributes::const_iterator iter = attrs.begin(); + RCSResourceAttributes::const_iterator iter = attrs.begin(); for (unsigned int i = 0; i < attrs.size(); ++i) { std::cout << "\tkey : " << iter->key() << "\n\tvalue : " << iter->value().toString() << std::endl; @@ -170,7 +170,7 @@ int main(void) case 1: { RCSResourceObject::LockGuard lock(*server); - ResourceAttributes attrs = server->getAttributes(); + RCSResourceAttributes attrs = server->getAttributes(); attrs[attributeKey] = (server->getAttribute(attributeKey) + 10); server->setAttribute(attributeKey, attrs[attributeKey]); @@ -179,7 +179,7 @@ int main(void) //getting the current attribute and priniting it on the console attrs = server->getAttributes(); cout << "\nCurrent Temperature : "; - ResourceAttributes::const_iterator iter = attrs.begin(); + RCSResourceAttributes::const_iterator iter = attrs.begin(); for (unsigned int i = 0; i < attrs.size(); ++i) { std::cout << iter->value().toString() << std::endl; @@ -190,7 +190,7 @@ int main(void) case 2: { RCSResourceObject::LockGuard lock(*server); - ResourceAttributes attrs = server->getAttributes(); + RCSResourceAttributes attrs = server->getAttributes(); attrs[attributeKey] = (server->getAttribute(attributeKey) - 10); server->setAttribute(attributeKey, attrs[attributeKey]); cout << "\nTemperature decreased by 10 degree" << endl; @@ -198,7 +198,7 @@ int main(void) //getting the current attribute and priniting it on the console attrs = server->getAttributes(); cout << "\nCurrent Temperature : "; - ResourceAttributes::const_iterator iter = attrs.begin(); + RCSResourceAttributes::const_iterator iter = attrs.begin(); for (unsigned int i = 0; i < attrs.size(); ++i) { std::cout << iter->value().toString() << std::endl; diff --git a/service/resource-encapsulation/include/ResourceAttributes.h b/service/resource-encapsulation/include/RCSResourceAttributes.h similarity index 84% rename from service/resource-encapsulation/include/ResourceAttributes.h rename to service/resource-encapsulation/include/RCSResourceAttributes.h index 99d1181..5558e81 100644 --- a/service/resource-encapsulation/include/ResourceAttributes.h +++ b/service/resource-encapsulation/include/RCSResourceAttributes.h @@ -18,8 +18,8 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#ifndef RES_ENCAPSULATION_RESOURCEATTRIBUTES_H -#define RES_ENCAPSULATION_RESOURCEATTRIBUTES_H +#ifndef RES_MANIPULATION_RESOURCEATTRIBUTES_H +#define RES_MANIPULATION_RESOURCEATTRIBUTES_H // To avoid conflict using different boost::variant configuration with OC. // It causes compile errors. @@ -41,7 +41,7 @@ /** * @file * - * This file contains the "ResourceAttributes" class & its helper classes + * This file contains the "RCSResourceAttributes" class & its helper classes */ namespace OIC { @@ -68,13 +68,13 @@ namespace OIC }; /** - * ResourceAttributes represents the attributes for a resource. + * RCSResourceAttributes represents the attributes for a resource. * * It provides similar usage to c++ standard containers. (iterator, * operators and accessors)
* An attribute value can be one of various types.
* - * @note If client developer wants to get the ResourceAttributes for the resource of + * @note If client developer wants to get the RCSResourceAttributes for the resource of * interest following are the steps: * - first call the discover API of DiscoveryManager class. * - After getting the RemoteResourceObject, call getRemoteAttributes() API @@ -88,7 +88,7 @@ namespace OIC * @see RemoteResourceObject * @see RCSResourceObject */ - class ResourceAttributes + class RCSResourceAttributes { private: template< typename T > struct IsSupportedTypeHelper; @@ -99,7 +99,7 @@ namespace OIC double, bool, std::string, - ResourceAttributes + RCSResourceAttributes > ValueVariant; template< typename T, typename V = void, @@ -152,14 +152,14 @@ namespace OIC DOUBLE, /**< double */ BOOL, /**< bool */ STRING, /**< std::string */ - ATTRIBUTES, /**< ResourceAttributes */ + ATTRIBUTES, /**< RCSResourceAttributes */ VECTOR /**< std::vector */ }; /** * A Helper class to identify types of Value. * - * @see ResourceAttributes + * @see RCSResourceAttributes * @see Value * @see TypeId */ @@ -214,7 +214,7 @@ namespace OIC * * Type helps identify type information of Value. * - * @see ResourceAttributes + * @see RCSResourceAttributes * @see Type * @see is_supported_type */ @@ -297,7 +297,7 @@ namespace OIC void swap(Value&); //! @cond - friend class ResourceAttributes; + friend class RCSResourceAttributes; //! @endcond private: @@ -336,12 +336,12 @@ namespace OIC class const_iterator; public: - ResourceAttributes() = default; - ResourceAttributes(const ResourceAttributes&) = default; - ResourceAttributes(ResourceAttributes&&) = default; + RCSResourceAttributes() = default; + RCSResourceAttributes(const RCSResourceAttributes&) = default; + RCSResourceAttributes(RCSResourceAttributes&&) = default; - ResourceAttributes& operator=(const ResourceAttributes&) = default; - ResourceAttributes& operator=(ResourceAttributes&&) = default; + RCSResourceAttributes& operator=(const RCSResourceAttributes&) = default; + RCSResourceAttributes& operator=(RCSResourceAttributes&&) = default; /** * Returns an {@link iterator} referring to the first element. @@ -498,20 +498,20 @@ namespace OIC //! @cond friend class ResourceAttributesConverter; - friend bool operator==(const ResourceAttributes&, const ResourceAttributes&); + friend bool operator==(const RCSResourceAttributes&, const RCSResourceAttributes&); //! @endcond }; /** * A helper class to avoid obscure comparisons of values which are supported - * by ResourceAttributes::Value caused by implicitly converting a value - * to a ResourceAttributes::Value. + * by RCSResourceAttributes::Value caused by implicitly converting a value + * to a RCSResourceAttributes::Value. * * @see Value - * @see ResourceAttributes + * @see RCSResourceAttributes * @see is_supported_type */ - class ResourceAttributes::Value::ComparisonHelper + class RCSResourceAttributes::Value::ComparisonHelper { public: ComparisonHelper(const Value&); @@ -535,13 +535,13 @@ namespace OIC }; template< typename T > - struct ResourceAttributes::IsSupportedTypeHelper + struct RCSResourceAttributes::IsSupportedTypeHelper { typedef boost::mpl::contains::type> type; }; template - struct ResourceAttributes::IndexOfType + struct RCSResourceAttributes::IndexOfType { typedef typename boost::mpl::find< ValueVariant::types, T >::type iter; typedef typename boost::mpl::begin< ValueVariant::types >::type mpl_begin; @@ -550,107 +550,107 @@ namespace OIC }; /** - * @relates ResourceAttributes::Type + * @relates RCSResourceAttributes::Type * * Checks if the objects are equal, that is, whether types are exactly same. * * @return true if the objects are equal, false otherwise. */ - bool operator==(const ResourceAttributes::Type&, const ResourceAttributes::Type&); + bool operator==(const RCSResourceAttributes::Type&, const RCSResourceAttributes::Type&); /** - * @relates ResourceAttributes::Type + * @relates RCSResourceAttributes::Type * * Checks if the objects are not equal, that is, whether types are not exactly same. * * @return true if the objects are not equal, false otherwise. */ - bool operator!=(const ResourceAttributes::Type&, const ResourceAttributes::Type&); + bool operator!=(const RCSResourceAttributes::Type&, const RCSResourceAttributes::Type&); /** - * @relates ResourceAttributes::Value + * @relates RCSResourceAttributes::Value * * Checks if the contents are equal, that is, * whether types are matched and underlying values are equal. * * @return true if the contents are equal, false otherwise. */ - bool operator==(const ResourceAttributes::Value::ComparisonHelper&, - const ResourceAttributes::Value::ComparisonHelper&); + bool operator==(const RCSResourceAttributes::Value::ComparisonHelper&, + const RCSResourceAttributes::Value::ComparisonHelper&); /** - * @relates ResourceAttributes::Value + * @relates RCSResourceAttributes::Value * * Checks if the contents are not equal, that is, * whether types are not matched or underlying values are not equal. * * @return true if the contents are not equal, false otherwise. */ - bool operator!=(const ResourceAttributes::Value::ComparisonHelper&, - const ResourceAttributes::Value::ComparisonHelper&); + bool operator!=(const RCSResourceAttributes::Value::ComparisonHelper&, + const RCSResourceAttributes::Value::ComparisonHelper&); //! @cond template< typename T > - typename std::enable_if< ResourceAttributes::is_supported_type< T >::value || + typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value || std::is_constructible< std::string, T >::value, bool >::type - operator==(const ResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs) + operator==(const RCSResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs) { return lhs.equals(rhs); } template< typename T > - typename std::enable_if< ResourceAttributes::is_supported_type< T >::value || + typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value || std::is_constructible< std::string, T >::value, bool >::type - operator==(const T& lhs, const ResourceAttributes::Value::ComparisonHelper& rhs) + operator==(const T& lhs, const RCSResourceAttributes::Value::ComparisonHelper& rhs) { return rhs == lhs; } template< typename T > - typename std::enable_if< ResourceAttributes::is_supported_type< T >::value || + typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value || std::is_constructible< std::string, T >::value, bool >::type - operator!=(const ResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs) + operator!=(const RCSResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs) { return !(lhs == rhs); } template< typename T > - typename std::enable_if< ResourceAttributes::is_supported_type< T >::value || + typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value || std::is_constructible< std::string, T >::value, bool >::type - operator!=(const T& lhs, const ResourceAttributes::Value::ComparisonHelper& rhs) + operator!=(const T& lhs, const RCSResourceAttributes::Value::ComparisonHelper& rhs) { return !(rhs == lhs); } //! @endcond /** - * @relates ResourceAttributes + * @relates RCSResourceAttributes * * Checks if the attributes are equal, that is, whether contents are equal. * * @return true if the attributes are equal, false otherwise. */ - bool operator==(const ResourceAttributes& lhs, const ResourceAttributes& rhs); + bool operator==(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs); /** - * @relates ResourceAttributes + * @relates RCSResourceAttributes * * Checks if the attributes are not equal, that is, whether contents are not equal. * * @return true if the attributes are not equal, false otherwise. */ - bool operator!=(const ResourceAttributes&, const ResourceAttributes&); + bool operator!=(const RCSResourceAttributes&, const RCSResourceAttributes&); /** * KeyValuePair is a class to access attribute's key and value of an element pointed by - * iterators of ResourceAttributes. + * iterators of RCSResourceAttributes. * * - * @see ResourceAttributes + * @see RCSResourceAttributes * @see iterator * @see const_iterator */ - class ResourceAttributes::KeyValuePair + class RCSResourceAttributes::KeyValuePair { private: class KeyVisitor: public boost::static_visitor< const std::string& > @@ -676,8 +676,8 @@ namespace OIC public: const std::string& key() const; - const ResourceAttributes::Value& value() const; - ResourceAttributes::Value& value(); + const RCSResourceAttributes::Value& value() const; + RCSResourceAttributes::Value& value(); private: KeyValuePair(const KeyValuePair&) = default; @@ -701,12 +701,12 @@ namespace OIC /** * A forward iterator to KeyValuePair. * - * @see ResourceAttributes + * @see RCSResourceAttributes * @see KeyValuePair * @see const_iterator */ - class ResourceAttributes::iterator: - public std::iterator< std::forward_iterator_tag, ResourceAttributes::KeyValuePair > + class RCSResourceAttributes::iterator: + public std::iterator< std::forward_iterator_tag, RCSResourceAttributes::KeyValuePair > { private: typedef std::unordered_map< std::string, Value >::iterator base_iterator; @@ -731,10 +731,10 @@ namespace OIC private: base_iterator m_cur; - ResourceAttributes::KeyValuePair m_keyValuePair; + RCSResourceAttributes::KeyValuePair m_keyValuePair; //! @cond - friend class ResourceAttributes; + friend class RCSResourceAttributes; //! @endcond }; @@ -742,13 +742,13 @@ namespace OIC /** * A forward iterator to const KeyValuePair. * - * @see ResourceAttributes + * @see RCSResourceAttributes * @see KeyValuePair * @see iterator */ - class ResourceAttributes::const_iterator: + class RCSResourceAttributes::const_iterator: public std::iterator < std::forward_iterator_tag, - const ResourceAttributes::KeyValuePair > + const RCSResourceAttributes::KeyValuePair > { private: typedef std::unordered_map< std::string, Value >::const_iterator base_iterator; @@ -756,10 +756,10 @@ namespace OIC public: const_iterator(); const_iterator(const const_iterator&) = default; - const_iterator(const ResourceAttributes::iterator&); + const_iterator(const RCSResourceAttributes::iterator&); const_iterator& operator=(const const_iterator&) = default; - const_iterator& operator=(const ResourceAttributes::iterator&); + const_iterator& operator=(const RCSResourceAttributes::iterator&); reference operator*() const; pointer operator->() const; @@ -775,14 +775,14 @@ namespace OIC private: base_iterator m_cur; - ResourceAttributes::KeyValuePair m_keyValuePair; + RCSResourceAttributes::KeyValuePair m_keyValuePair; //! @cond - friend class ResourceAttributes; + friend class RCSResourceAttributes; //! @endcond }; } } -#endif // RES_ENCAPSULATION_RESOURCEATTRIBUTES_H +#endif // RES_MANIPULATION_RESOURCEATTRIBUTES_H diff --git a/service/resource-encapsulation/include/RCSResourceObject.h b/service/resource-encapsulation/include/RCSResourceObject.h index 7093441..9a46525 100755 --- a/service/resource-encapsulation/include/RCSResourceObject.h +++ b/service/resource-encapsulation/include/RCSResourceObject.h @@ -33,7 +33,7 @@ #include -#include +#include #include #include @@ -165,7 +165,7 @@ namespace OIC * * @return reference of this Builder */ - Builder &setAttributes(const ResourceAttributes &attributes); + Builder &setAttributes(const RCSResourceAttributes &attributes); /** * API for setting attributes of the resource. @@ -174,7 +174,7 @@ namespace OIC * * @return reference of this Builder */ - Builder &setAttributes(ResourceAttributes &&attributes); + Builder &setAttributes(RCSResourceAttributes &&attributes); /** * API for constructing a new RCSResourceObject. @@ -193,18 +193,18 @@ namespace OIC std::string m_type; std::string m_interface; uint8_t m_properties; - ResourceAttributes m_resourceAttributes; + RCSResourceAttributes m_resourceAttributes; }; class LockGuard; typedef std::function < RCSGetResponse(const RCSRequest &, - ResourceAttributes &) > GetRequestHandler; + RCSResourceAttributes &) > GetRequestHandler; typedef std::function < RCSSetResponse(const RCSRequest &, - ResourceAttributes &) > SetRequestHandler; + RCSResourceAttributes &) > SetRequestHandler; - typedef std::function < void(const ResourceAttributes::Value &, - const ResourceAttributes::Value &) > AttributeUpdatedListener; + typedef std::function < void(const RCSResourceAttributes::Value &, + const RCSResourceAttributes::Value &) > AttributeUpdatedListener; public: RCSResourceObject(RCSResourceObject&&) = delete; @@ -223,22 +223,22 @@ namespace OIC * * @note It is guaranteed thread-safety about attributes. */ - void setAttribute(const std::string &key, const ResourceAttributes::Value & value); + void setAttribute(const std::string &key, const RCSResourceAttributes::Value & value); /** * @overload */ - void setAttribute(const std::string &key, ResourceAttributes::Value&& value); + void setAttribute(const std::string &key, RCSResourceAttributes::Value&& value); /** * @overload */ - void setAttribute(std::string&& key, const ResourceAttributes::Value & value); + void setAttribute(std::string&& key, const RCSResourceAttributes::Value & value); /** * @overload */ - void setAttribute(std::string&& key, ResourceAttributes::Value&& value); + void setAttribute(std::string&& key, RCSResourceAttributes::Value&& value); /** * API for getting attribute value corresponding to a key(name of that attribute). @@ -252,7 +252,7 @@ namespace OIC * @throw InvalidKeyException * Throw exception when empty string is provided as Attribute key. */ - ResourceAttributes::Value getAttributeValue(const std::string &key) const; + RCSResourceAttributes::Value getAttributeValue(const std::string &key) const; /** * API for retrieving the attribute value associated with the supplied name. @@ -305,12 +305,12 @@ namespace OIC * @throw NoLockException * If you don't do lock with LockGuard, throw exception. */ - ResourceAttributes &getAttributes(); + RCSResourceAttributes &getAttributes(); /** * @overload */ - const ResourceAttributes &getAttributes() const; + const RCSResourceAttributes &getAttributes() const; /** * API for checking whether the particular resource is observable or not @@ -422,7 +422,7 @@ namespace OIC SetRequestHandlerPolicy getSetRequestHandlerPolicy() const; private: - RCSResourceObject(uint8_t, ResourceAttributes&&); + RCSResourceObject(uint8_t, RCSResourceAttributes&&); OCEntityHandlerResult entityHandler(std::shared_ptr< OC::OCResourceRequest >); @@ -433,13 +433,13 @@ namespace OIC void expectOwnLock() const; void autoNotify(bool, AutoNotifyPolicy) const; - void autoNotifyIfNeeded(const std::string& , const ResourceAttributes::Value& ); + void autoNotifyIfNeeded(const std::string& , const RCSResourceAttributes::Value& ); private: const uint8_t m_properties; OCResourceHandle m_resourceHandle; - ResourceAttributes m_resourceAttributes; + RCSResourceAttributes m_resourceAttributes; GetRequestHandler m_getRequestHandler; SetRequestHandler m_setRequestHandler; diff --git a/service/resource-encapsulation/include/RCSResponse.h b/service/resource-encapsulation/include/RCSResponse.h index b40cd9f..a73b57c 100644 --- a/service/resource-encapsulation/include/RCSResponse.h +++ b/service/resource-encapsulation/include/RCSResponse.h @@ -36,7 +36,7 @@ namespace OIC namespace Service { //forward declaration of classes - class ResourceAttributes; + class RCSResourceAttributes; class RequestHandler; class SetRequestHandler; @@ -48,94 +48,94 @@ namespace OIC class RCSGetResponse { public: - /** - * Create RCSGetResponse with default response. - * - * @return RCSGetResponse - instance of RCSGetResponse - */ + /** + * Create RCSGetResponse with default response. + * + * @return RCSGetResponse - instance of RCSGetResponse + */ static RCSGetResponse defaultAction(); - /** - * Create RCSGetResponse using OCEntityHandlerResult value and error code provided. - * - * @param result -OCEntityHandlerResult - * - * @param errorCode - error code to set in response - * - * @return RCSGetResponse - instance of RCSGetResponse - * - * NOTE : OCEntityHandlerResult is defined in octypes.h - */ - static RCSGetResponse create(const OCEntityHandlerResult &result, int errorCode); + /** + * Create RCSGetResponse using OCEntityHandlerResult value and error code provided. + * + * @param result -OCEntityHandlerResult + * + * @param errorCode - error code to set in response + * + * @return RCSGetResponse - instance of RCSGetResponse + * + * NOTE : OCEntityHandlerResult is defined in octypes.h + */ + static RCSGetResponse create(const OCEntityHandlerResult &result, int errorCode); - /** - * Create RCSGetResponse using resource attributes. - * - * @param attrs -ResourceAttributes to set - * - * @return RCSGetResponse - instance of RCSGetResponse - * - * @see ResourceAttributes - * - * NOTE : ResourceAttributes is defined in ResourceAttributes.h - */ - static RCSGetResponse create(const ResourceAttributes &attrs); - /** - * Create RCSGetResponse using ResourceAttributes, OCEntityHandlerResult and error code. - * - * @param attrs - ResourceAttributes to set - * - * @param result - OCEntityHandlerResult - * - * @param errorCode - error code for response - * - * @return RCSGetResponse - instance of RCSGetResponse - * - * @see ResourceAttributes - * - *NOTE : OCEntityHandlerResult is defined in octypes.h. - * ResourceAttributes is defined in ResourceAttributes.h. - */ - static RCSGetResponse create(const ResourceAttributes &attrs, - const OCEntityHandlerResult &result, int errorCode); + /** + * Create RCSGetResponse using resource attributes. + * + * @param attrs -RCSResourceAttributes to set + * + * @return RCSGetResponse - instance of RCSGetResponse + * + * @see RCSResourceAttributes + * + * NOTE : RCSResourceAttributes is defined in RCSResourceAttributes.h + */ + static RCSGetResponse create(const RCSResourceAttributes &attrs); + /** + * Create RCSGetResponse using RCSResourceAttributes, OCEntityHandlerResult and error code. + * + * @param attrs - RCSResourceAttributes to set + * + * @param result - OCEntityHandlerResult + * + * @param errorCode - error code for response + * + * @return RCSGetResponse - instance of RCSGetResponse + * + * @see RCSResourceAttributes + * + *NOTE : OCEntityHandlerResult is defined in octypes.h. + * RCSResourceAttributes is defined in RCSResourceAttributes.h. + */ + static RCSGetResponse create(const RCSResourceAttributes &attrs, + const OCEntityHandlerResult &result, int errorCode); - /** - * Create RCSGetResponse using ResourceAttributes value. - * - * @param attrs - ResourceAttributes to set - * - * @return RCSGetResponse - instance of RCSGetResponse - * - * @see ResourceAttributes - * - *NOTE : ResourceAttributes is defined in ResourceAttributes.h. - */ - static RCSGetResponse create(ResourceAttributes &&attrs); - /** - * Create RCSGetResponse using ResourceAttributes value. - * - * @param attrs - ResourceAttributes to set - * - * @param result - OCEntityHandlerResult - * - * @param errorCode - error code for response - * - * @return RCSGetResponse - instance of RCSGetResponse - * - * @see ResourceAttributes - * - *NOTE : OCEntityHandlerResult is defined in octypes.h. - * ResourceAttributes is defined in ResourceAttributes.h. - */ - static RCSGetResponse create(ResourceAttributes &&attrs, const OCEntityHandlerResult &result, - int errorCode); + /** + * Create RCSGetResponse using RCSResourceAttributes value. + * + * @param attrs - RCSResourceAttributes to set + * + * @return RCSGetResponse - instance of RCSGetResponse + * + * @see RCSResourceAttributes + * + *NOTE : RCSResourceAttributes is defined in RCSResourceAttributes.h. + */ + static RCSGetResponse create(RCSResourceAttributes &&attrs); + /** + * Create RCSGetResponse using RCSResourceAttributes value. + * + * @param attrs - RCSResourceAttributes to set + * + * @param result - OCEntityHandlerResult + * + * @param errorCode - error code for response + * + * @return RCSGetResponse - instance of RCSGetResponse + * + * @see RCSResourceAttributes + * + *NOTE : OCEntityHandlerResult is defined in octypes.h. + * RCSResourceAttributes is defined in RCSResourceAttributes.h. + */ + static RCSGetResponse create(RCSResourceAttributes &&attrs, + const OCEntityHandlerResult &result, int errorCode); - /** - * Get the request handler. - * - * @return RequestHandler - RequestHandler pointer. - * - */ + /** + * Get the request handler. + * + * @return RequestHandler - RequestHandler pointer. + * + */ RequestHandler* getHandler() const; private: @@ -152,172 +152,170 @@ namespace OIC class RCSSetResponse { public: - /** - * AcceptanceMethod enum provides values for different acceptance method policy to be - * used in setting response. - */ - enum class AcceptanceMethod + /** + * AcceptanceMethod enum provides values for different acceptance method policy to be + * used in setting response. + */ + enum class AcceptanceMethod { - DEFAULT, - ACCEPT, - IGNORE + DEFAULT, ACCEPT, IGNORE }; - /** - * Create default RCSSetResponse with default response. - * - * @return RCSSetResponse - instance of RCSSetResponse - */ + /** + * Create default RCSSetResponse with default response. + * + * @return RCSSetResponse - instance of RCSSetResponse + */ static RCSSetResponse defaultAction(); - /** - * Internally it invokes the defaultAction() API. - * It sets the AcceptanceMethod as ACCEPT. - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see AcceptanceMethod - */ + /** + * Internally it invokes the defaultAction() API. + * It sets the AcceptanceMethod as ACCEPT. + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see AcceptanceMethod + */ static RCSSetResponse accept(); - /** - * Internally it invokes the create(const OCEntityHandlerResult&, int errorCode) API. - * It sets the AcceptanceMethod as ACCEPT. - * - * @param result - OCEntityHandlerResult value. - * - * @param errorCode - error code for the response - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see AcceptanceMethod - * - *NOTE : OCEntityHandlerResult is defined in octypes.h - */ - static RCSSetResponse accept(const OCEntityHandlerResult &result, int errorCode); + /** + * Internally it invokes the create(const OCEntityHandlerResult&, int errorCode) API. + * It sets the AcceptanceMethod as ACCEPT. + * + * @param result - OCEntityHandlerResult value. + * + * @param errorCode - error code for the response + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see AcceptanceMethod + * + *NOTE : OCEntityHandlerResult is defined in octypes.h + */ + static RCSSetResponse accept(const OCEntityHandlerResult &result, int errorCode); - /** - * Internally it invokes the defaultAction() API. - * It sets the AcceptanceMethod as IGNORE. - * - * @return RCSSetResponse - instance of RCSSetResponse. - * - * @see AcceptanceMethod - */ + /** + * Internally it invokes the defaultAction() API. + * It sets the AcceptanceMethod as IGNORE. + * + * @return RCSSetResponse - instance of RCSSetResponse. + * + * @see AcceptanceMethod + */ static RCSSetResponse ignore(); - /** - * Internaly it invokes the create(const OCEntityHandlerResult&, int errorCode) API. - * It sets the AcceptanceMethod as IGNORE. - * - * @param result - OCEntityHandlerResult value. - * - * @param errorCode - error code for the response. - * - * @return RCSSetResponse - instance of RCSSetResponse. - * - * @see AcceptanceMethod - * - *NOTE : OCEntityHandlerResult is defined in octypes.h - */ - static RCSSetResponse ignore(const OCEntityHandlerResult &result, int errorCode); + /** + * Internaly it invokes the create(const OCEntityHandlerResult&, int errorCode) API. + * It sets the AcceptanceMethod as IGNORE. + * + * @param result - OCEntityHandlerResult value. + * + * @param errorCode - error code for the response. + * + * @return RCSSetResponse - instance of RCSSetResponse. + * + * @see AcceptanceMethod + * + *NOTE : OCEntityHandlerResult is defined in octypes.h + */ + static RCSSetResponse ignore(const OCEntityHandlerResult &result, int errorCode); - /** - * Create RCSSetResponse with OCEntityHandlerResult and errorCode. - * - * @param result - OCEntityHandlerResult value - * - * @param errorCode - error code for the response - * - * @return RCSSetResponse - instance of RCSSetResponse - * - *NOTE : OCEntityHandlerResult is defined in octypes.h - */ - static RCSSetResponse create(const OCEntityHandlerResult &result, int errorCode); + /** + * Create RCSSetResponse with OCEntityHandlerResult and errorCode. + * + * @param result - OCEntityHandlerResult value + * + * @param errorCode - error code for the response + * + * @return RCSSetResponse - instance of RCSSetResponse + * + *NOTE : OCEntityHandlerResult is defined in octypes.h + */ + static RCSSetResponse create(const OCEntityHandlerResult &result, int errorCode); - /** - * Create RCSSetResponse with ResourceAttributes. - * - * @param attrs - ResourceAttributes to set - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see ResourceAttributes - */ - static RCSSetResponse create(const ResourceAttributes &attrs); - /** - * Create RCSSetResponse with ResourceAttributes, OCEntityHandlerResult and errorCode. - * - * @param attrs - ResourceAttributes to set. - * - * @param result - OCEntityHandlerResult value - * - * @param errorCode - error code for the response - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see ResourceAttributes - * - *NOTE : OCEntityHandlerResult is defined in octypes.h. - */ - static RCSSetResponse create(const ResourceAttributes &attrs, - const OCEntityHandlerResult &result, int errorCode); + /** + * Create RCSSetResponse with RCSResourceAttributes. + * + * @param attrs - RCSResourceAttributes to set + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see RCSResourceAttributes + */ + static RCSSetResponse create(const RCSResourceAttributes &attrs); + /** + * Create RCSSetResponse with RCSResourceAttributes, OCEntityHandlerResult and errorCode. + * + * @param attrs - RCSResourceAttributes to set. + * + * @param result - OCEntityHandlerResult value + * + * @param errorCode - error code for the response + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see RCSResourceAttributes + * + *NOTE : OCEntityHandlerResult is defined in octypes.h. + */ + static RCSSetResponse create(const RCSResourceAttributes &attrs, + const OCEntityHandlerResult &result, int errorCode); - /** - * Create RCSSetResponse with ResourceAttributes. - * - * @param attrs - ResourceAttributes value to set - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see ResourceAttributes - */ - static RCSSetResponse create(ResourceAttributes &&attrs); - /** - * Create RCSSetResponse with ResourceAttributes, OCEntityHandlerResult and errorCode. - * - * @param attrs - ResourceAttributes value to set - * - * @param result - OCEntityHandlerResult value - * - * @param errorCode - error code for the response - * - * @return RCSSetResponse - instance of RCSSetResponse - * - * @see ResourceAttributes - * - *NOTE : OCEntityHandlerResult is defined in octypes.h. - */ - static RCSSetResponse create(ResourceAttributes &&attrs, const OCEntityHandlerResult &result, - int errorCode); + /** + * Create RCSSetResponse with RCSResourceAttributes. + * + * @param attrs - RCSResourceAttributes value to set + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see RCSResourceAttributes + */ + static RCSSetResponse create(RCSResourceAttributes &&attrs); + /** + * Create RCSSetResponse with RCSResourceAttributes, OCEntityHandlerResult and errorCode. + * + * @param attrs - RCSResourceAttributes value to set + * + * @param result - OCEntityHandlerResult value + * + * @param errorCode - error code for the response + * + * @return RCSSetResponse - instance of RCSSetResponse + * + * @see RCSResourceAttributes + * + *NOTE : OCEntityHandlerResult is defined in octypes.h. + */ + static RCSSetResponse create(RCSResourceAttributes &&attrs, + const OCEntityHandlerResult &result, int errorCode); - /** - * API to get the set request handler. - * - * @return SetRequestHandler - pointer to SetRequestHandler. - * - */ + /** + * API to get the set request handler. + * + * @return SetRequestHandler - pointer to SetRequestHandler. + * + */ SetRequestHandler* getHandler() const; - /** - * API to get the acceptance method of the RCSSetResponse. - * - * @return AcceptanceMethod - acceptance methods enum value. - * - * @see AcceptanceMethod - * - */ + /** + * API to get the acceptance method of the RCSSetResponse. + * + * @return AcceptanceMethod - acceptance methods enum value. + * + * @see AcceptanceMethod + * + */ AcceptanceMethod getAcceptanceMethod() const; - /** - * API to get the acceptance method of the RCSSetResponse. - * - * @param method - AcceptanceMethod value to set - * - * @return RCSSetResponse - reference to RCSSetResponse - * - * @see AcceptanceMethod - * - */ - RCSSetResponse &setAcceptanceMethod(AcceptanceMethod method); + /** + * API to get the acceptance method of the RCSSetResponse. + * + * @param method - AcceptanceMethod value to set + * + * @return RCSSetResponse - reference to RCSSetResponse + * + * @see AcceptanceMethod + * + */ + RCSSetResponse &setAcceptanceMethod(AcceptanceMethod method); private: RCSSetResponse(std::shared_ptr< SetRequestHandler >&&); diff --git a/service/resource-encapsulation/include/ResourceClient.h b/service/resource-encapsulation/include/ResourceClient.h index 72f7588..ecc505e 100644 --- a/service/resource-encapsulation/include/ResourceClient.h +++ b/service/resource-encapsulation/include/ResourceClient.h @@ -30,7 +30,7 @@ #define RESOURCE_CLIENT_H_ #include -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" namespace OIC { @@ -121,25 +121,25 @@ namespace OIC /** * Typedef for callback of startCaching API * - * @see ResourceAttributes + * @see RCSResourceAttributes */ - typedef std::function< void(const ResourceAttributes &) > CacheUpdatedCallback; + typedef std::function< void(const RCSResourceAttributes &) > CacheUpdatedCallback; /** * Typedef for callback of getRemoteAttributes API * - * @see ResourceAttributes + * @see RCSResourceAttributes */ - typedef std::function< void(const ResourceAttributes &) > + typedef std::function< void(const RCSResourceAttributes &) > RemoteAttributesReceivedCallback; /** * Typedef for callback of setRemoteAttributes API * - * @see ResourceAttributes + * @see RCSResourceAttributes */ - typedef std::function< void(const ResourceAttributes &) > + typedef std::function< void(const RCSResourceAttributes &) > RemoteAttributesSetCallback; /** @@ -276,42 +276,42 @@ namespace OIC void refreshCache() ; /** - * Get the cached ResourceAttributes data. + * Get the cached RCSResourceAttributes data. * * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called. * - * @return ResourceAttributes - cached resourceAttribute + * @return RCSResourceAttributes - cached resourceAttribute * * @throw BadRequestException * * @see startCaching() * @see startCaching(CacheUpdatedCallback) - * @see ResourceAttributes + * @see RCSResourceAttributes * * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called & * directly this API is called it will throw the * BadRequestException. */ - ResourceAttributes getCachedAttributes() const; + RCSResourceAttributes getCachedAttributes() const; /** * Get a particular cached ResourceAttribute value. * * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called. * - * @return ResourceAttributes::Value - requested attribute Value + * @return RCSResourceAttributes::Value - requested attribute Value * * @throw BadRequestException * * @see startCaching() * @see startCaching(CacheUpdatedCallback) - * @see ResourceAttributes::Value + * @see RCSResourceAttributes::Value * * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called & * directly this API is called it will throw the BadRequestException. * */ - ResourceAttributes::Value getCachedAttribute( const std::string &) ; + RCSResourceAttributes::Value getCachedAttribute( const std::string &) ; /** * Get resource attributes. @@ -319,7 +319,7 @@ namespace OIC * @details This API send a get request to the resource of interest and provides the attributes * to the caller in the RemoteAttributesReceivedCallback. * - * @see ResourceAttributes::Value + * @see RCSResourceAttributes::Value */ void getRemoteAttributes(RemoteAttributesReceivedCallback cb); @@ -333,7 +333,7 @@ namespace OIC * @param cb - callback on setting resourceAttributes data. * */ - void setRemoteAttributes(ResourceAttributes &attributes, RemoteAttributesSetCallback cb); + void setRemoteAttributes(const RCSResourceAttributes &attributes, RemoteAttributesSetCallback cb); /** * Get resource uri. diff --git a/service/resource-encapsulation/src/ResourceClient.cpp b/service/resource-encapsulation/src/ResourceClient.cpp index afc3545..9d7f933 100644 --- a/service/resource-encapsulation/src/ResourceClient.cpp +++ b/service/resource-encapsulation/src/ResourceClient.cpp @@ -107,12 +107,12 @@ namespace } OCStackResult cachingCallback(std::shared_ptr resource, - const ResourceAttributes &data, + const RCSResourceAttributes &data, RemoteResourceObject::CacheUpdatedCallback onCacheUpdated) { OC_LOG(DEBUG, CLIENT_W_TAG, "cachingCallback entry"); - onCacheUpdated(data); //passing ResourceAttributes to application + onCacheUpdated(data); //passing RCSResourceAttributes to application OC_LOG(DEBUG, CLIENT_W_TAG, "cachingCallback exit"); return OC_STACK_OK; @@ -123,8 +123,8 @@ namespace { OC_LOG(DEBUG, CLIENT_W_TAG, "setCallback entry"); - const ResourceAttributes &attributes = response.getAttributes(); - onRemoteAttributesSet(attributes); //passing ResourceAttributes to application + const RCSResourceAttributes &attributes = response.getAttributes(); + onRemoteAttributesSet(attributes); //passing RCSResourceAttributes to application OC_LOG(DEBUG, CLIENT_W_TAG, "setCallback exit"); } @@ -134,8 +134,8 @@ namespace { OC_LOG(DEBUG, CLIENT_W_TAG, "getCallback entry"); - const ResourceAttributes &attributes = response.getAttributes(); - onRemoteAttributesReceived(attributes); //passing ResourceAttributes to application + const RCSResourceAttributes &attributes = response.getAttributes(); + onRemoteAttributesReceived(attributes); //passing RCSResourceAttributes to application OC_LOG(DEBUG, CLIENT_W_TAG, "getCallback exit"); } @@ -356,7 +356,7 @@ namespace OIC OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::refreshCache exit"); } - ResourceAttributes RemoteResourceObject:: getCachedAttributes() const + RCSResourceAttributes RemoteResourceObject:: getCachedAttributes() const { OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject :: getCachedAttributes "); try @@ -369,12 +369,12 @@ namespace OIC } } - ResourceAttributes::Value RemoteResourceObject:: getCachedAttribute( const std::string &key) + RCSResourceAttributes::Value RemoteResourceObject:: getCachedAttribute( const std::string &key) { OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject :: getCachedAttribute entry"); try { - ResourceAttributes Cachedattributes = ResourceCacheManager::getInstance()->getCachedData( + RCSResourceAttributes Cachedattributes = ResourceCacheManager::getInstance()->getCachedData( m_primitiveResource); return Cachedattributes[key]; } @@ -415,7 +415,7 @@ namespace OIC OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::getRemoteAttributes exit"); } - void RemoteResourceObject::setRemoteAttributes(ResourceAttributes &attribute, + void RemoteResourceObject::setRemoteAttributes(const RCSResourceAttributes &attribute, RemoteAttributesSetCallback cb) { OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::setRemoteAttributes entry"); diff --git a/service/resource-encapsulation/src/common/SConscript b/service/resource-encapsulation/src/common/SConscript index b03742c..7720213 100644 --- a/service/resource-encapsulation/src/common/SConscript +++ b/service/resource-encapsulation/src/common/SConscript @@ -82,7 +82,7 @@ rcs_common_src = [ RESOURCE_SRC + 'PrimitiveResource.cpp', RESOURCE_SRC + 'RCSException.cpp', RESOURCE_SRC + 'RCSAddress.cpp', - RESOURCE_SRC + 'ResourceAttributes.cpp', + RESOURCE_SRC + 'RCSResourceAttributes.cpp', RESOURCE_SRC + 'ResponseStatement.cpp' ] diff --git a/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResource.h b/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResource.h index 841dc69..ca7f5b7 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResource.h +++ b/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResource.h @@ -38,7 +38,7 @@ namespace OIC typedef OC::HeaderOption::OCHeaderOption HeaderOption; typedef std::vector HeaderOptions; - class ResourceAttributes; + class RCSResourceAttributes; class ResponseStatement; class PrimitiveResource @@ -61,7 +61,7 @@ namespace OIC virtual ~PrimitiveResource() { }; virtual void requestGet(GetCallback) = 0; - virtual void requestSet(const ResourceAttributes&, SetCallback) = 0; + virtual void requestSet(const RCSResourceAttributes&, SetCallback) = 0; virtual void requestObserve(ObserveCallback) = 0; virtual void cancelObserve() = 0; diff --git a/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h b/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h index 743d416..ccf72ca 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h +++ b/service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h @@ -64,7 +64,7 @@ namespace OIC std::bind(createResponseStatement, _2), _3)); } - void requestSet(const ResourceAttributes& attrs, SetCallback callback) + void requestSet(const RCSResourceAttributes& attrs, SetCallback callback) { using namespace std::placeholders; diff --git a/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesConverter.h b/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesConverter.h index 4610730..a5b6033 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesConverter.h +++ b/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesConverter.h @@ -21,7 +21,7 @@ #ifndef COMMON_INTERNAL_RESOURCEATTRIBUTESCONVERTER_H #define COMMON_INTERNAL_RESOURCEATTRIBUTESCONVERTER_H -#include +#include #include @@ -65,32 +65,32 @@ namespace OIC item.getValue< OC::OCRepresentation >())); case OC::AttributeType::Vector: - // ResourceAttributes doesn't support vector yet! + // RCSResourceAttributes doesn't support vector yet! return; } } - ResourceAttributes&& extract() + RCSResourceAttributes&& extract() { return std::move(m_target); } private: template< typename T > - typename std::enable_if::value >::type + typename std::enable_if::value >::type putValue(const std::string& key, T && value) { m_target[key] = std::forward< T >(value); } template< typename T > - typename std::enable_if::value >::type + typename std::enable_if::value >::type putValue(const std::string& key, T && value) { } private: - ResourceAttributes m_target; + RCSResourceAttributes m_target; }; class OCRepresentationBuilder @@ -109,7 +109,7 @@ namespace OIC m_target.setNULL(key); } - void operator()(const std::string& key, const ResourceAttributes& value) + void operator()(const std::string& key, const RCSResourceAttributes& value) { m_target[key] = ResourceAttributesConverter::toOCRepresentation(value); } @@ -124,7 +124,7 @@ namespace OIC }; public: - static ResourceAttributes fromOCRepresentation( + static RCSResourceAttributes fromOCRepresentation( const OC::OCRepresentation& ocRepresentation) { ResourceAttributesBuilder builder; @@ -138,7 +138,7 @@ namespace OIC } static OC::OCRepresentation toOCRepresentation( - const ResourceAttributes& resourceAttributes) + const RCSResourceAttributes& resourceAttributes) { OCRepresentationBuilder builder; diff --git a/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesUtils.h b/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesUtils.h index 7768df8..f83b003 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesUtils.h +++ b/service/resource-encapsulation/src/common/primitiveResource/include/ResourceAttributesUtils.h @@ -24,22 +24,22 @@ #include #include -#include +#include namespace OIC { namespace Service { - typedef std::pair< std::string, ResourceAttributes::Value > AttrKeyValuePair; + typedef std::pair< std::string, RCSResourceAttributes::Value > AttrKeyValuePair; typedef std::vector< AttrKeyValuePair > AttrKeyValuePairs; - bool acceptableAttributes(const ResourceAttributes& dest, const ResourceAttributes& attr); + bool acceptableAttributes(const RCSResourceAttributes& dest, const RCSResourceAttributes& attr); - bool acceptableAttributeValue(const ResourceAttributes::Value& dest, - const ResourceAttributes::Value& value); + bool acceptableAttributeValue(const RCSResourceAttributes::Value& dest, + const RCSResourceAttributes::Value& value); - AttrKeyValuePairs replaceAttributes(ResourceAttributes& dest, - const ResourceAttributes& attrs); + AttrKeyValuePairs replaceAttributes(RCSResourceAttributes& dest, + const RCSResourceAttributes& attrs); } } diff --git a/service/resource-encapsulation/src/common/primitiveResource/include/ResponseStatement.h b/service/resource-encapsulation/src/common/primitiveResource/include/ResponseStatement.h index e19f9a3..7181e75 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/include/ResponseStatement.h +++ b/service/resource-encapsulation/src/common/primitiveResource/include/ResponseStatement.h @@ -24,7 +24,7 @@ #include #include -#include +#include namespace OC { @@ -35,18 +35,18 @@ namespace OIC { namespace Service { - class ResourceAttributes; + class RCSResourceAttributes; class ResponseStatement { public: static ResponseStatement create(const OC::OCRepresentation&); - static ResponseStatement create(ResourceAttributes&&); + static ResponseStatement create(RCSResourceAttributes&&); - explicit ResponseStatement(const ResourceAttributes&); - explicit ResponseStatement(ResourceAttributes&&); + explicit ResponseStatement(const RCSResourceAttributes&); + explicit ResponseStatement(RCSResourceAttributes&&); - ResponseStatement(ResourceAttributes&&, std::string&& uri, + ResponseStatement(RCSResourceAttributes&&, std::string&& uri, std::vector< std::string >&& resourceTypes, std::vector< std::string >&& resourceInterfaces); @@ -58,10 +58,10 @@ namespace OIC std::vector< std::string > getResourceTypes() const; std::vector< std::string > getResourceInterfaces() const; - const ResourceAttributes& getAttributes() const; + const RCSResourceAttributes& getAttributes() const; private: - ResourceAttributes m_attrs; + RCSResourceAttributes m_attrs; std::string m_uri; std::vector< std::string > m_resourceTypes; diff --git a/service/resource-encapsulation/src/common/primitiveResource/src/ResourceAttributes.cpp b/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp similarity index 60% rename from service/resource-encapsulation/src/common/primitiveResource/src/ResourceAttributes.cpp rename to service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp index 4b6250d..072087c 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/src/ResourceAttributes.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp @@ -18,7 +18,7 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include +#include #include #include @@ -64,13 +64,13 @@ namespace return value; } - std::string operator()(const OIC::Service::ResourceAttributes&) const + std::string operator()(const OIC::Service::RCSResourceAttributes&) const { return "Attributes"; } }; - class TypeVisitor: public boost::static_visitor< ResourceAttributes::Type > + class TypeVisitor: public boost::static_visitor< RCSResourceAttributes::Type > { public: TypeVisitor() = default; @@ -81,9 +81,9 @@ namespace TypeVisitor& operator=(TypeVisitor&&) = delete; template< typename T > - ResourceAttributes::Type operator()(const T& value) const + RCSResourceAttributes::Type operator()(const T& value) const { - return ResourceAttributes::Type::typeOf(value); + return RCSResourceAttributes::Type::typeOf(value); } }; @@ -97,42 +97,42 @@ namespace template< > struct TypeInfoConverter< int > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::INT; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::INT; }; template< > struct TypeInfoConverter< std::nullptr_t > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::NULL_T; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::NULL_T; }; template< > struct TypeInfoConverter< double > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::DOUBLE; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::DOUBLE; }; template< > struct TypeInfoConverter< bool > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::BOOL; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::BOOL; }; template< > struct TypeInfoConverter< std::string > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::STRING; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::STRING; }; template< > - struct TypeInfoConverter< ResourceAttributes > + struct TypeInfoConverter< RCSResourceAttributes > { - static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::ATTRIBUTES; + static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::ATTRIBUTES; }; struct TypeInfo { - ResourceAttributes::TypeId typeId; + RCSResourceAttributes::TypeId typeId; template< typename TRAIT > constexpr TypeInfo(TRAIT) : @@ -185,309 +185,309 @@ namespace OIC namespace Service { - ResourceAttributes::Value::ComparisonHelper::ComparisonHelper(const Value& v) : + RCSResourceAttributes::Value::ComparisonHelper::ComparisonHelper(const Value& v) : m_valueRef(v) { } - bool ResourceAttributes::Value::ComparisonHelper::operator== + bool RCSResourceAttributes::Value::ComparisonHelper::operator== (const Value::ComparisonHelper& rhs) const { return *m_valueRef.m_data == *rhs.m_valueRef.m_data; } - bool operator==(const ResourceAttributes::Type& lhs, const ResourceAttributes::Type& rhs) + bool operator==(const RCSResourceAttributes::Type& lhs, const RCSResourceAttributes::Type& rhs) { return lhs.m_which == rhs.m_which; } - bool operator!=(const ResourceAttributes::Type& lhs, const ResourceAttributes::Type& rhs) + bool operator!=(const RCSResourceAttributes::Type& lhs, const RCSResourceAttributes::Type& rhs) { return !(lhs == rhs); } - bool operator==(const ResourceAttributes::Value::ComparisonHelper& lhs, - const ResourceAttributes::Value::ComparisonHelper& rhs) + bool operator==(const RCSResourceAttributes::Value::ComparisonHelper& lhs, + const RCSResourceAttributes::Value::ComparisonHelper& rhs) { return lhs.operator==(rhs); } - bool operator!=(const ResourceAttributes::Value::ComparisonHelper& lhs, - const ResourceAttributes::Value::ComparisonHelper& rhs) + bool operator!=(const RCSResourceAttributes::Value::ComparisonHelper& lhs, + const RCSResourceAttributes::Value::ComparisonHelper& rhs) { return !lhs.operator==(rhs); } - bool operator==(const ResourceAttributes& lhs, const ResourceAttributes& rhs) + bool operator==(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs) { return lhs.m_values == rhs.m_values; } - bool operator!=(const ResourceAttributes& lhs, const ResourceAttributes& rhs) + bool operator!=(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs) { return !(lhs == rhs); } - auto ResourceAttributes::Type::getId() const -> TypeId + auto RCSResourceAttributes::Type::getId() const -> TypeId { return ::getTypeInfo< ValueVariant >(m_which).typeId; } - ResourceAttributes::Value::Value() : + RCSResourceAttributes::Value::Value() : m_data{ new ValueVariant{} } { } - ResourceAttributes::Value::Value(const Value& from) : + RCSResourceAttributes::Value::Value(const Value& from) : m_data{ new ValueVariant{ *from.m_data } } { } - ResourceAttributes::Value::Value(Value&& from) : + RCSResourceAttributes::Value::Value(Value&& from) : m_data{ new ValueVariant{} } { m_data->swap(*from.m_data); } - ResourceAttributes::Value::Value(const char* value) : + RCSResourceAttributes::Value::Value(const char* value) : m_data{ new ValueVariant{ std::string{ value } } } { } - auto ResourceAttributes::Value::operator=(const Value& rhs) -> Value& + auto RCSResourceAttributes::Value::operator=(const Value& rhs) -> Value& { *m_data = *rhs.m_data; return *this; } - auto ResourceAttributes::Value::operator=(Value&& rhs) -> Value& + auto RCSResourceAttributes::Value::operator=(Value&& rhs) -> Value& { *m_data = ValueVariant{}; m_data->swap(*rhs.m_data); return *this; } - auto ResourceAttributes::Value::operator=(const char* rhs) -> Value& + auto RCSResourceAttributes::Value::operator=(const char* rhs) -> Value& { *m_data = std::string{ rhs }; return *this; } - auto ResourceAttributes::Value::operator=(std::nullptr_t) -> Value& + auto RCSResourceAttributes::Value::operator=(std::nullptr_t) -> Value& { *m_data = nullptr; return *this; } - auto ResourceAttributes::Value::getType() const -> Type + auto RCSResourceAttributes::Value::getType() const -> Type { return boost::apply_visitor(TypeVisitor(), *m_data); } - std::string ResourceAttributes::Value::toString() const + std::string RCSResourceAttributes::Value::toString() const { return boost::apply_visitor(ToStringVisitor(), *m_data); } - void ResourceAttributes::Value::swap(Value& rhs) + void RCSResourceAttributes::Value::swap(Value& rhs) { m_data.swap(rhs.m_data); } - auto ResourceAttributes::KeyValuePair::KeyVisitor::operator() (iterator* iter) const + auto RCSResourceAttributes::KeyValuePair::KeyVisitor::operator() (iterator* iter) const -> result_type { return iter->m_cur->first; } - auto ResourceAttributes::KeyValuePair::KeyVisitor::operator() (const_iterator* iter) const + auto RCSResourceAttributes::KeyValuePair::KeyVisitor::operator() (const_iterator* iter) const -> result_type { return iter->m_cur->first; } - auto ResourceAttributes::KeyValuePair::ValueVisitor::operator() (iterator* iter) + auto RCSResourceAttributes::KeyValuePair::ValueVisitor::operator() (iterator* iter) -> result_type { return iter->m_cur->second; } - auto ResourceAttributes::KeyValuePair::ValueVisitor::operator() (const_iterator* iter) + auto RCSResourceAttributes::KeyValuePair::ValueVisitor::operator() (const_iterator* iter) -> result_type { // should not reach here. throw BadGetException(""); } - auto ResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (iterator*iter) const + auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (iterator*iter) const -> result_type { return iter->m_cur->second; } - auto ResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (const_iterator* iter) + auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (const_iterator* iter) const -> result_type { return iter->m_cur->second; } - auto ResourceAttributes::KeyValuePair::key() const -> const std::string& + auto RCSResourceAttributes::KeyValuePair::key() const -> const std::string& { return boost::apply_visitor(m_keyVisitor, m_iterRef); } - auto ResourceAttributes::KeyValuePair::value() const -> const Value& + auto RCSResourceAttributes::KeyValuePair::value() const -> const Value& { return boost::apply_visitor(m_constValueVisitor, m_iterRef); } - auto ResourceAttributes::KeyValuePair::value() -> Value& + auto RCSResourceAttributes::KeyValuePair::value() -> Value& { return boost::apply_visitor(m_valueVisitor, m_iterRef); } - ResourceAttributes::KeyValuePair::KeyValuePair(boost::variant&& ref) : m_iterRef{ ref } { } - ResourceAttributes::iterator::iterator() : + RCSResourceAttributes::iterator::iterator() : m_cur{ base_iterator{ } }, m_keyValuePair{ this } { } - ResourceAttributes::iterator::iterator(base_iterator&& iter) : + RCSResourceAttributes::iterator::iterator(base_iterator&& iter) : m_cur{ std::move(iter) }, m_keyValuePair{ this } { } - auto ResourceAttributes::iterator::operator*() -> KeyValuePair& + auto RCSResourceAttributes::iterator::operator*() -> KeyValuePair& { return m_keyValuePair; } - auto ResourceAttributes::iterator::iterator::operator->() -> KeyValuePair* + auto RCSResourceAttributes::iterator::iterator::operator->() -> KeyValuePair* { return &m_keyValuePair; } - auto ResourceAttributes::iterator::operator++() -> iterator& + auto RCSResourceAttributes::iterator::operator++() -> iterator& { ++m_cur; return *this; } - auto ResourceAttributes::iterator::operator++(int) -> iterator + auto RCSResourceAttributes::iterator::operator++(int) -> iterator { iterator iter(*this); ++(*this); return iter; } - bool ResourceAttributes::iterator::operator==(const iterator& rhs) const + bool RCSResourceAttributes::iterator::operator==(const iterator& rhs) const { return m_cur == rhs.m_cur; } - bool ResourceAttributes::iterator::operator!=(const iterator& rhs) const + bool RCSResourceAttributes::iterator::operator!=(const iterator& rhs) const { return !(*this == rhs); } - ResourceAttributes::const_iterator::const_iterator() : + RCSResourceAttributes::const_iterator::const_iterator() : m_cur{ base_iterator{} }, m_keyValuePair{ this } { } - ResourceAttributes::const_iterator::const_iterator(base_iterator&& iter) : + RCSResourceAttributes::const_iterator::const_iterator(base_iterator&& iter) : m_cur{ iter }, m_keyValuePair{ this } { } - ResourceAttributes::const_iterator::const_iterator( - const ResourceAttributes::iterator& iter) : + RCSResourceAttributes::const_iterator::const_iterator( + const RCSResourceAttributes::iterator& iter) : m_cur{ iter.m_cur }, m_keyValuePair{ this } { } - auto ResourceAttributes::const_iterator::operator=(const ResourceAttributes::iterator& iter) + auto RCSResourceAttributes::const_iterator::operator=(const RCSResourceAttributes::iterator& iter) -> const_iterator& { m_cur = iter.m_cur; return *this; } - auto ResourceAttributes::const_iterator::operator*() const -> reference + auto RCSResourceAttributes::const_iterator::operator*() const -> reference { return m_keyValuePair; } - auto ResourceAttributes::const_iterator::operator->() const -> pointer + auto RCSResourceAttributes::const_iterator::operator->() const -> pointer { return &m_keyValuePair; } - auto ResourceAttributes::const_iterator::operator++() -> const_iterator& + auto RCSResourceAttributes::const_iterator::operator++() -> const_iterator& { ++m_cur; return *this; } - auto ResourceAttributes::const_iterator::operator++(int) -> const_iterator + auto RCSResourceAttributes::const_iterator::operator++(int) -> const_iterator { const_iterator iter(*this); ++(*this); return iter; } - bool ResourceAttributes::const_iterator::operator==(const const_iterator& rhs) const + bool RCSResourceAttributes::const_iterator::operator==(const const_iterator& rhs) const { return m_cur == rhs.m_cur; } - bool ResourceAttributes::const_iterator::operator!=(const const_iterator& rhs) const + bool RCSResourceAttributes::const_iterator::operator!=(const const_iterator& rhs) const { return !(*this == rhs); } - auto ResourceAttributes::begin() -> iterator + auto RCSResourceAttributes::begin() -> iterator { return iterator{ m_values.begin() }; } - auto ResourceAttributes::end() -> iterator + auto RCSResourceAttributes::end() -> iterator { return iterator{ m_values.end() }; } - auto ResourceAttributes::begin() const -> const_iterator + auto RCSResourceAttributes::begin() const -> const_iterator { return const_iterator{ m_values.begin() }; } - auto ResourceAttributes::end() const -> const_iterator + auto RCSResourceAttributes::end() const -> const_iterator { return const_iterator{ m_values.end() }; } - auto ResourceAttributes::cbegin() const -> const_iterator + auto RCSResourceAttributes::cbegin() const -> const_iterator { return const_iterator{ m_values.begin() }; } - auto ResourceAttributes::cend() const -> const_iterator + auto RCSResourceAttributes::cend() const -> const_iterator { return const_iterator{ m_values.end() }; } - auto ResourceAttributes::operator[](const std::string& key) -> Value& + auto RCSResourceAttributes::operator[](const std::string& key) -> Value& { return m_values[key]; } - auto ResourceAttributes::operator[](std::string&& key) -> Value& + auto RCSResourceAttributes::operator[](std::string&& key) -> Value& { return m_values[std::move(key)]; } - auto ResourceAttributes::at(const std::string& key) -> Value& + auto RCSResourceAttributes::at(const std::string& key) -> Value& { try { @@ -499,7 +499,7 @@ namespace OIC } } - auto ResourceAttributes::at(const std::string& key) const -> const Value& + auto RCSResourceAttributes::at(const std::string& key) const -> const Value& { try { @@ -511,45 +511,45 @@ namespace OIC } } - void ResourceAttributes::clear() + void RCSResourceAttributes::clear() { return m_values.clear(); } - bool ResourceAttributes::erase(const std::string& key) + bool RCSResourceAttributes::erase(const std::string& key) { return m_values.erase(key) == 1U; } - bool ResourceAttributes::contains(const std::string& key) const + bool RCSResourceAttributes::contains(const std::string& key) const { return m_values.find(key) != m_values.end(); } - bool ResourceAttributes::empty() const + bool RCSResourceAttributes::empty() const { return m_values.empty(); } - size_t ResourceAttributes::size() const + size_t RCSResourceAttributes::size() const { return m_values.size(); } - bool acceptableAttributeValue(const ResourceAttributes::Value& dest, - const ResourceAttributes::Value& value) + bool acceptableAttributeValue(const RCSResourceAttributes::Value& dest, + const RCSResourceAttributes::Value& value) { if (dest.getType() != value.getType()) { return false; } - static_assert(ResourceAttributes::is_supported_type< ResourceAttributes >::value, - "ResourceAttributes doesn't have ResourceAttributes recursively."); - if (dest.getType().getId() == ResourceAttributes::TypeId::ATTRIBUTES - && !acceptableAttributes(dest.get< ResourceAttributes >(), - value.get< ResourceAttributes >())) + static_assert(RCSResourceAttributes::is_supported_type< RCSResourceAttributes >::value, + "RCSResourceAttributes doesn't have RCSResourceAttributes recursively."); + if (dest.getType().getId() == RCSResourceAttributes::TypeId::ATTRIBUTES + && !acceptableAttributes(dest.get< RCSResourceAttributes >(), + value.get< RCSResourceAttributes >())) { return false; } @@ -557,7 +557,7 @@ namespace OIC return true; } - bool acceptableAttributes(const ResourceAttributes& dest, const ResourceAttributes& attr) + bool acceptableAttributes(const RCSResourceAttributes& dest, const RCSResourceAttributes& attr) { for (const auto& kv : attr) { @@ -575,8 +575,8 @@ namespace OIC return true; } - AttrKeyValuePairs replaceAttributes(ResourceAttributes& dest, - const ResourceAttributes& newAttrs) + AttrKeyValuePairs replaceAttributes(RCSResourceAttributes& dest, + const RCSResourceAttributes& newAttrs) { AttrKeyValuePairs replacedList; @@ -584,7 +584,7 @@ namespace OIC { if (dest[kv.key()] != kv.value()) { - ResourceAttributes::Value replacedValue; + RCSResourceAttributes::Value replacedValue; replacedValue.swap(dest[kv.key()]); dest[kv.key()] = kv.value(); diff --git a/service/resource-encapsulation/src/common/primitiveResource/src/ResponseStatement.cpp b/service/resource-encapsulation/src/common/primitiveResource/src/ResponseStatement.cpp index 18b058f..444547a 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/src/ResponseStatement.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/src/ResponseStatement.cpp @@ -32,22 +32,22 @@ namespace OIC ResourceAttributesConverter::fromOCRepresentation(ocRepresentation)); } - ResponseStatement ResponseStatement::create(ResourceAttributes&& attrs) + ResponseStatement ResponseStatement::create(RCSResourceAttributes&& attrs) { return ResponseStatement(std::move(attrs)); } - ResponseStatement::ResponseStatement(const ResourceAttributes& attrs) : + ResponseStatement::ResponseStatement(const RCSResourceAttributes& attrs) : m_attrs{ attrs } { } - ResponseStatement::ResponseStatement(ResourceAttributes&& attrs) : + ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs) : m_attrs{ std::move(attrs) } { } - ResponseStatement::ResponseStatement(ResourceAttributes&& attrs, std::string&& uri, + ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs, std::string&& uri, std::vector< std::string >&& resourceTypes, std::vector< std::string >&& resourceInterfaces) : m_attrs{ std::move(attrs) }, @@ -72,7 +72,7 @@ namespace OIC return m_resourceInterfaces; } - const ResourceAttributes& ResponseStatement::getAttributes() const + const RCSResourceAttributes& ResponseStatement::getAttributes() const { return m_attrs; } diff --git a/service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp b/service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp index 825585f..8f15ad5 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp @@ -89,14 +89,14 @@ TEST_F(PrimitiveResourceTest, RequestSetInvokesOCResourcePut) { mocks.ExpectCall(fakeResource, FakeOCResource::put).Return(OC_STACK_OK); - resource->requestSet(ResourceAttributes(), PrimitiveResource::SetCallback()); + resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback()); } TEST_F(PrimitiveResourceTest, RequestSetThrowsOCResourcePutReturnsNotOK) { mocks.OnCall(fakeResource, FakeOCResource::put).Return(OC_STACK_ERROR); - ASSERT_THROW(resource->requestSet(ResourceAttributes(), PrimitiveResource::SetCallback()), + ASSERT_THROW(resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback()), PlatformException); } @@ -104,7 +104,7 @@ TEST_F(PrimitiveResourceTest, RequestSetPassResourceAttributesToOCResourcePut) { constexpr int value{ -200 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; mocks.ExpectCall(fakeResource, FakeOCResource::put).Match( [](const OC::OCRepresentation& ocRep, const OC::QueryParamsMap&, OC::PutCallback) diff --git a/service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp b/service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp index 3fcd364..efb7250 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp @@ -18,7 +18,7 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include +#include #include #include @@ -32,7 +32,7 @@ constexpr char KEY[]{ "key" }; class ResourceAttributesTest: public Test { public: - ResourceAttributes resourceAttributes; + RCSResourceAttributes resourceAttributes; }; TEST_F(ResourceAttributesTest, InitialSizeIsZero) @@ -66,7 +66,7 @@ TEST_F(ResourceAttributesTest, CopyingValueDoesNotShareState) const char arbitraryStr[] { "ftryb457" }; resourceAttributes[KEY] = 1; - ResourceAttributes::Value copied { resourceAttributes[KEY] }; + RCSResourceAttributes::Value copied { resourceAttributes[KEY] }; copied = arbitraryStr; ASSERT_TRUE(resourceAttributes[KEY] == 1); @@ -92,7 +92,7 @@ TEST_F(ResourceAttributesTest, ObjectIsEmptyAfterMoved) { resourceAttributes[KEY] = 1; - ResourceAttributes moved{ std::move(resourceAttributes) }; + RCSResourceAttributes moved{ std::move(resourceAttributes) }; ASSERT_TRUE(resourceAttributes.empty()); } @@ -122,11 +122,11 @@ TEST_F(ResourceAttributesTest, ChangeValueWithAtGetter) TEST_F(ResourceAttributesTest, CanHaveNestedResourceAttributes) { - ResourceAttributes nested; + RCSResourceAttributes nested; nested["nested"] = "nested_value"; resourceAttributes[KEY] = nested; - ASSERT_TRUE("nested_value" == resourceAttributes[KEY].get()["nested"]); + ASSERT_TRUE("nested_value" == resourceAttributes[KEY].get()["nested"]); } TEST_F(ResourceAttributesTest, ToStringReturnsStringForValue) @@ -147,7 +147,7 @@ TEST_F(ResourceAttributesTest, ToStringReturnsEmptyStringForNullValue) class ResourceAttributesIteratorTest: public Test { public: - ResourceAttributes resourceAttributes; + RCSResourceAttributes resourceAttributes; }; TEST_F(ResourceAttributesIteratorTest, BeginEqualsEndWhenEmpty) @@ -184,7 +184,7 @@ TEST_F(ResourceAttributesIteratorTest, IteratesWithRef) TEST_F(ResourceAttributesIteratorTest, IteratorIsCopyable) { - ResourceAttributes::iterator it; + RCSResourceAttributes::iterator it; it = resourceAttributes.begin(); @@ -195,7 +195,7 @@ TEST_F(ResourceAttributesIteratorTest, IteratorIndicateNextItemAfterIncreased) { resourceAttributes[KEY] = 1; - ResourceAttributes::iterator it = resourceAttributes.begin(); + RCSResourceAttributes::iterator it = resourceAttributes.begin(); it++; @@ -205,7 +205,7 @@ TEST_F(ResourceAttributesIteratorTest, IteratorIndicateNextItemAfterIncreased) TEST_F(ResourceAttributesIteratorTest, IteratorCanBeConvertedIntoConstIterator) { resourceAttributes[KEY] = 1; - ResourceAttributes::const_iterator it { resourceAttributes.begin() }; + RCSResourceAttributes::const_iterator it { resourceAttributes.begin() }; it = resourceAttributes.cbegin(); it++; @@ -216,26 +216,26 @@ TEST_F(ResourceAttributesIteratorTest, IteratorCanBeConvertedIntoConstIterator) TEST_F(ResourceAttributesIteratorTest, ConstIteratorIsUsedForConst) { resourceAttributes[KEY] = 1; - const ResourceAttributes& constAttrs = resourceAttributes; + const RCSResourceAttributes& constAttrs = resourceAttributes; auto iter = constAttrs.begin(); - ASSERT_TRUE((std::is_same::value)); + ASSERT_TRUE((std::is_same::value)); } TEST(ResourceAttributesValueTest, MovedValueHasNull) { - ResourceAttributes::Value one { 1 }; - ResourceAttributes::Value another { std::move(one) }; + RCSResourceAttributes::Value one { 1 }; + RCSResourceAttributes::Value another { std::move(one) }; ASSERT_EQ(nullptr, one); } TEST(ResourceAttributesValueTest, MovedValueWithAssignmentHasNull) { - ResourceAttributes::Value one { 1 }; - ResourceAttributes::Value another; + RCSResourceAttributes::Value one { 1 }; + RCSResourceAttributes::Value another; another = std::move(one); @@ -244,16 +244,16 @@ TEST(ResourceAttributesValueTest, MovedValueWithAssignmentHasNull) TEST(ResourceAttributesValueTest, SameValuesAreEqual) { - ResourceAttributes::Value one { 1 }; - ResourceAttributes::Value another { 1 }; + RCSResourceAttributes::Value one { 1 }; + RCSResourceAttributes::Value another { 1 }; ASSERT_EQ(one, another); } TEST(ResourceAttributesValueTest, DifferentValuesAreNotEqual) { - ResourceAttributes::Value one { 1 }; - ResourceAttributes::Value another { 2 }; + RCSResourceAttributes::Value one { 1 }; + RCSResourceAttributes::Value another { 2 }; ASSERT_NE(one, another); } @@ -263,8 +263,8 @@ TEST(ResourceAttributesValueTest, ValuesCanBeSwapped) constexpr int i { 1 }; constexpr char str[]{ "abc" }; - ResourceAttributes::Value intValue { i }; - ResourceAttributes::Value strValue { str }; + RCSResourceAttributes::Value intValue { i }; + RCSResourceAttributes::Value strValue { str }; intValue.swap(strValue); @@ -274,16 +274,16 @@ TEST(ResourceAttributesValueTest, ValuesCanBeSwapped) TEST(ResourceAttributesTypeTest, TypeIdMatchesTypeOfValue) { - ResourceAttributes::Value intValue { 1 }; + RCSResourceAttributes::Value intValue { 1 }; - ASSERT_EQ(intValue.getType().getId(), ResourceAttributes::TypeId::INT); + ASSERT_EQ(intValue.getType().getId(), RCSResourceAttributes::TypeId::INT); } TEST(ResourceAttributesTypeTest, TypeCanBeConstructedFromValue) { - ResourceAttributes::Value intValue { 1 }; + RCSResourceAttributes::Value intValue { 1 }; - ResourceAttributes::Type t = ResourceAttributes::Type::typeOf(0); + RCSResourceAttributes::Type t = RCSResourceAttributes::Type::typeOf(0); ASSERT_EQ(intValue.getType(), t); } @@ -294,7 +294,8 @@ TEST(ResourceAttributesConverterTest, OCRepresentationCanBeConvertedIntoResource OC::OCRepresentation ocRep; ocRep[KEY] = value; - ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep); + RCSResourceAttributes resourceAttributes{ + ResourceAttributesConverter::fromOCRepresentation(ocRep) }; ASSERT_TRUE(value == resourceAttributes[KEY]); } @@ -308,19 +309,21 @@ TEST(ResourceAttributesConverterTest, NestedOCRepresentationCanBeConvertedIntoRe nested[KEY] = nested_value; ocRep[KEY] = nested; - ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep); + RCSResourceAttributes resourceAttributes{ + ResourceAttributesConverter::fromOCRepresentation(ocRep) }; - ASSERT_TRUE(nested_value == resourceAttributes[KEY].get()[KEY]); + ASSERT_TRUE(nested_value == resourceAttributes[KEY].get()[KEY]); } TEST(ResourceAttributesConverterTest, ResourceAttributesCanBeConvertedIntoOCRepresentation) { double value { 3453453 }; - ResourceAttributes resourceAttributes; + RCSResourceAttributes resourceAttributes; resourceAttributes[KEY] = value; - OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes); + OC::OCRepresentation ocRep{ + ResourceAttributesConverter::toOCRepresentation(resourceAttributes) }; ASSERT_TRUE(value == ocRep[KEY].getValue()); } @@ -328,14 +331,16 @@ TEST(ResourceAttributesConverterTest, ResourceAttributesCanBeConvertedIntoOCRepr TEST(ResourceAttributesConverterTest, NestedResourceAttributesCanBeConvertedIntoOCRepresentation) { std::string nested_value { "nested" }; - ResourceAttributes resourceAttributes; - ResourceAttributes nested; + RCSResourceAttributes resourceAttributes; + RCSResourceAttributes nested; nested[KEY] = nested_value; resourceAttributes[KEY] = nested; - OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes); + OC::OCRepresentation ocRep{ + ResourceAttributesConverter::toOCRepresentation(resourceAttributes) }; - ASSERT_TRUE(nested_value == ocRep[KEY].getValue()[KEY].getValue()); + ASSERT_EQ(nested_value, + ocRep[KEY].getValue()[KEY].getValue()); } TEST(ResourceAttributesConverterTest, OCRepresentationNullTypeIsNullptrInResourceAttributes) @@ -343,17 +348,19 @@ TEST(ResourceAttributesConverterTest, OCRepresentationNullTypeIsNullptrInResourc OC::OCRepresentation ocRep; ocRep.setNULL(KEY); - ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep); + RCSResourceAttributes resourceAttributes{ + ResourceAttributesConverter::fromOCRepresentation(ocRep) }; ASSERT_EQ(nullptr, resourceAttributes[KEY]); } TEST(ResourceAttributesConverterTest, OCRepresentationHasNullWhenResourceAttributeIsNullptr) { - ResourceAttributes resourceAttributes; + RCSResourceAttributes resourceAttributes; resourceAttributes[KEY] = nullptr; - OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes); + OC::OCRepresentation ocRep{ + ResourceAttributesConverter::toOCRepresentation(resourceAttributes) }; ASSERT_TRUE(ocRep.isNULL(KEY)); } @@ -363,7 +370,7 @@ TEST(ResourceAttributesConverterTest, OCRepresentationHasNullWhenResourceAttribu class ResourceAttributesUtilTest: public Test { public: - ResourceAttributes resourceAttributes; + RCSResourceAttributes resourceAttributes; protected: void SetUp() @@ -374,7 +381,7 @@ protected: TEST_F(ResourceAttributesUtilTest, EmptyAttributesIsAcceptable) { - ASSERT_TRUE(acceptableAttributes(resourceAttributes, ResourceAttributes())); + ASSERT_TRUE(acceptableAttributes(resourceAttributes, RCSResourceAttributes())); } TEST_F(ResourceAttributesUtilTest, AttributesItselfIsAcceptable) @@ -384,7 +391,7 @@ TEST_F(ResourceAttributesUtilTest, AttributesItselfIsAcceptable) TEST_F(ResourceAttributesUtilTest, UnknownKeyIsNotAcceptable) { - ResourceAttributes newAttrs; + RCSResourceAttributes newAttrs; newAttrs["unknown"] = 1; ASSERT_FALSE(acceptableAttributes(resourceAttributes, newAttrs)); @@ -392,7 +399,7 @@ TEST_F(ResourceAttributesUtilTest, UnknownKeyIsNotAcceptable) TEST_F(ResourceAttributesUtilTest, DifferentTypeWithOriginalIsNotAcceptable) { - ResourceAttributes newAttrs; + RCSResourceAttributes newAttrs; newAttrs[KEY] = ""; ASSERT_FALSE(acceptableAttributes(resourceAttributes, newAttrs)); @@ -404,12 +411,12 @@ TEST_F(ResourceAttributesUtilTest, DifferentTypeOfNestedAttributeIsNotAcceptable constexpr char KEY_NESTED_ATTR[]{ "nested" }; constexpr char KEY_NESTED_VALUE[]{ "nested_value" }; - ResourceAttributes nested; + RCSResourceAttributes nested; nested[KEY_NESTED_VALUE] = -99; resourceAttributes[KEY_NESTED_ATTR] = nested; - ResourceAttributes newAttrs; + RCSResourceAttributes newAttrs; nested[KEY_NESTED_VALUE] = "abc"; newAttrs[KEY_NESTED_ATTR] = nested; @@ -420,7 +427,7 @@ TEST_F(ResourceAttributesUtilTest, ReplaceWillOverwriteOriginal) { constexpr char NEW_VALUE[]{ "newValue" }; - ResourceAttributes newAttrs; + RCSResourceAttributes newAttrs; newAttrs[KEY] = NEW_VALUE; replaceAttributes(resourceAttributes, newAttrs); diff --git a/service/resource-encapsulation/src/resourceBroker/unittest/ResourcePresenceUnitTest.cpp b/service/resource-encapsulation/src/resourceBroker/unittest/ResourcePresenceUnitTest.cpp index da7ff8b..19e6c79 100644 --- a/service/resource-encapsulation/src/resourceBroker/unittest/ResourcePresenceUnitTest.cpp +++ b/service/resource-encapsulation/src/resourceBroker/unittest/ResourcePresenceUnitTest.cpp @@ -11,7 +11,7 @@ #include "PrimitiveResource.h" #include "ResponseStatement.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" #include "ResourcePresence.h" #include "UnitTestHelper.h" @@ -183,7 +183,7 @@ TEST_F(ResourcePresenceTest,getCB_NormalHandlingIfMessageOC_STACK_OK) [](GetCallback callback){ OIC::Service::HeaderOptions op; - ResourceAttributes attr; + RCSResourceAttributes attr; OIC::Service::ResponseStatement res(attr); callback(op,res,OC_STACK_OK); diff --git a/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h b/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h index f267b71..815143a 100644 --- a/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h +++ b/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h @@ -29,7 +29,7 @@ #include "logger.h" #include "PrimitiveResource.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" namespace OIC { @@ -70,7 +70,7 @@ namespace OIC typedef int CacheID; typedef std::function, - const ResourceAttributes &)> CacheCB; + const RCSResourceAttributes &)> CacheCB; typedef std::map> SubscriberInfo; typedef std::pair> SubscriberInfoPair; diff --git a/service/resource-encapsulation/src/resourceCache/include/DataCache.h b/service/resource-encapsulation/src/resourceCache/include/DataCache.h index 873d458..5f16c92 100644 --- a/service/resource-encapsulation/src/resourceCache/include/DataCache.h +++ b/service/resource-encapsulation/src/resourceCache/include/DataCache.h @@ -48,7 +48,7 @@ namespace OIC CacheID deleteSubscriber(CacheID id); CACHE_STATE getCacheState() const; - const ResourceAttributes getCachedData() const; + const RCSResourceAttributes getCachedData() const; const PrimitiveResourcePtr getPrimitiveResource() const; void requestGet(); @@ -60,7 +60,7 @@ namespace OIC std::shared_ptr baseHandler; // cached data info - ResourceAttributes attributes; + RCSResourceAttributes attributes; CACHE_STATE state; // subscriber info @@ -85,7 +85,7 @@ namespace OIC CacheID generateCacheID(); SubscriberInfoPair findSubscriber(CacheID id); - void notifyObservers(ResourceAttributes Att); + void notifyObservers(RCSResourceAttributes Att); }; } // namespace Service } // namespace OIC diff --git a/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h b/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h index c1a14a7..45c1aee 100644 --- a/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h +++ b/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h @@ -53,8 +53,8 @@ namespace OIC void updateResourceCache(PrimitiveResourcePtr pResource) const; void updateResourceCache(CacheID id) const; - const ResourceAttributes getCachedData(PrimitiveResourcePtr pResource) const; - const ResourceAttributes getCachedData(CacheID id) const; + const RCSResourceAttributes getCachedData(PrimitiveResourcePtr pResource) const; + const RCSResourceAttributes getCachedData(CacheID id) const; CACHE_STATE getResourceCacheState(PrimitiveResourcePtr pResource) const; CACHE_STATE getResourceCacheState(CacheID id) const; diff --git a/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp b/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp index 9e2df67..988b747 100644 --- a/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp +++ b/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp @@ -28,7 +28,7 @@ #include "DataCache.h" #include "ResponseStatement.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" #include "ExpiryTimer.h" namespace OIC @@ -134,13 +134,13 @@ namespace OIC return (sResource != nullptr) ? sResource : nullptr; } - const ResourceAttributes DataCache::getCachedData() const + const RCSResourceAttributes DataCache::getCachedData() const { if (state != CACHE_STATE::READY || attributes.empty()) { - return ResourceAttributes(); + return RCSResourceAttributes(); } - const ResourceAttributes retAtt = attributes; + const RCSResourceAttributes retAtt = attributes; return retAtt; } @@ -189,7 +189,7 @@ namespace OIC notifyObservers(_rep.getAttributes()); } - void DataCache::notifyObservers(ResourceAttributes Att) + void DataCache::notifyObservers(RCSResourceAttributes Att) { if (attributes == Att) { @@ -198,7 +198,7 @@ namespace OIC attributes = Att; - ResourceAttributes retAtt = Att; + RCSResourceAttributes retAtt = Att; for (auto &i : * subscriberList) { if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE) diff --git a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp index 32c4782..121b0d8 100644 --- a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp +++ b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp @@ -143,7 +143,7 @@ namespace OIC foundCache->requestGet(); } - const ResourceAttributes ResourceCacheManager::getCachedData( + const RCSResourceAttributes ResourceCacheManager::getCachedData( PrimitiveResourcePtr pResource) const { if (pResource == nullptr) @@ -159,7 +159,7 @@ namespace OIC return handler->getCachedData(); } - const ResourceAttributes ResourceCacheManager::getCachedData(CacheID id) const + const RCSResourceAttributes ResourceCacheManager::getCachedData(CacheID id) const { if (id == 0) { diff --git a/service/resource-encapsulation/src/resourceCache/unittests/DataCacheTest.cpp b/service/resource-encapsulation/src/resourceCache/unittests/DataCacheTest.cpp index f215e7c..c93fe6b 100644 --- a/service/resource-encapsulation/src/resourceCache/unittests/DataCacheTest.cpp +++ b/service/resource-encapsulation/src/resourceCache/unittests/DataCacheTest.cpp @@ -4,7 +4,7 @@ #include "ResourceCacheManager.h" #include "DataCache.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" #include "ResponseStatement.h" #include "UnitTestHelper.h" @@ -42,7 +42,7 @@ class DataCacheTest : public TestWithMock TestWithMock::SetUp(); pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {}); cacheHandler = new DataCache(); - cb = ([](std::shared_ptr, const ResourceAttributes &)->OCStackResult {return OC_STACK_OK;}); + cb = ([](std::shared_ptr, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;}); } virtual void TearDown() @@ -71,7 +71,7 @@ TEST_F(DataCacheTest, initializeDataCache_normalCaseObservable) { OIC::Service::HeaderOptions hos; - OIC::Service::ResourceAttributes attr; + OIC::Service::RCSResourceAttributes attr; OIC::Service::ResponseStatement rep(attr); callback(hos, rep, OC_STACK_OK); return; @@ -82,7 +82,7 @@ TEST_F(DataCacheTest, initializeDataCache_normalCaseObservable) [](ObserveCallback callback) { OIC::Service::HeaderOptions hos; - OIC::Service::ResourceAttributes attr; + OIC::Service::RCSResourceAttributes attr; OIC::Service::ResponseStatement rep(attr); int seq; callback(hos, rep, OC_STACK_OK, seq); @@ -102,7 +102,7 @@ TEST_F(DataCacheTest, initializeDataCache_normalCaseNonObservable) { OIC::Service::HeaderOptions hos; - OIC::Service::ResourceAttributes attr; + OIC::Service::RCSResourceAttributes attr; OIC::Service::ResponseStatement rep(attr); callback(hos, rep, OC_STACK_OK); return; @@ -185,7 +185,7 @@ TEST_F(DataCacheTest, getCachedData_normalCase) cacheHandler->initializeDataCache(pResource); - ASSERT_EQ(cacheHandler->getCachedData(), ResourceAttributes()); + ASSERT_EQ(cacheHandler->getCachedData(), RCSResourceAttributes()); } TEST_F(DataCacheTest, getPrimitiveResource_normalCase) @@ -240,12 +240,12 @@ TEST_F(DataCacheTest, requestGet_normalCasetest) std::cout << "HelloWorld" << std::endl; OIC::Service::HeaderOptions hos; - OIC::Service::ResourceAttributes attr; - //attr = mocks.Mcok< OIC::Service::ResourceAttributes >(); + OIC::Service::RCSResourceAttributes attr; + //attr = mocks.Mcok< OIC::Service::RCSResourceAttributes >(); OIC::Service::ResponseStatement rep(attr); //rep = mocks.Mock< OIC::Service::ResponseStatement >(attr); //fakeResource = mocks.Mock< FakeOCResource >(); - //mocks.OnCallFunc(ResourceAttributes::empty()).Return(false); + //mocks.OnCallFunc(RCSResourceAttributes::empty()).Return(false); callback(hos, rep, OC_STACK_OK); return; } @@ -255,4 +255,4 @@ TEST_F(DataCacheTest, requestGet_normalCasetest) cacheHandler->initializeDataCache(pResource); cacheHandler->requestGet(); -} \ No newline at end of file +} diff --git a/service/resource-encapsulation/src/resourceCache/unittests/ResourceCacheTest.cpp b/service/resource-encapsulation/src/resourceCache/unittests/ResourceCacheTest.cpp index bdd3414..3f82f03 100644 --- a/service/resource-encapsulation/src/resourceCache/unittests/ResourceCacheTest.cpp +++ b/service/resource-encapsulation/src/resourceCache/unittests/ResourceCacheTest.cpp @@ -31,7 +31,7 @@ class ResourceCacheManagerTest : public TestWithMock TestWithMock::SetUp(); cacheInstance = ResourceCacheManager::getInstance(); pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {}); - cb = ([](std::shared_ptr, const ResourceAttributes &)->OCStackResult {return OC_STACK_OK;}); + cb = ([](std::shared_ptr, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;}); } virtual void TearDown() @@ -292,4 +292,4 @@ TEST_F(ResourceCacheManagerTest, getResourceCacheStateCacheID_normalCase) cacheInstance->cancelResourceCache(id); ASSERT_EQ(state, CACHE_STATE::READY_YET); -} \ No newline at end of file +} diff --git a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/BundleResource.h b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/BundleResource.h index 96890db..e1b4ebc 100644 --- a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/BundleResource.h +++ b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/BundleResource.h @@ -27,7 +27,7 @@ #include #include "NotificationReceiver.h" -#include "ResourceAttributes.h" +#include "RCSResourceAttributes.h" using namespace std; @@ -82,9 +82,9 @@ namespace OIC /** * Return all attributes of the resource * - * @return ResourceAttributes - attributes of the resource + * @return RCSResourceAttributes - attributes of the resource */ - virtual ResourceAttributes &getAttributes(); + virtual RCSResourceAttributes &getAttributes(); /** * Execute the logic of bundle to set the value of attribute @@ -95,16 +95,16 @@ namespace OIC * * @return void */ - virtual void setAttribute(std::string key, ResourceAttributes::Value &&value); + virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value); /** * Execute the logic of bundle to get the value of attribute * * @param key - key of attribute to get * - * @return ResourceAttributes::Value - return value of the attribute + * @return RCSResourceAttributes::Value - return value of the attribute */ - virtual ResourceAttributes::Value getAttribute(const std::string &key); + virtual RCSResourceAttributes::Value getAttribute(const std::string &key); public: @@ -114,7 +114,7 @@ namespace OIC private: NotificationReceiver *m_pNotiReceiver; - ResourceAttributes m_resourceAttributes; + RCSResourceAttributes m_resourceAttributes; }; } diff --git a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/ProtocolBridgeResource.h b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/ProtocolBridgeResource.h index 349368e..4174fde 100644 --- a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/ProtocolBridgeResource.h +++ b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/ProtocolBridgeResource.h @@ -53,9 +53,9 @@ namespace OIC /** * Return all attributes of the resource * - * @return ResourceAttributes - attributes of the resource + * @return RCSResourceAttributes - attributes of the resource */ - virtual ResourceAttributes &getAttributes() = 0; + virtual RCSResourceAttributes &getAttributes() = 0; /** * Execute the logic of bundle to set the value of attribute @@ -66,16 +66,16 @@ namespace OIC * * @return void */ - virtual void setAttribute(std::string key, ResourceAttributes::Value &&value) = 0; + virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value) = 0; /** * Execute the logic of bundle to get the value of attribute * * @param key - key of attribute to get * - * @return ResourceAttributes::Value - return value of the attribute + * @return RCSResourceAttributes::Value - return value of the attribute */ - virtual ResourceAttributes::Value getAttribute(const std::string &key) = 0; + virtual RCSResourceAttributes::Value getAttribute(const std::string &key) = 0; }; } } diff --git a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/SoftSensorResource.h b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/SoftSensorResource.h index 52d361c..03fb98c 100644 --- a/service/resource-encapsulation/src/resourceContainer/bundle-api/include/SoftSensorResource.h +++ b/service/resource-encapsulation/src/resourceContainer/bundle-api/include/SoftSensorResource.h @@ -56,9 +56,9 @@ namespace OIC /** * Return all attributes of the resource * - * @return ResourceAttributes - attributes of the resource + * @return RCSResourceAttributes - attributes of the resource */ - virtual ResourceAttributes &getAttributes() = 0; + virtual RCSResourceAttributes &getAttributes() = 0; /** * Execute the logic of bundle to set the value of attribute @@ -69,16 +69,17 @@ namespace OIC * * @return void */ - virtual void setAttribute(std::string key, ResourceAttributes::Value &&value) = 0; + virtual void setAttribute(std::string key, + RCSResourceAttributes::Value &&value) = 0; /** * Execute the logic of bundle to get the value of attribute * * @param key - key of attribute to get * - * @return ResourceAttributes::Value - return value of the attribute + * @return RCSResourceAttributes::Value - return value of the attribute */ - virtual ResourceAttributes::Value getAttribute(const std::string &key) = 0; + virtual RCSResourceAttributes::Value getAttribute(const std::string &key) = 0; /** * Set Input data to update output value of the soft sensor diff --git a/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/include/HueLight.h b/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/include/HueLight.h index b1b36cf..3390908 100644 --- a/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/include/HueLight.h +++ b/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/include/HueLight.h @@ -38,11 +38,11 @@ namespace OIC HueLight(HueConnector* connector, std::string address); virtual ~HueLight(); virtual void initAttributes(); - virtual ResourceAttributes& getAttributes(); + virtual RCSResourceAttributes& getAttributes(); - virtual void setAttribute(std::string key, ResourceAttributes::Value&&); + virtual void setAttribute(std::string key, RCSResourceAttributes::Value&&); - virtual ResourceAttributes::Value getAttribute(const std::string& key); + virtual RCSResourceAttributes::Value getAttribute(const std::string& key); private: std::string m_address; HueConnector* m_connector; diff --git a/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/src/HueLight.cpp b/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/src/HueLight.cpp index a971ab6..f7b0ba1 100644 --- a/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/src/HueLight.cpp +++ b/service/resource-encapsulation/src/resourceContainer/examples/HueSampleBundle/src/HueLight.cpp @@ -48,16 +48,16 @@ void HueLight::initAttributes(){ BundleResource::setAttribute("color", 0); } -ResourceAttributes& HueLight::getAttributes(){ +RCSResourceAttributes& HueLight::getAttributes(){ return BundleResource::getAttributes(); } -ResourceAttributes::Value HueLight::getAttribute(const std::string& key){ +RCSResourceAttributes::Value HueLight::getAttribute(const std::string& key){ cout << "HueLight::getAttribute called for " << key << " called" << endl; return BundleResource::getAttribute(key); } -void HueLight::setAttribute(std::string attributeName, ResourceAttributes::Value&& value){ +void HueLight::setAttribute(std::string attributeName, RCSResourceAttributes::Value&& value){ cout << "HueLight::setAttribute setting " << attributeName << " to " << value.toString() << std::endl; if (attributeName == "on-off") diff --git a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/include/DiscomfortIndexSensorResource.h b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/include/DiscomfortIndexSensorResource.h index d0fe7c8..fc4ceef 100644 --- a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/include/DiscomfortIndexSensorResource.h +++ b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/include/DiscomfortIndexSensorResource.h @@ -37,9 +37,9 @@ class DiscomfortIndexSensorResource : public SoftSensorResource ~DiscomfortIndexSensorResource(); virtual void initAttributes(); - virtual ResourceAttributes &getAttributes(); - virtual void setAttribute(std::string key, ResourceAttributes::Value &&value); - virtual ResourceAttributes::Value getAttribute(const std::string &key); + virtual RCSResourceAttributes &getAttributes(); + virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value); + virtual RCSResourceAttributes::Value getAttribute(const std::string &key); void setInputAttribute(SensorData input); diff --git a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/DiscomfortIndexSensorResource.cpp b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/DiscomfortIndexSensorResource.cpp index 67161cf..80c11ad 100644 --- a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/DiscomfortIndexSensorResource.cpp +++ b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/DiscomfortIndexSensorResource.cpp @@ -48,18 +48,18 @@ void DiscomfortIndexSensorResource::initAttributes() BundleResource::setAttribute("discomfortIndex", "5"); } -ResourceAttributes &DiscomfortIndexSensorResource::getAttributes() +RCSResourceAttributes &DiscomfortIndexSensorResource::getAttributes() { return BundleResource::getAttributes(); } -ResourceAttributes::Value DiscomfortIndexSensorResource::getAttribute(const std::string &key) +RCSResourceAttributes::Value DiscomfortIndexSensorResource::getAttribute(const std::string &key) { cout << "DiscomfortIndexSensorResource::getAttribute called for " << key << " called" << endl; return BundleResource::getAttribute(key); } -void DiscomfortIndexSensorResource::setAttribute(std::string key, ResourceAttributes::Value &&value) +void DiscomfortIndexSensorResource::setAttribute(std::string key, RCSResourceAttributes::Value &&value) { cout << "DiscomfortIndexSensorResource::setAttribute setting " << key << " to " << value.toString() << std::endl; @@ -91,15 +91,15 @@ void DiscomfortIndexSensorResource::setInputAttribute(SensorData input) { if (!m_outputs.data.at(i)["name"].compare("temperature")) BundleResource::setAttribute("temperature", - ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); + RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); else if (!m_outputs.data.at(i)["name"].compare("humidity")) BundleResource::setAttribute("humidity", - ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); + RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); else if (!m_outputs.data.at(i)["name"].compare("discomfortIndex")) BundleResource::setAttribute("discomfortIndex", - ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); + RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str())); } } } diff --git a/service/resource-encapsulation/src/resourceContainer/include/JavaBundleResource.h b/service/resource-encapsulation/src/resourceContainer/include/JavaBundleResource.h index 9df860c..54cb40e 100644 --- a/service/resource-encapsulation/src/resourceContainer/include/JavaBundleResource.h +++ b/service/resource-encapsulation/src/resourceContainer/include/JavaBundleResource.h @@ -42,11 +42,11 @@ namespace OIC jobjectArray attributes); virtual ~JavaBundleResource(); - virtual ResourceAttributes& getAttributes(); + virtual RCSResourceAttributes& getAttributes(); - virtual void setAttribute(std::string key, ResourceAttributes::Value&&); + virtual void setAttribute(std::string key, RCSResourceAttributes::Value&&); - virtual ResourceAttributes::Value getAttribute(const std::string& key); + virtual RCSResourceAttributes::Value getAttribute(const std::string& key); virtual void initAttributes(); private: // needs to be a GlobalRef diff --git a/service/resource-encapsulation/src/resourceContainer/include/ResourceContainerImpl.h b/service/resource-encapsulation/src/resourceContainer/include/ResourceContainerImpl.h index ffdae24..de046cd 100644 --- a/service/resource-encapsulation/src/resourceContainer/include/ResourceContainerImpl.h +++ b/service/resource-encapsulation/src/resourceContainer/include/ResourceContainerImpl.h @@ -71,9 +71,9 @@ namespace OIC std::vector< resourceInfo > *configOutput); RCSGetResponse getRequestHandler(const RCSRequest &request, - const ResourceAttributes &attributes); + const RCSResourceAttributes &attributes); RCSSetResponse setRequestHandler(const RCSRequest &request, - const ResourceAttributes &attributes); + const RCSResourceAttributes &attributes); void onNotificationReceived(const std::string &strResourceUri); diff --git a/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp b/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp index 3afc29e..ed09139 100644 --- a/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp +++ b/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp @@ -45,23 +45,23 @@ namespace OIC std::list< string > BundleResource::getAttributeNames() { std::list< string > ret; - for (ResourceAttributes::iterator it = m_resourceAttributes.begin(); it != m_resourceAttributes.end(); ++it){ + for (RCSResourceAttributes::iterator it = m_resourceAttributes.begin(); it != m_resourceAttributes.end(); ++it){ ret.push_back(it->key()); } return ret; } - ResourceAttributes& BundleResource::getAttributes(){ + RCSResourceAttributes& BundleResource::getAttributes(){ return m_resourceAttributes; } - void BundleResource::setAttribute(std::string key, ResourceAttributes::Value&& value) + void BundleResource::setAttribute(std::string key, RCSResourceAttributes::Value&& value) { cout << "Bundle resource set attribute " << value.toString() << "|" << endl; m_resourceAttributes[key] = value; } - ResourceAttributes::Value BundleResource::getAttribute(const std::string& key){ + RCSResourceAttributes::Value BundleResource::getAttribute(const std::string& key){ cout << "Bundle resource get attribute " << m_resourceAttributes.at(key).toString() << "|" << endl; return m_resourceAttributes.at(key); } diff --git a/service/resource-encapsulation/src/resourceContainer/src/JavaBundleResource.cpp b/service/resource-encapsulation/src/resourceContainer/src/JavaBundleResource.cpp index 96b5015..a799dce 100644 --- a/service/resource-encapsulation/src/resourceContainer/src/JavaBundleResource.cpp +++ b/service/resource-encapsulation/src/resourceContainer/src/JavaBundleResource.cpp @@ -94,11 +94,11 @@ } - ResourceAttributes& JavaBundleResource::getAttributes(){ + RCSResourceAttributes& JavaBundleResource::getAttributes(){ return BundleResource::getAttributes(); } - ResourceAttributes::Value JavaBundleResource::getAttribute(const std::string& attributeName) + RCSResourceAttributes::Value JavaBundleResource::getAttribute(const std::string& attributeName) { JavaVM* vm = ResourceContainerImpl::getImplInstance()->getJavaVM(m_bundleId); @@ -124,13 +124,13 @@ const char *js = env->GetStringUTFChars(returnString, NULL); std::string val(js); - ResourceAttributes::Value newVal = val; + RCSResourceAttributes::Value newVal = val; env->ReleaseStringUTFChars(returnString, js); BundleResource::setAttribute(attributeName, newVal.toString()); return BundleResource::getAttribute(attributeName); } - void JavaBundleResource::setAttribute(std::string attributeName, ResourceAttributes::Value&& value) + void JavaBundleResource::setAttribute(std::string attributeName, RCSResourceAttributes::Value&& value) { JavaVM* vm = ResourceContainerImpl::getImplInstance()->getJavaVM(m_bundleId); diff --git a/service/resource-encapsulation/src/resourceContainer/src/ResourceContainerImpl.cpp b/service/resource-encapsulation/src/resourceContainer/src/ResourceContainerImpl.cpp index 6e185ee..e3e3d54 100644 --- a/service/resource-encapsulation/src/resourceContainer/src/ResourceContainerImpl.cpp +++ b/service/resource-encapsulation/src/resourceContainer/src/ResourceContainerImpl.cpp @@ -331,9 +331,9 @@ namespace OIC } RCSGetResponse ResourceContainerImpl::getRequestHandler(const RCSRequest &request, - const ResourceAttributes &attributes) + const RCSResourceAttributes &attributes) { - ResourceAttributes attr; + RCSResourceAttributes attr; if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end() && m_mapResources.find(request.getResourceUri()) != m_mapResources.end()) @@ -349,9 +349,9 @@ namespace OIC } RCSSetResponse ResourceContainerImpl::setRequestHandler(const RCSRequest &request, - const ResourceAttributes &attributes) + const RCSResourceAttributes &attributes) { - ResourceAttributes attr = attributes; + RCSResourceAttributes attr = attributes; if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end() && m_mapResources.find(request.getResourceUri()) != m_mapResources.end()) diff --git a/service/resource-encapsulation/src/serverBuilder/include/RequestHandler.h b/service/resource-encapsulation/src/serverBuilder/include/RequestHandler.h index 1755b58..0a03f4f 100644 --- a/service/resource-encapsulation/src/serverBuilder/include/RequestHandler.h +++ b/service/resource-encapsulation/src/serverBuilder/include/RequestHandler.h @@ -56,11 +56,11 @@ namespace OIC RequestHandler(const OCEntityHandlerResult& result, int errorCode); - RequestHandler(const ResourceAttributes&, + RequestHandler(const RCSResourceAttributes&, const OCEntityHandlerResult& result = DEFAULT_RESULT, int errorCode = DEFAULT_ERROR_CODE); - RequestHandler(ResourceAttributes&&, + RequestHandler(RCSResourceAttributes&&, const OCEntityHandlerResult& result = DEFAULT_RESULT, int errorCode = DEFAULT_ERROR_CODE); @@ -85,16 +85,16 @@ namespace OIC SetRequestHandler(const OCEntityHandlerResult& result, int errorCode); - SetRequestHandler(const ResourceAttributes&, + SetRequestHandler(const RCSResourceAttributes&, const OCEntityHandlerResult& result = DEFAULT_RESULT, int errorCode = DEFAULT_ERROR_CODE); - SetRequestHandler(ResourceAttributes&&, + SetRequestHandler(RCSResourceAttributes&&, const OCEntityHandlerResult& result = DEFAULT_RESULT, int errorCode = DEFAULT_ERROR_CODE); AttrKeyValuePairs applyAcceptanceMethod(RCSSetResponse::AcceptanceMethod, - RCSResourceObject&, const ResourceAttributes&) const; + RCSResourceObject&, const RCSResourceAttributes&) const; }; } diff --git a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp index 88c36a1..a41f41f 100755 --- a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp @@ -75,14 +75,16 @@ namespace return OC_EH_ERROR; } - ResourceAttributes getAttributesFromOCRequest(std::shared_ptr< OC::OCResourceRequest > request) + RCSResourceAttributes getAttributesFromOCRequest( + std::shared_ptr< OC::OCResourceRequest > request) { return ResourceAttributesConverter::fromOCRepresentation( request->getResourceRepresentation()); } - template< typename HANDLER, typename RESPONSE = typename std::decay::type::result_type > - RESPONSE invokeHandler(ResourceAttributes& attrs, + template< typename HANDLER, typename RESPONSE = + typename std::decay::type::result_type > + RESPONSE invokeHandler(RCSResourceAttributes& attrs, std::shared_ptr< OC::OCResourceRequest > ocRequest, HANDLER&& handler) { if (handler) @@ -93,16 +95,17 @@ namespace return RESPONSE::defaultAction(); } - typedef void (RCSResourceObject::* AutoNotifyFunc)(bool, RCSResourceObject::AutoNotifyPolicy) const; + typedef void (RCSResourceObject::* AutoNotifyFunc) + (bool, RCSResourceObject::AutoNotifyPolicy) const; std::function createAutoNotifyInvoker(AutoNotifyFunc autoNotifyFunc, - const RCSResourceObject& resourceObject, const ResourceAttributes& resourceAttributes, + const RCSResourceObject& resourceObject, const RCSResourceAttributes& resourceAttributes, RCSResourceObject::AutoNotifyPolicy autoNotifyPolicy) { if(autoNotifyPolicy == RCSResourceObject::AutoNotifyPolicy::UPDATED) { auto&& compareAttributesFunc = - std::bind(std::not_equal_to(), + std::bind(std::not_equal_to(), resourceAttributes, std::cref(resourceAttributes)); return std::bind(autoNotifyFunc, @@ -148,14 +151,14 @@ namespace OIC } RCSResourceObject::Builder& RCSResourceObject::Builder::setAttributes( - const ResourceAttributes& attrs) + const RCSResourceAttributes& attrs) { m_resourceAttributes = attrs; return *this; } RCSResourceObject::Builder& RCSResourceObject::Builder::setAttributes( - ResourceAttributes&& attrs) + RCSResourceAttributes&& attrs) { m_resourceAttributes = std::move(attrs); return *this; @@ -190,7 +193,7 @@ namespace OIC } - RCSResourceObject::RCSResourceObject(uint8_t properties, ResourceAttributes&& attrs) : + RCSResourceObject::RCSResourceObject(uint8_t properties, RCSResourceAttributes&& attrs) : m_properties { properties }, m_resourceHandle{ }, m_resourceAttributes{ std::move(attrs) }, @@ -221,7 +224,7 @@ namespace OIC } void RCSResourceObject::setAttribute(const std::string& key, - const ResourceAttributes::Value& value) + const RCSResourceAttributes::Value& value) { WeakGuard lock(*this); @@ -233,7 +236,8 @@ namespace OIC m_resourceAttributes[key] = value; } - void RCSResourceObject::setAttribute(const std::string& key, ResourceAttributes::Value&& value) + void RCSResourceObject::setAttribute(const std::string& key, + RCSResourceAttributes::Value&& value) { WeakGuard lock(*this); @@ -245,7 +249,8 @@ namespace OIC m_resourceAttributes[key] = std::move(value); } - void RCSResourceObject::setAttribute(std::string&& key, const ResourceAttributes::Value& value) + void RCSResourceObject::setAttribute(std::string&& key, + const RCSResourceAttributes::Value& value) { WeakGuard lock(*this); @@ -257,7 +262,8 @@ namespace OIC m_resourceAttributes[std::move(key)] = value; } - void RCSResourceObject::setAttribute(std::string&& key, ResourceAttributes::Value&& value) + void RCSResourceObject::setAttribute(std::string&& key, + RCSResourceAttributes::Value&& value) { WeakGuard lock(*this); @@ -269,7 +275,8 @@ namespace OIC m_resourceAttributes[std::move(key)] = std::move(value); } - ResourceAttributes::Value RCSResourceObject::getAttributeValue(const std::string& key) const + RCSResourceAttributes::Value RCSResourceObject::getAttributeValue( + const std::string& key) const { WeakGuard lock(*this); return m_resourceAttributes.at(key); @@ -292,13 +299,13 @@ namespace OIC return m_resourceAttributes.contains(key); } - ResourceAttributes& RCSResourceObject::getAttributes() + RCSResourceAttributes& RCSResourceObject::getAttributes() { expectOwnLock(); return m_resourceAttributes; } - const ResourceAttributes& RCSResourceObject::getAttributes() const + const RCSResourceAttributes& RCSResourceObject::getAttributes() const { expectOwnLock(); return m_resourceAttributes; @@ -363,7 +370,7 @@ namespace OIC } void RCSResourceObject::autoNotifyIfNeeded(const std::string& key, - const ResourceAttributes::Value& value) + const RCSResourceAttributes::Value& value) { autoNotify( m_resourceAttributes.contains(key) == false || m_resourceAttributes.at(key) != value @@ -385,7 +392,7 @@ namespace OIC m_setRequestHandlerPolicy = policy; } - RCSResourceObject::SetRequestHandlerPolicy RCSResourceObject::getSetRequestHandlerPolicy() const + auto RCSResourceObject::getSetRequestHandlerPolicy() const -> SetRequestHandlerPolicy { return m_setRequestHandlerPolicy; } diff --git a/service/resource-encapsulation/src/serverBuilder/src/RCSResponse.cpp b/service/resource-encapsulation/src/serverBuilder/src/RCSResponse.cpp index f5a6b29..4151338 100644 --- a/service/resource-encapsulation/src/serverBuilder/src/RCSResponse.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RCSResponse.cpp @@ -42,25 +42,25 @@ namespace OIC std::make_shared< RequestHandler >( result, errorCode) }; } - RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs) + RCSGetResponse RCSGetResponse::create(const RCSResourceAttributes& attrs) { return RCSGetResponse { std::make_shared< RequestHandler >(attrs) }; } - RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs, + RCSGetResponse RCSGetResponse::create(const RCSResourceAttributes& attrs, const OCEntityHandlerResult& result, int errorCode) { return RCSGetResponse { std::make_shared< RequestHandler >(attrs, result, errorCode) }; } - RCSGetResponse RCSGetResponse::create(ResourceAttributes&& result) + RCSGetResponse RCSGetResponse::create(RCSResourceAttributes&& result) { return RCSGetResponse { std::make_shared< RequestHandler >(std::move(result)) }; } - RCSGetResponse RCSGetResponse::create(ResourceAttributes&& attrs, + RCSGetResponse RCSGetResponse::create(RCSResourceAttributes&& attrs, const OCEntityHandlerResult& result, int errorCode) { return RCSGetResponse { std::make_shared< RequestHandler >( @@ -112,23 +112,23 @@ namespace OIC return std::make_shared< SetRequestHandler >(result, errorCode); } - RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs) + RCSSetResponse RCSSetResponse::create(const RCSResourceAttributes& attrs) { return std::make_shared< SetRequestHandler >(attrs); } - RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs, + RCSSetResponse RCSSetResponse::create(const RCSResourceAttributes& attrs, const OCEntityHandlerResult& result, int errorCode) { return std::make_shared< SetRequestHandler >(attrs, result, errorCode); } - RCSSetResponse RCSSetResponse::create(ResourceAttributes&& result) + RCSSetResponse RCSSetResponse::create(RCSResourceAttributes&& result) { return std::make_shared< SetRequestHandler >(std::move(result)); } - RCSSetResponse RCSSetResponse::create(ResourceAttributes&& attrs, + RCSSetResponse RCSSetResponse::create(RCSResourceAttributes&& attrs, const OCEntityHandlerResult& result, int errorCode) { return std::make_shared< SetRequestHandler >(std::move(attrs), result, errorCode); diff --git a/service/resource-encapsulation/src/serverBuilder/src/RequestHandler.cpp b/service/resource-encapsulation/src/serverBuilder/src/RequestHandler.cpp index 62764e3..b80985b 100644 --- a/service/resource-encapsulation/src/serverBuilder/src/RequestHandler.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RequestHandler.cpp @@ -36,7 +36,7 @@ namespace return ResourceAttributesConverter::toOCRepresentation(resource.getAttributes()); } - OC::OCRepresentation getOCRepresentation(const ResourceAttributes& attrs) + OC::OCRepresentation getOCRepresentation(const RCSResourceAttributes& attrs) { return ResourceAttributesConverter::toOCRepresentation(attrs); } @@ -60,7 +60,7 @@ namespace } AttrKeyValuePairs applyAcceptMethod(RCSResourceObject& resource, - const ResourceAttributes& requestAttrs) + const RCSResourceAttributes& requestAttrs) { RCSResourceObject::LockGuard lock(resource, RCSResourceObject::AutoNotifyPolicy::NEVER); @@ -68,7 +68,7 @@ namespace } AttrKeyValuePairs applyDefaultMethod(RCSResourceObject& resource, - const ResourceAttributes& requestAttrs) + const RCSResourceAttributes& requestAttrs) { RCSResourceObject::LockGuard lock(resource, RCSResourceObject::AutoNotifyPolicy::NEVER); @@ -82,13 +82,13 @@ namespace return replaceAttributes(resource.getAttributes(), requestAttrs); } - AttrKeyValuePairs applyIgnoreMethod(RCSResourceObject&, const ResourceAttributes&) + AttrKeyValuePairs applyIgnoreMethod(RCSResourceObject&, const RCSResourceAttributes&) { return AttrKeyValuePairs(); } auto getApplyAcceptanceFunc(RCSSetResponse::AcceptanceMethod method) -> - std::function + std::function { switch (method) { @@ -126,14 +126,14 @@ namespace OIC { } - RequestHandler::RequestHandler(const ResourceAttributes& attrs, + RequestHandler::RequestHandler(const RCSResourceAttributes& attrs, const OCEntityHandlerResult& result, int errorCode) : m_holder{ std::bind(doBuildResponse, std::placeholders::_1, result, errorCode, wrapGetOCRepresentation(attrs)) } { } - RequestHandler::RequestHandler(ResourceAttributes&& attrs, + RequestHandler::RequestHandler(RCSResourceAttributes&& attrs, const OCEntityHandlerResult& result, int errorCode) : m_holder{ std::bind(doBuildResponse, std::placeholders::_1, result, errorCode, wrapGetOCRepresentation(std::move(attrs))) } @@ -158,13 +158,13 @@ namespace OIC } - SetRequestHandler::SetRequestHandler(const ResourceAttributes& attrs, + SetRequestHandler::SetRequestHandler(const RCSResourceAttributes& attrs, const OCEntityHandlerResult& result, int errorCode) : RequestHandler{ attrs, result, errorCode } { } - SetRequestHandler::SetRequestHandler(ResourceAttributes&& attrs, + SetRequestHandler::SetRequestHandler(RCSResourceAttributes&& attrs, const OCEntityHandlerResult& result, int errorCode) : RequestHandler{ std::move(attrs), result, errorCode } { @@ -172,7 +172,7 @@ namespace OIC AttrKeyValuePairs SetRequestHandler::applyAcceptanceMethod( RCSSetResponse::AcceptanceMethod method, RCSResourceObject& resource, - const ResourceAttributes& requestAttrs) const + const RCSResourceAttributes& requestAttrs) const { return getApplyAcceptanceFunc(method)(resource, requestAttrs); } diff --git a/service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp b/service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp index 5fdcf47..5161125 100755 --- a/service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp +++ b/service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp @@ -76,7 +76,7 @@ TEST_F(ResourceObjectBuilderTest, ResourceServerHasPropertiesSetByBuilder) TEST_F(ResourceObjectBuilderTest, ResourceServerHasAttrsSetByBuilder) { - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = 100; auto serverResource = RCSResourceObject::Builder(RESOURCE_URI, RESOURCE_TYPE, ""). @@ -353,7 +353,7 @@ TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithRCSResponseResults) constexpr OCEntityHandlerResult result{ OC_EH_SLOW }; server->setGetRequestHandler( - [](const RCSRequest&, ResourceAttributes&) -> RCSGetResponse + [](const RCSRequest&, RCSResourceAttributes&) -> RCSGetResponse { return RCSGetResponse::create(result, errorCode); } @@ -377,9 +377,9 @@ TEST_F(ResourceObjectHandlingRequestTest, SendSetResponseWithCustomAttrsAndResul constexpr char value[]{ "value" }; server->setSetRequestHandler( - [](const RCSRequest&, ResourceAttributes&) -> RCSSetResponse + [](const RCSRequest&, RCSResourceAttributes&) -> RCSSetResponse { - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = value; return RCSSetResponse::create(attrs, result, errorCode); } @@ -595,8 +595,8 @@ TEST_F(AttributeUpdatedListenerTest, AddListenerReturnsTrueIfListenerIsCalled) OCRepresentation ocRep = createOCRepresentation(); server->addAttributeUpdatedListener(KEY, - [&called](const OIC::Service::ResourceAttributes::Value&, - const OIC::Service::ResourceAttributes::Value& ) + [&called](const OIC::Service::RCSResourceAttributes::Value&, + const OIC::Service::RCSResourceAttributes::Value& ) { called=true; } ); @@ -614,15 +614,15 @@ TEST_F(AttributeUpdatedListenerTest, AddListenerisChangedAccordingToLastAddedFun OCRepresentation ocRep = createOCRepresentation(); server->addAttributeUpdatedListener("key", - [&called](const OIC::Service::ResourceAttributes::Value&, - const OIC::Service::ResourceAttributes::Value&) + [&called](const OIC::Service::RCSResourceAttributes::Value&, + const OIC::Service::RCSResourceAttributes::Value&) { called=10; } ); server->addAttributeUpdatedListener(KEY, - [&called](const OIC::Service::ResourceAttributes::Value&, - const OIC::Service::ResourceAttributes::Value&) + [&called](const OIC::Service::RCSResourceAttributes::Value&, + const OIC::Service::RCSResourceAttributes::Value&) { called=100; } ); @@ -640,8 +640,8 @@ TEST_F(AttributeUpdatedListenerTest, RemoveListenerReturnsTrueIfListenerIsNotAdd TEST_F(AttributeUpdatedListenerTest, RemoveListenerReturnsTrueIfListenerIsAdded) { server->addAttributeUpdatedListener(KEY, - [](const OIC::Service::ResourceAttributes::Value&, - const OIC::Service::ResourceAttributes::Value&) + [](const OIC::Service::RCSResourceAttributes::Value&, + const OIC::Service::RCSResourceAttributes::Value&) { } ); diff --git a/service/resource-encapsulation/src/serverBuilder/unittests/RCSResponseTest.cpp b/service/resource-encapsulation/src/serverBuilder/unittests/RCSResponseTest.cpp index 5e77ad8..16c7bb5 100644 --- a/service/resource-encapsulation/src/serverBuilder/unittests/RCSResponseTest.cpp +++ b/service/resource-encapsulation/src/serverBuilder/unittests/RCSResponseTest.cpp @@ -44,7 +44,7 @@ static constexpr char KEY[] = "key"; void EXPECT_RESPONSE(shared_ptr< OCResourceResponse > ocResponse, - const OCEntityHandlerResult& result, int errorCode, const ResourceAttributes& attrs) + const OCEntityHandlerResult& result, int errorCode, const RCSResourceAttributes& attrs) { EXPECT_EQ(ocResponse->getResponseResult(), result); EXPECT_EQ(ocResponse->getErrorCode(), errorCode); @@ -81,7 +81,7 @@ TEST_F(RCSResponseTest, GetDefaultActionHasEmptyAttrs) { EXPECT_RESPONSE(buildResponse(RCSGetResponse::defaultAction()), RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE, - ResourceAttributes()); + RCSResourceAttributes()); } TEST_F(RCSResponseTest, GetResponseHasResultsPassedCodes) @@ -90,7 +90,7 @@ TEST_F(RCSResponseTest, GetResponseHasResultsPassedCodes) constexpr int errorCode{ -10 }; EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(result, errorCode)), - result, errorCode, ResourceAttributes()); + result, errorCode, RCSResourceAttributes()); } TEST_F(RCSResponseTest, GetResponseHasAttrsAndResultsPassedCodes) @@ -98,7 +98,7 @@ TEST_F(RCSResponseTest, GetResponseHasAttrsAndResultsPassedCodes) constexpr OCEntityHandlerResult result{ OC_EH_ERROR }; constexpr int errorCode{ -10 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = 100; EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(attrs, result, errorCode)), @@ -110,10 +110,10 @@ TEST_F(RCSResponseTest, GetResponseCanMoveAttrs) constexpr OCEntityHandlerResult result{ OC_EH_ERROR }; constexpr int errorCode{ -10 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = 100; - ResourceAttributes attrsClone; + RCSResourceAttributes attrsClone; attrsClone[KEY] = 100; EXPECT_RESPONSE( @@ -127,7 +127,7 @@ TEST_F(RCSResponseTest, SetDefaultActionHasEmptyAttrs) { EXPECT_RESPONSE(buildResponse(RCSSetResponse::defaultAction()), RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE, - ResourceAttributes()); + RCSResourceAttributes()); } TEST_F(RCSResponseTest, SetResponseHasResultsPassedCodes) @@ -136,7 +136,7 @@ TEST_F(RCSResponseTest, SetResponseHasResultsPassedCodes) constexpr int errorCode{ -10 }; EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(result, errorCode)), - result, errorCode, ResourceAttributes()); + result, errorCode, RCSResourceAttributes()); } TEST_F(RCSResponseTest, SetResponseHasAttrsAndResultsPassedCodes) @@ -144,7 +144,7 @@ TEST_F(RCSResponseTest, SetResponseHasAttrsAndResultsPassedCodes) constexpr OCEntityHandlerResult result{ OC_EH_ERROR }; constexpr int errorCode{ -10 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = 100; EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(attrs, result, errorCode)), @@ -156,10 +156,10 @@ TEST_F(RCSResponseTest, SetResponseCanMoveAttrs) constexpr OCEntityHandlerResult result{ OC_EH_ERROR }; constexpr int errorCode{ -10 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[KEY] = 100; - ResourceAttributes attrsClone; + RCSResourceAttributes attrsClone; attrsClone[KEY] = 100; EXPECT_RESPONSE( diff --git a/service/resource-encapsulation/src/serverBuilder/unittests/RequestHandlerTest.cpp b/service/resource-encapsulation/src/serverBuilder/unittests/RequestHandlerTest.cpp index 6c3e87f..9761f3d 100644 --- a/service/resource-encapsulation/src/serverBuilder/unittests/RequestHandlerTest.cpp +++ b/service/resource-encapsulation/src/serverBuilder/unittests/RequestHandlerTest.cpp @@ -83,7 +83,7 @@ TEST_F(RequestHandlerTest, ResponseHasAttrsSetByCustomAttrRequestHandler) constexpr char key[] { "key" }; constexpr int newValue{ 100 }; - ResourceAttributes attrs; + RCSResourceAttributes attrs; attrs[key] = newValue; RequestHandler handler{ attrs }; @@ -99,7 +99,7 @@ class SetRequestHandlerAcceptanceTest: public RequestHandlerTest public: SetRequestHandler::Ptr setRequestHandler; - ResourceAttributes requestAttrs; + RCSResourceAttributes requestAttrs; protected: void SetUp() @@ -140,7 +140,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, ReturnedAttrPairsHaveOldValue) TEST_F(SetRequestHandlerAcceptanceTest, NothingHappenedWithEmptyAttrs) { setRequestHandler->applyAcceptanceMethod( - RCSSetResponse::AcceptanceMethod::ACCEPT, *server, ResourceAttributes{ }); + RCSSetResponse::AcceptanceMethod::ACCEPT, *server, RCSResourceAttributes{ }); ASSERT_EQ(ORIGIN_VALUE, server->getAttribute(EXISTING)); } diff --git a/service/resource-encapsulation/unittests/ResourceClient_Test.cpp b/service/resource-encapsulation/unittests/ResourceClient_Test.cpp index 78e86f6..e80c9df 100644 --- a/service/resource-encapsulation/unittests/ResourceClient_Test.cpp +++ b/service/resource-encapsulation/unittests/ResourceClient_Test.cpp @@ -17,7 +17,7 @@ std::string uri = "/oic/res?rt=Resource.Hosting"; std::shared_ptr object; DiscoveryManager *manager = DiscoveryManager::getInstance(); ResourceState receivedResourceState; -ResourceAttributes receivedResourceAttributes; +RCSResourceAttributes receivedResourceAttributes; RCSResourceObject::Ptr server; void createResource() @@ -39,7 +39,7 @@ void destroyResource() } //Callbacks -void onRemoteAttrReceived(const ResourceAttributes &attributes) +void onRemoteAttrReceived(const RCSResourceAttributes &attributes) { cbresult = true; receivedResourceAttributes = attributes; @@ -59,12 +59,12 @@ void onResourceStateChanged(ResourceState state) receivedResourceState = state; } -void onCacheUpdated(const ResourceAttributes attribute) +void onCacheUpdated(const RCSResourceAttributes attribute) { receivedResourceAttributes = attribute; } -void OnRemoteAttributesSetCallback(const ResourceAttributes &attributes) +void OnRemoteAttributesSetCallback(const RCSResourceAttributes &attributes) { cbresult = true; } @@ -104,7 +104,7 @@ TEST(ResourceClientTest, testSetRemoteAttributesPass) cbresult = false; object->getRemoteAttributes(&onRemoteAttrReceived); sleep(2); - ResourceAttributes::const_iterator iter = receivedResourceAttributes.begin(); + RCSResourceAttributes::const_iterator iter = receivedResourceAttributes.begin(); for (unsigned int i = 0; i < receivedResourceAttributes.size(); ++i) { if ( iter->key() == "Temperature") @@ -249,7 +249,7 @@ TEST(ResourceClientTest, testGetResourceCacheState) TEST(ResourceClientTest, testGetCachedAttributesWithoutCallback) { createResource(); - ResourceAttributes result = object->getCachedAttributes(); + RCSResourceAttributes result = object->getCachedAttributes(); EXPECT_TRUE(result.empty()); destroyResource(); } @@ -258,7 +258,7 @@ TEST(ResourceClientTest, testGetCachedAttributesWithoutCallback) TEST(ResourceClientTest, testGetCachedAttributeWithInvalidAttribute) { createResource(); - ResourceAttributes::Value result = object->getCachedAttribute(""); + RCSResourceAttributes::Value result = object->getCachedAttribute(""); EXPECT_TRUE(result == nullptr); destroyResource(); } @@ -309,7 +309,7 @@ TEST(ResourceClientTest, testGetInterfaces) TEST(ResourceClientTest, testGetCachedAttribute) { createResource(); - ResourceAttributes::Value result = object->getCachedAttribute("Temperature"); + RCSResourceAttributes::Value result = object->getCachedAttribute("Temperature"); EXPECT_TRUE(result != nullptr); destroyResource(); } @@ -343,12 +343,12 @@ TEST(ResourceClientTest, testDiscoverResourceEmptyCallback) object->stopMonitoring(); } -//Send invalid ResourceAttributes object to function +//Send invalid RCSResourceAttributes object to function TEST(ResourceClientTest, testSetRemoteAttributesInvalidAttributes) { createResource(); cbresult = false; - ResourceAttributes attr; + RCSResourceAttributes attr; //object->getRemoteAttributes(&onRemoteAttrReceived); object->setRemoteAttributes(attr, &OnRemoteAttributesSetCallback); EXPECT_FALSE(cbresult);