Imported Upstream version 0.9.1
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SSMCore / include / SSMInterface.h
index 0085b3b..866d578 100644 (file)
@@ -1,3 +1,29 @@
+/******************************************************************
+*
+* Copyright 2014 Samsung Electronics All Rights Reserved.
+*
+*
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+******************************************************************/
+
+/**
+* @file
+*
+* This file defines basic interface of Soft Sensor Manager.
+*/
+
 #ifndef _SSMInterface_H_
 #define _SSMInterface_H_
 
@@ -13,6 +39,9 @@ namespace OIC
         , SSM_E_POINTER
         , SSM_E_OUTOFMEMORY
         , SSM_E_FAIL
+        , SSM_E_NOTINIT
+        , SSM_E_INITIALIZED
+        , SSM_E_INVALIDXML
         , SSM_E_NOINTERFACE
         , SSM_E_NOTIMPL
     };
@@ -21,75 +50,50 @@ namespace OIC
     * @class    IModelData
     * @brief    This class represents context model data package
     *
-    * @see
     */
     class IModelData
     {
         public:
             /**
-            * @fn     getDataId
-            * @brief Get affected DataId. ContextModel has plenty of data so \n
+            * Get affected DataId. ContextModel has plenty of data so \n
             *         returned data is matched from given condition
             *
-            * @param None
-            *
-            * @return int
-            * @warning
-            * @exception
-            * @see
+            * @return int - the affected DataId
             */
             virtual int getDataId() = 0;
 
             /**
-            * @fn     GetPropertyCount
-            * @brief ContextModel has at least one property that contains data \n
+            * ContextModel has at least one property that contains data \n
             *         property is described from its specification.
             *
-            * @param None
-            *
-            * @return int
-            * @warning
-            * @exception
-            * @see
+            * @return int - number of properties
             */
             virtual int getPropertyCount() = 0;
 
             /**
-            * @fn     getPropertyName
-            * @brief Retrieve propertyName
+            * Retrieve propertyName
             *
-            * @param [in] int propertyIndex - index of property to read
+            * @param propertyIndex - index of property to read
             *
-            * @return std::string
-            * @warning
-            * @exception
-            * @see
+            * @return std::string - property name
             */
             virtual std::string getPropertyName(int propertyIndex) = 0;
 
             /**
-            * @fn     getPropertyValue
-            * @brief Retrieve propertyValue
+            * Retrieve propertyValue
             *
-            * @param [in] int propertyIndex - index of property to read
+            * @param propertyIndex index of property to read
             *
-            * @return std::string
-            * @warning
-            * @exception
-            * @see
+            * @return std::string - property value
             */
             virtual std::string getPropertyValue(int propertyIndex) = 0;
 
             /**
-            * @fn     getPropertyValueByName
-            * @brief Retrieve propertyValue using given name
+            * Retrieve propertyValue using given name
             *
-            * @param [in] std::string propertyName - property name looking for
+            * @param propertyName - property name looking for
             *
-            * @return std::string
-            * @warning
-            * @exception
-            * @see
+            * @return std::string - property name
             */
             virtual std::string getPropertyValueByName(std::string propertyName) = 0;
         protected:
@@ -106,49 +110,35 @@ namespace OIC
     {
         public:
             /**
-            * @fn     getAffectedModels
-            * @brief Get affected ContextModels. The CQL can specify multiple ContextModels for retrieving data.
+            * Get affected ContextModels. The query can specify multiple ContextModels for retrieving data.
             *
-            * @param [in, out] std::vector<std::string> *pAffectedModels - affected ContextModel list
+            * @param pAffectedModels - affected ContextModel list
             *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
+            * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
             */
             virtual SSMRESULT getAffectedModels(std::vector<std::string> *pAffectedModels) = 0;
 
             /**
-            * @fn     getModelDataCount
-            * @brief Get affected data count. There are multiple data can exist from given condition.
+            * Get affected data count. There are multiple data can exist from given condition.
             *
-            * @param [in] std::string modelName - affected ContextModel name
+            * @param modelName - affected ContextModel name
             *
-            * @param [in, out] int *pDataCount - affected dataId count
+            * @param pDataCount - affected dataId count
             *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
+            * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
             */
             virtual SSMRESULT getModelDataCount(std::string modelName, int *pDataCount) = 0;
 
             /**
-            * @fn     getModelData
-            * @brief Get actual Context Model data
+            * Get actual Context Model data
             *
-            * @param [in] std::string modelName - affected ContextModel name
+            * @param modelName - affected ContextModel name
             *
+            * @param dataIndex - affected dataId index
             *
-            * @param [in] int dataIndex - affected dataId index
+            * @param ppModelData - affected ContextModel data reader
             *
-            *
-            * @param [out] IModelData **ppModelData - affected ContextModel data reader
-            *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
+            * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
             */
             virtual SSMRESULT getModelData(std::string modelName, int dataIndex, IModelData **ppModelData) = 0;
         protected:
@@ -165,17 +155,13 @@ namespace OIC
     {
         public:
             /**
-            * @fn     onQueryEngineEvent
-            * @brief Transmit result of SSMCore to Application layer
+            * Transmit result of SSMCore to Application layer
             *
-            * @param [in] int cqid - entered ContextQuery ID
+            * @param cqid - entered ContextQuery ID
             *
-            * @param [in] IDataReader *pResult - result of SSMCore
+            * @param pResult - result of SSMCore
             *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
+            * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
             */
             virtual SSMRESULT onQueryEngineEvent(int cqid, IDataReader *pResult) = 0;
         protected:
@@ -183,47 +169,41 @@ namespace OIC
     };
 
     /**
-    * @class    SSMInterface
-    * @brief    This class represents main class for querying Soft Sensors
+    * Initialize Soft sensor manager using given configuration information.
     *
-    * @see
+    * @param xmlDescription - specification described in XML
+    *
+    * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
     */
-    class SSMInterface
-    {
-        public:
-            SSMInterface();
-            ~SSMInterface();
+    SSMRESULT InitializeSSM(std::string xmlDescription);
 
-            /**
-            * @fn     registerQuery
-            * @brief Execute ContextQuery and return ContextQuery ID
-            *
-            * @param [in] std::string queryString - query for requesting data
-            *
-            * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
-            *
-            * @param [in, out] int &cqid - ID of ContextQuery
-            *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
-            */
-            SSMRESULT registerQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
+    /**
+    * Terminates Soft sensor manager
+    *
+    * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
+    */
+    SSMRESULT TerminateSSM();
 
-            /**
-            * @fn    unregisterQuery
-            * @brief unregister registered ContextQuery according to cqid
-            *
-            * @param [in] int cqid - Context query corresponding to the cqid will be terminated
-            *
-            * @return SSMRESULT
-            * @warning
-            * @exception
-            * @see
-            */
-            SSMRESULT unregisterQuery(int cqid);
-    };
+    /**
+    * Execute query and return ContextQuery ID
+    *
+    * @param queryString - query for requesting data
+    *
+    * @param listener - listener for receiving data related to query
+    *
+    * @param cqid - ID of ContextQuery
+    *
+    * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
+    */
+    SSMRESULT RegisterQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
 
+    /**
+    * Unregister registered query according to cqid
+    *
+    * @param cqid - Query corresponding to the cqid will be terminated
+    *
+    * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
+    */
+    SSMRESULT UnregisterQuery(int cqid);
 }
 #endif
\ No newline at end of file