Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / resource-encapsulation / include / RCSSeparateResponse.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 SERVERBUILDER_RCSSEPARATERESPONSE_H
22 #define SERVERBUILDER_RCSSEPARATERESPONSE_H
23
24 #include "RCSRequest.h"
25
26 namespace OIC
27 {
28     namespace Service
29     {
30         /**
31          * This class is to send a delayed response for request handlers of the RCSResourceObject.
32          *
33          * @see RCSResourceObject
34          * @see RCSResourceObject::SetRequestHandler
35          * @see RCSResourceObject::GetRequestHandler
36          * @see RCSGetResponse::separate()
37          * @see RCSSetResponse::separate()
38          */
39         class RCSSeparateResponse
40         {
41         public:
42             /**
43              * Constructs with a request.
44              *
45              * @note The request must be from a request handler which returns separate().
46              *
47              * @see RCSResourceObject::SetRequestHandler
48              * @see RCSResourceObject::GetRequestHandler
49              * @see RCSGetResponse::separate()
50              * @see RCSSetResponse::separate()
51              */
52             explicit RCSSeparateResponse(const RCSRequest& request);
53
54             /**
55              * @overload
56              */
57             explicit RCSSeparateResponse(RCSRequest&& request);
58
59             RCSSeparateResponse(const RCSSeparateResponse&) = delete;
60             RCSSeparateResponse& operator=(const RCSSeparateResponse&) = delete;
61
62             RCSSeparateResponse(RCSSeparateResponse&&) = default;
63             RCSSeparateResponse& operator=(RCSSeparateResponse&&) =default;
64
65             /**
66              * Sends the response to the client.
67              * The payload will be composed of properties(including attributes) of
68              *      the resource object of the request.
69              *
70              * @throws RCSBadRequestException If the RCSResourceObject which receives the request
71              *      is gone or it is already set.
72              * @throws RCSPlatformException If the operation failed.
73              */
74             void set();
75
76         private:
77             RCSRequest m_request;
78
79             bool m_done;
80         };
81
82     }
83 }
84
85 #endif // SERVERBUILDER_RCSSEPARATERESPONSE_H