rotor
Event loop friendly C++ actor micro-framework
 
Loading...
Searching...
No Matches
rotor::wrapped_response_t< Request > Struct Template Reference

trackable templated response which holds user-supplied response payload. More...

#include <request.hpp>

Public Types

using request_t = typename request_unwrapper_t< Request >::request_t
 alias for original user-supplied request type
 
using req_message_t = message_t< wrapped_request_t< request_t > >
 alias type of message with wrapped request, which is possibly wrapped into intrusive pointer
 
using req_message_ptr_t = intrusive_ptr_t< req_message_t >
 alias for intrusive pointer to message with wrapped request
 
using response_t = typename request_t::response_t
 alias for possibly wrapped user-supplied response type
 
using res_helper_t = response_helper_t< response_t >
 helper type for response construction
 
using unwrapped_response_t = typename res_helper_t::response_t
 alias user-supplied response type
 

Public Member Functions

 wrapped_response_t (const extended_error_ptr_t &ee_, req_message_ptr_t message_)
 error-response constructor (response payload is empty)
 
template<typename Response , typename E = std::enable_if_t<std::is_same_v<response_t, std::remove_cv_t<Response>>>>
 wrapped_response_t (req_message_ptr_t message_, const extended_error_ptr_t &ee_, Response &&res_)
 "forward-constructor"
 
template<typename Req , typename... Args, typename E1 = std::enable_if_t<std::is_same_v<req_message_ptr_t, std::remove_cv_t<Req>>>, typename E2 = std::enable_if_t<details::is_constructible_v<unwrapped_response_t, Args...>>>
 wrapped_response_t (Req &&message_, Args &&...args)
 successful-response constructor.
 
request_id_t request_id () const noexcept
 returns request id of the original request
 

Public Attributes

extended_error_ptr_t ee
 pointer to extended error, used in the case of response failure
 
req_message_ptr_t req
 original request message, which contains request_id for request/response matching
 
response_t res
 user-supplied response payload
 

Detailed Description

template<typename Request>
struct rotor::wrapped_response_t< Request >

trackable templated response which holds user-supplied response payload.

In addition to user-supplied response payload, the class contains error_code and intrusive pointer to the original request message.

Constructor & Destructor Documentation

◆ wrapped_response_t() [1/2]

template<typename Request >
template<typename Response , typename E = std::enable_if_t<std::is_same_v<response_t, std::remove_cv_t<Response>>>>
rotor::wrapped_response_t< Request >::wrapped_response_t ( req_message_ptr_t  message_,
const extended_error_ptr_t ee_,
Response &&  res_ 
)
inline

"forward-constructor"

The request message, error code are copied, while the response (possible intrusive pointer to the original request) is forwarded.

◆ wrapped_response_t() [2/2]

template<typename Request >
template<typename Req , typename... Args, typename E1 = std::enable_if_t<std::is_same_v<req_message_ptr_t, std::remove_cv_t<Req>>>, typename E2 = std::enable_if_t<details::is_constructible_v<unwrapped_response_t, Args...>>>
rotor::wrapped_response_t< Request >::wrapped_response_t ( Req &&  message_,
Args &&...  args 
)
inline

successful-response constructor.

The request message is copied, the error code is set to success, the response (possible intrusive pointer to the original request) constructed from the arguments.


The documentation for this struct was generated from the following file: