[SSM] Fix code license comments
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SSMCore / include / SSMInterface.h
1 /******************************************************************
2 *
3 * Copyright 2014 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 #ifndef _SSMInterface_H_
21 #define _SSMInterface_H_
22
23 #include <string>
24 #include <vector>
25
26 namespace OIC
27 {
28     enum SSMRESULT
29     {
30         SSM_S_OK
31         , SSM_S_FALSE
32         , SSM_E_POINTER
33         , SSM_E_OUTOFMEMORY
34         , SSM_E_FAIL
35         , SSM_E_NOTINIT
36         , SSM_E_INITIALIZED
37         , SSM_E_INVALIDXML
38         , SSM_E_NOINTERFACE
39         , SSM_E_NOTIMPL
40     };
41
42     /**
43     * @class    IModelData
44     * @brief    This class represents context model data package
45     *
46     * @see
47     */
48     class IModelData
49     {
50         public:
51             /**
52             * @fn     getDataId
53             * @brief Get affected DataId. ContextModel has plenty of data so \n
54             *         returned data is matched from given condition
55             *
56             * @param None
57             *
58             * @return int
59             * @warning
60             * @exception
61             * @see
62             */
63             virtual int getDataId() = 0;
64
65             /**
66             * @fn     GetPropertyCount
67             * @brief ContextModel has at least one property that contains data \n
68             *         property is described from its specification.
69             *
70             * @param None
71             *
72             * @return int
73             * @warning
74             * @exception
75             * @see
76             */
77             virtual int getPropertyCount() = 0;
78
79             /**
80             * @fn     getPropertyName
81             * @brief Retrieve propertyName
82             *
83             * @param [in] int propertyIndex - index of property to read
84             *
85             * @return std::string
86             * @warning
87             * @exception
88             * @see
89             */
90             virtual std::string getPropertyName(int propertyIndex) = 0;
91
92             /**
93             * @fn     getPropertyValue
94             * @brief Retrieve propertyValue
95             *
96             * @param [in] int propertyIndex - index of property to read
97             *
98             * @return std::string
99             * @warning
100             * @exception
101             * @see
102             */
103             virtual std::string getPropertyValue(int propertyIndex) = 0;
104
105             /**
106             * @fn     getPropertyValueByName
107             * @brief Retrieve propertyValue using given name
108             *
109             * @param [in] std::string propertyName - property name looking for
110             *
111             * @return std::string
112             * @warning
113             * @exception
114             * @see
115             */
116             virtual std::string getPropertyValueByName(std::string propertyName) = 0;
117         protected:
118             virtual ~IModelData() {};
119     };
120
121     /**
122     * @class    IDataReader
123     * @brief    This class represents context model data package's reader
124     *
125     * @see
126     */
127     class IDataReader
128     {
129         public:
130             /**
131             * @fn     getAffectedModels
132             * @brief Get affected ContextModels. The CQL can specify multiple ContextModels for retrieving data.
133             *
134             * @param [in, out] std::vector<std::string> *pAffectedModels - affected ContextModel list
135             *
136             * @return SSMRESULT
137             * @warning
138             * @exception
139             * @see
140             */
141             virtual SSMRESULT getAffectedModels(std::vector<std::string> *pAffectedModels) = 0;
142
143             /**
144             * @fn     getModelDataCount
145             * @brief Get affected data count. There are multiple data can exist from given condition.
146             *
147             * @param [in] std::string modelName - affected ContextModel name
148             *
149             * @param [in, out] int *pDataCount - affected dataId count
150             *
151             * @return SSMRESULT
152             * @warning
153             * @exception
154             * @see
155             */
156             virtual SSMRESULT getModelDataCount(std::string modelName, int *pDataCount) = 0;
157
158             /**
159             * @fn     getModelData
160             * @brief Get actual Context Model data
161             *
162             * @param [in] std::string modelName - affected ContextModel name
163             *
164             *
165             * @param [in] int dataIndex - affected dataId index
166             *
167             *
168             * @param [out] IModelData **ppModelData - affected ContextModel data reader
169             *
170             * @return SSMRESULT
171             * @warning
172             * @exception
173             * @see
174             */
175             virtual SSMRESULT getModelData(std::string modelName, int dataIndex, IModelData **ppModelData) = 0;
176         protected:
177             virtual ~IDataReader() {};
178     };
179
180     /**
181     * @class    IQueryEngineEvent
182     * @brief    This class represents Query Engine's event that contains results
183     *
184     * @see
185     */
186     class IQueryEngineEvent
187     {
188         public:
189             /**
190             * @fn     onQueryEngineEvent
191             * @brief Transmit result of SSMCore to Application layer
192             *
193             * @param [in] int cqid - entered ContextQuery ID
194             *
195             * @param [in] IDataReader *pResult - result of SSMCore
196             *
197             * @return SSMRESULT
198             * @warning
199             * @exception
200             * @see
201             */
202             virtual SSMRESULT onQueryEngineEvent(int cqid, IDataReader *pResult) = 0;
203         protected:
204             virtual ~IQueryEngineEvent() {};
205     };
206
207     /**
208     * @fn    InitializeSSM
209     * @brief Initialize Soft sensor manager using given configuration information.
210     *
211     * @param [in] std::string xmlDescription - specification described in XML
212     *
213     * @return SSMRESULT
214     * @warning
215     * @exception
216     * @see
217     */
218     SSMRESULT InitializeSSM(std::string xmlDescription);
219
220     /**
221     * @fn    TerminateSSM
222     * @brief Terminates Soft sensor manager
223     *
224     * @param None
225     *
226     * @return SSMRESULT
227     * @warning
228     * @exception
229     * @see
230     */
231     SSMRESULT TerminateSSM();
232
233     /**
234     * @fn     RegisterQuery
235     * @brief Execute ContextQuery and return ContextQuery ID
236     *
237     * @param [in] std::string queryString - query for requesting data
238     *
239     * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
240     *
241     * @param [in, out] int &cqid - ID of ContextQuery
242     *
243     * @return SSMRESULT
244     * @warning
245     * @exception
246     * @see
247     */
248     SSMRESULT RegisterQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
249
250     /**
251     * @fn    UnregisterQuery
252     * @brief unregister registered ContextQuery according to cqid
253     *
254     * @param [in] int cqid - Context query corresponding to the cqid will be terminated
255     *
256     * @return SSMRESULT
257     * @warning
258     * @exception
259     * @see
260     */
261     SSMRESULT UnregisterQuery(int cqid);
262 }
263 #endif