Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceContainer / bundle-api / include / SoftSensorResource.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 SOFTSENSORRESOURCE_H_
22 #define SOFTSENSORRESOURCE_H_
23
24 #include "BundleResource.h"
25
26 namespace OIC
27 {
28     namespace Service
29     {
30
31         /**
32         * @class    SoftSensorResource
33         * @brief    This class represents bundle resource for Soft Sensor
34         *               to be registered in the container and make resource server
35         *
36         */
37         class SoftSensorResource: public BundleResource
38         {
39             public:
40                 /**
41                 * Constructor for SoftSensorResource
42                 */
43                 SoftSensorResource();
44
45                 /**
46                 * Virtual destructor for SoftSensorResource
47                 */
48                 virtual ~SoftSensorResource();
49
50                 /**
51                 * Initialize input and output attributes for the resource
52                 *
53                 * @return void
54                 */
55                 virtual void initAttributes();
56
57                 /**
58                 * Return all attributes of the resource
59                 *
60                 * @return RCSResourceAttributes - attributes of the resource
61                 */
62                 virtual RCSResourceAttributes &getAttributes();
63
64                 /**
65                 * Execute the logic of bundle to set the value of attribute
66                 *
67                 * @param key - name of attribute to set
68                 *
69                 * @param value - value of attribute to set
70                 *
71                 * @return void
72                 */
73                 virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value);
74
75                 /**
76                 * Execute the logic of bundle to get the value of attribute
77                 *
78                 * @param key - key of attribute to get
79                 *
80                 * @return RCSResourceAttributes::Value - return value of the attribute
81                 */
82                 virtual RCSResourceAttributes::Value getAttribute(const std::string &key);
83
84                 /**
85                 * SoftSensor logic. Has to be provided by the soft sensor developer.
86                 * This function will be executed if an input attribute is updated.
87                 *
88                 * @return void
89                 */
90                 virtual void executeLogic() = 0;
91
92
93             public:
94                 std::list<std::string> m_inputList;
95         };
96     }
97 }
98
99 #endif