1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef RES_ENCAPSULATION_RCSREPRESENTATION_H_
22 #define RES_ENCAPSULATION_RCSREPRESENTATION_H_
24 #include "RCSResourceAttributes.h"
28 class OCRepresentation;
37 * This class describes a resource representation.
39 * @see RCSResourceObject
40 * @see RCRemoteResourceObject
42 class RCSRepresentation
47 explicit RCSRepresentation(const std::string& uri);
48 explicit RCSRepresentation(const RCSResourceAttributes& attrs);
50 RCSRepresentation(const std::string& uri, const std::vector< std::string >& interfaces,
51 const std::vector< std::string >& resourceTypes);
53 RCSRepresentation(const std::string& uri, const std::vector< std::string >& interfaces,
54 const std::vector< std::string >& resourceTypes,
55 const RCSResourceAttributes& attrs);
60 std::string getUri() const;
63 * Sets the uri of this representation.
65 void setUri(std::string uri);
68 * Returns all interfaces added.
70 const std::vector< std::string >& getInterfaces() const;
75 * @param interface an interface to add
77 void addInterface(std::string interface);
80 * Removes all interfaces added.
82 void clearInterfaces();
85 * Returns all resource types added.
87 const std::vector< std::string >& getResourceTypes() const;
91 * Adds a resource type.
93 void addResourceType(std::string resourceType);
96 * Removes all resource types.
98 void clearResourceTypes();
101 * Returns attributes set in this representation.
103 const RCSResourceAttributes& getAttributes() const;
108 RCSResourceAttributes& getAttributes();
111 * Overwrite attributes.
113 * @param attrs new attributes.
115 void setAttributes(const RCSResourceAttributes& attrs);
120 void setAttributes(RCSResourceAttributes&& attrs);
123 * Returns children of this representation.
125 const std::vector< RCSRepresentation >& getChildren() const;
128 * Adds a child to this representation.
130 * @param child a representation to be attached
132 void addChild(RCSRepresentation child);
135 * Sets children of this representation.
137 * @param children new children
139 void setChildren(std::vector< RCSRepresentation > children);
142 * Removse all children
144 void clearChildren();
147 * Converts OCRepresentation into RCSRepresentation.
149 * @see toOCRepresentation
151 static RCSRepresentation fromOCRepresentation(const OC::OCRepresentation&);
155 * Converts RCSRepresentation into OCRepresentation.
157 * @see fromOCRepresentation
159 static OC::OCRepresentation toOCRepresentation(const RCSRepresentation&);
160 static OC::OCRepresentation toOCRepresentation(RCSRepresentation&&);
165 std::vector< std::string > m_interfaces;
166 std::vector< std::string > m_resourceTypes;
168 RCSResourceAttributes m_attributes;
170 std::vector< RCSRepresentation > m_children;
176 #endif /* RES_ENCAPSULATION_RCSREPRESENTATION_H_ */