Corrected @file tags and restored 'Files' section.
[platform/upstream/iotivity.git] / resource / include / OCResourceResponse.h
index ee660e3..4835235 100644 (file)
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-/// @file OCResourceResponse.h
-
-/// @brief  This file contains the declaration of classes and its members related to
-///         ResourceResponse.
+/**
+ * @file
+ *
+ * This file contains the declaration of classes and its members related to
+ * ResourceResponse.
+ */
 
 #ifndef __OCRESOURCERESPONSE_H
 #define __OCRESOURCERESPONSE_H
 
 using namespace std;
 
-
-void (processResourceResponse)(OCEntityHandlerFlag,
-                                 OCEntityHandlerRequest*,
-                                 std::shared_ptr<OC::OCResourceResponse> pResponse);
-
-
 namespace OC
 {
+    class InProcServerWrapper;
+
     /**
     *   @brief  OCResourceResponse provides APIs to set the response details
     */
@@ -49,9 +47,20 @@ namespace OC
     public:
         typedef std::shared_ptr<OCResourceResponse> Ptr;
 
-        OCResourceResponse()
-        {}
+        OCResourceResponse():
+            m_newResourceUri{},
+            m_errorCode{},
+            m_headerOptions{},
+            m_interface{},
+            m_representation{},
+            m_requestHandle{nullptr},
+            m_resourceHandle{nullptr},
+            m_responseResult{}
+        {
+        }
 
+        OCResourceResponse(OCResourceResponse&&) = default;
+        OCResourceResponse& operator=(OCResourceResponse&&) = default;
         virtual ~OCResourceResponse(void) {}
 
         /**
@@ -88,9 +97,38 @@ namespace OC
         }
 
         /**
+        * This API allows to set request handle
+        *
+        * @param requestHandle - OCRequestHandle type used to set the request handle
+        */
+        void setRequestHandle(const OCRequestHandle& requestHandle)
+        {
+            m_requestHandle = requestHandle;
+        }
+
+        /**
+        * This API allows to set the resource handle
+        *
+        * @param resourceHandle - OCResourceHandle type used to set the resource handle
+        */
+        void setResourceHandle(const OCResourceHandle& resourceHandle)
+        {
+            m_resourceHandle = resourceHandle;
+        }
+
+        /**
+        * This API allows to set the EntityHandler response result
+        *
+        * @param responseResult - OCEntityHandlerResult type to set the result value
+        */
+        void setResponseResult(const OCEntityHandlerResult& responseResult)
+        {
+            m_responseResult = responseResult;
+        }
+
+        /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap reference containing the name value pairs representing
-        *         the resource's attributes
+        *  @param rep reference to the resource's representation
         *  @param interface specifies the interface
         */
         void setResourceRepresentation(OCRepresentation& rep, std::string interface) {
@@ -100,8 +138,7 @@ namespace OC
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap rvalue reference containing the name value pairs representing
-        *         the resource's attributes
+        *  @param rep rvalue reference to the resource's representation
         *  @param interface specifies the interface
         */
         void setResourceRepresentation(OCRepresentation&& rep, std::string interface) {
@@ -110,8 +147,7 @@ namespace OC
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap reference containing the name value pairs representing the resource's
-        *  attributes
+        *  @param rep reference to the resource's representation
         */
         void setResourceRepresentation(OCRepresentation& rep) {
             // Call the default
@@ -121,8 +157,7 @@ namespace OC
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap rvalue reference containing the name value pairs representing the
-        *  resource's attributes
+        *  @param rep rvalue reference to the resource's representation
         */
         void setResourceRepresentation(OCRepresentation&& rep) {
             // Call the above function
@@ -134,10 +169,13 @@ namespace OC
         HeaderOptions m_headerOptions;
         std::string m_interface;
         OCRepresentation m_representation;
+        OCRequestHandle m_requestHandle;
+        OCResourceHandle m_resourceHandle;
+        OCEntityHandlerResult m_responseResult;
+
     private:
-        friend void (::processResourceResponse)(OCEntityHandlerFlag,
-                            OCEntityHandlerRequest*,
-                            std::shared_ptr<OC::OCResourceResponse> pResponse);
+        friend class InProcServerWrapper;
+
         std::string getPayload() const
         {
             MessageContainer inf;
@@ -202,6 +240,36 @@ namespace OC
         {
             return m_headerOptions;
         }
+
+        /**
+        * This API retrieves the request handle
+        *
+        * @return OCRequestHandle value
+        */
+        const OCRequestHandle& getRequestHandle() const
+        {
+            return m_requestHandle;
+        }
+
+        /**
+        * This API retrieves the resource handle
+        *
+        * @return OCResourceHandle value
+        */
+        const OCResourceHandle& getResourceHandle() const
+        {
+            return m_resourceHandle;
+        }
+
+        /**
+        * This API retrieves the entity handle response result
+        *
+        * @return OCEntityHandler result value
+        */
+        const OCEntityHandlerResult getResponseResult() const
+        {
+            return m_responseResult;
+        }
     };
 
 } // namespace OC