//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-/// @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
*/
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) {}
/**
}
/**
+ * 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) {
/**
* 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) {
/**
* 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
/**
* 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
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;
{
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