Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / serverBuilder / include / InterfaceHandler.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2015 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 #ifndef RE_INTERFACEHANDLER_H_\r
22 #define RE_INTERFACEHANDLER_H_\r
23 \r
24 #include <string>\r
25 #include <functional>\r
26 \r
27 namespace OIC\r
28 {\r
29     namespace Service\r
30     {\r
31         class RCSRequest;\r
32         class RCSResourceObject;\r
33         class RCSRepresentation;\r
34         class RCSResourceAttributes;\r
35 \r
36         const std::string BASELINE_INTERFACE = "oic.if.baseline";\r
37         const std::string ACTUATOR_INTERFACE = "oic.if.a";\r
38         const std::string SENSOR_INTERFACE = "oic.if.s";\r
39         const std::string BATCH_INTERFACE = "oic.if.b";\r
40 \r
41         class InterfaceHandler\r
42         {\r
43         public:\r
44             typedef std::function< RCSRepresentation(RCSRequest, const RCSResourceObject&) >\r
45                 GetResponseBuilder;\r
46 \r
47             typedef std::function< RCSRepresentation(RCSRequest, const RCSResourceObject&) >\r
48                 SetResponseBuilder;\r
49 \r
50         public:\r
51             InterfaceHandler(GetResponseBuilder, SetResponseBuilder);\r
52 \r
53             bool isGetSupported() const;\r
54             bool isSetSupported() const;\r
55 \r
56             GetResponseBuilder getGetResponseBuilder() const;\r
57             SetResponseBuilder getSetResponseBuilder() const;\r
58 \r
59         private:\r
60             GetResponseBuilder m_getBuilder;\r
61             SetResponseBuilder m_setBuilder;\r
62         };\r
63 \r
64         InterfaceHandler getDefaultInterfaceHandler(const std::string&, const std::string&);\r
65     }\r
66 }\r
67 \r
68 #endif /* RE_INTERFACEHANDLER_H_ */\r