From e60a6e33844c79ba6a8394e618977885a9499c78 Mon Sep 17 00:00:00 2001 From: coderhyme Date: Thu, 25 Feb 2016 22:50:49 -0800 Subject: [PATCH] Updated api description for RCSRepresentation. Change-Id: I68570997978e83d60f0c0ccd66274aac52ee5989 Signed-off-by: coderhyme Reviewed-on: https://gerrit.iotivity.org/gerrit/5217 Reviewed-by: Uze Choi Tested-by: Uze Choi Tested-by: jenkins-iotivity Reviewed-by: Hun-je Yeon --- .../include/RCSRepresentation.h | 96 +++++++++++++++++++--- .../primitiveResource/src/RCSRepresentation.cpp | 35 ++------ 2 files changed, 88 insertions(+), 43 deletions(-) diff --git a/service/resource-encapsulation/include/RCSRepresentation.h b/service/resource-encapsulation/include/RCSRepresentation.h index 894c8ba..bd17166 100644 --- a/service/resource-encapsulation/include/RCSRepresentation.h +++ b/service/resource-encapsulation/include/RCSRepresentation.h @@ -33,10 +33,15 @@ namespace OIC namespace Service { + /** + * This class describes a resource representation. + * + * @see RCSResourceObject + * @see RCRemoteResourceObject + */ class RCSRepresentation { public: - RCSRepresentation(); explicit RCSRepresentation(const std::string& uri); @@ -49,43 +54,108 @@ namespace OIC const std::vector< std::string >& resourceTypes, const RCSResourceAttributes& attrs); + /** + * Returns the uri. + */ std::string getUri() const; - void setUri(const std::string& uri); - void setUri(std::string&& uri); + /** + * Sets the uri of this representation. + */ + void setUri(std::string uri); + /** + * Returns all interfaces added. + */ const std::vector< std::string >& getInterfaces() const; - void addInterface(const std::string& interface); - void addInterface(std::string&& interface); + /** + * Adds an interface. + * + * @param interface an interface to add + */ + void addInterface(std::string interface); + /** + * Removes all interfaces added. + */ void clearInterfaces(); + /** + * Returns all resource types added. + */ const std::vector< std::string >& getResourceTypes() const; - void addResourceType(const std::string& resourceType); - void addResourceType(std::string&& resourceType); + /** + * Adds a resource type. + */ + void addResourceType(std::string resourceType); + + /** + * Removes all resource types. + */ void clearResourceTypes(); + /** + * Returns attributes set in this representation. + */ const RCSResourceAttributes& getAttributes() const; + + /** + * @overload + */ RCSResourceAttributes& getAttributes(); + /** + * Overwrite attributes. + * + * @param attrs new attributes. + */ void setAttributes(const RCSResourceAttributes& attrs); + + /** + * @overload + */ void setAttributes(RCSResourceAttributes&& attrs); + /** + * Returns children of this representation. + */ const std::vector< RCSRepresentation >& getChildren() const; - void addChild(const RCSRepresentation&); - void addChild(RCSRepresentation&&); - - void setChildren(const std::vector< RCSRepresentation >&); - void setChildren(std::vector< RCSRepresentation >&&); - + /** + * Adds a child to this representation. + * + * @param child a representation to be attached + */ + void addChild(RCSRepresentation child); + + /** + * Sets children of this representation. + * + * @param children new children + */ + void setChildren(std::vector< RCSRepresentation > children); + + /** + * Removse all children + */ void clearChildren(); + /** + * Converts OCRepresentation into RCSRepresentation. + * + * @see toOCRepresentation + */ static RCSRepresentation fromOCRepresentation(const OC::OCRepresentation&); + + /** + * Converts RCSRepresentation into OCRepresentation. + * + * @see fromOCRepresentation + */ static OC::OCRepresentation toOCRepresentation(const RCSRepresentation&); static OC::OCRepresentation toOCRepresentation(RCSRepresentation&&); diff --git a/service/resource-encapsulation/src/common/primitiveResource/src/RCSRepresentation.cpp b/service/resource-encapsulation/src/common/primitiveResource/src/RCSRepresentation.cpp index eb36858..79db0bd 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/src/RCSRepresentation.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/src/RCSRepresentation.cpp @@ -69,12 +69,7 @@ namespace OIC return m_uri; } - void RCSRepresentation::setUri(const std::string& uri) - { - m_uri = uri; - } - - void RCSRepresentation::setUri(std::string&& uri) + void RCSRepresentation::setUri(std::string uri) { m_uri = std::move(uri); } @@ -84,12 +79,7 @@ namespace OIC return m_interfaces; } - void RCSRepresentation::addInterface(const std::string& interface) - { - m_interfaces.push_back(interface); - } - - void RCSRepresentation::addInterface(std::string&& interface) + void RCSRepresentation::addInterface(std::string interface) { m_interfaces.push_back(std::move(interface)); } @@ -104,12 +94,7 @@ namespace OIC return m_resourceTypes; } - void RCSRepresentation::addResourceType(const std::string& resourceType) - { - m_resourceTypes.push_back(resourceType); - } - - void RCSRepresentation::addResourceType(std::string&& resourceType) + void RCSRepresentation::addResourceType(std::string resourceType) { m_resourceTypes.push_back(std::move(resourceType)); } @@ -139,22 +124,12 @@ namespace OIC m_attributes = std::move(attrs); } - void RCSRepresentation::addChild(const RCSRepresentation& child) - { - m_children.push_back(child); - } - - void RCSRepresentation::addChild(RCSRepresentation&& child) + void RCSRepresentation::addChild(RCSRepresentation child) { m_children.push_back(std::move(child)); } - void RCSRepresentation::setChildren(const std::vector< RCSRepresentation >& children) - { - m_children = children; - } - - void RCSRepresentation::setChildren(std::vector< RCSRepresentation >&& children) + void RCSRepresentation::setChildren(std::vector< RCSRepresentation > children) { m_children = std::move(children); } -- 2.7.4