Updated api description for RCSRepresentation.
[platform/upstream/iotivity.git] / service / resource-encapsulation / include / RCSRepresentation.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef RES_ENCAPSULATION_RCSREPRESENTATION_H_
22 #define RES_ENCAPSULATION_RCSREPRESENTATION_H_
23
24 #include "RCSResourceAttributes.h"
25
26 namespace OC
27 {
28     class OCRepresentation;
29 }
30
31 namespace OIC
32 {
33     namespace Service
34     {
35
36         /**
37          * This class describes a resource representation.
38          *
39          * @see RCSResourceObject
40          * @see RCRemoteResourceObject
41          */
42         class RCSRepresentation
43         {
44         public:
45             RCSRepresentation();
46
47             explicit RCSRepresentation(const std::string& uri);
48             explicit RCSRepresentation(const RCSResourceAttributes& attrs);
49
50             RCSRepresentation(const std::string& uri, const std::vector< std::string >& interfaces,
51                     const std::vector< std::string >& resourceTypes);
52
53             RCSRepresentation(const std::string& uri, const std::vector< std::string >& interfaces,
54                     const std::vector< std::string >& resourceTypes,
55                     const RCSResourceAttributes& attrs);
56
57             /**
58              * Returns the uri.
59              */
60             std::string getUri() const;
61
62             /**
63              * Sets the uri of this representation.
64              */
65             void setUri(std::string uri);
66
67             /**
68              * Returns all interfaces added.
69              */
70             const std::vector< std::string >& getInterfaces() const;
71
72             /**
73              * Adds an interface.
74              *
75              * @param interface an interface to add
76              */
77             void addInterface(std::string interface);
78
79             /**
80              * Removes all interfaces added.
81              */
82             void clearInterfaces();
83
84             /**
85              * Returns all resource types added.
86              */
87             const std::vector< std::string >& getResourceTypes() const;
88
89
90             /**
91              * Adds a resource type.
92              */
93             void addResourceType(std::string resourceType);
94
95             /**
96              * Removes all resource types.
97              */
98             void clearResourceTypes();
99
100             /**
101              * Returns attributes set in this representation.
102              */
103             const RCSResourceAttributes& getAttributes() const;
104
105             /**
106              * @overload
107              */
108             RCSResourceAttributes& getAttributes();
109
110             /**
111              * Overwrite attributes.
112              *
113              * @param attrs new attributes.
114              */
115             void setAttributes(const RCSResourceAttributes& attrs);
116
117             /**
118              * @overload
119              */
120             void setAttributes(RCSResourceAttributes&& attrs);
121
122             /**
123              * Returns children of this representation.
124              */
125             const std::vector< RCSRepresentation >& getChildren() const;
126
127             /**
128              * Adds a child to this representation.
129              *
130              * @param child a representation to be attached
131              */
132             void addChild(RCSRepresentation child);
133
134             /**
135              * Sets children of this representation.
136              *
137              * @param children new children
138              */
139             void setChildren(std::vector< RCSRepresentation > children);
140
141             /**
142              * Removse all children
143              */
144             void clearChildren();
145
146             /**
147              * Converts OCRepresentation into RCSRepresentation.
148              *
149              * @see toOCRepresentation
150              */
151             static RCSRepresentation fromOCRepresentation(const OC::OCRepresentation&);
152
153
154             /**
155              * Converts RCSRepresentation into OCRepresentation.
156              *
157              * @see fromOCRepresentation
158              */
159             static OC::OCRepresentation toOCRepresentation(const RCSRepresentation&);
160             static OC::OCRepresentation toOCRepresentation(RCSRepresentation&&);
161
162         private:
163             std::string m_uri;
164
165             std::vector< std::string > m_interfaces;
166             std::vector< std::string > m_resourceTypes;
167
168             RCSResourceAttributes m_attributes;
169
170             std::vector< RCSRepresentation > m_children;
171         };
172
173     }
174 }
175
176 #endif /* RES_ENCAPSULATION_RCSREPRESENTATION_H_ */