C++ Actor Framework 0.19
|
Enables statically typed actors to delay a response message by capturing the context of a request message. More...
#include <typed_response_promise.hpp>
Public Types | |
using | forwarding_stack = response_promise::forwarding_stack |
Public Member Functions | |
typed_response_promise (typed_response_promise &&)=default | |
typed_response_promise (const typed_response_promise &)=default | |
typed_response_promise & | operator= (typed_response_promise &&)=default |
typed_response_promise & | operator= (const typed_response_promise &)=default |
bool | async () const |
Returns whether this response promise replies to an asynchronous message. | |
bool | pending () const |
Queries whether this promise is a valid promise that is not satisfied yet. | |
strong_actor_ptr | source () const |
Returns the source of the corresponding request. | |
forwarding_stack | stages () const |
Returns the remaining stages for the corresponding request. | |
strong_actor_ptr | next () const |
Returns the actor that will receive the response, i.e., stages().front() if !stages().empty() or source() otherwise. | |
message_id | id () const |
Returns the message ID of the corresponding request. | |
template<class... Us> | |
std::enable_if_t<(std::is_constructible_v< Ts, Us > &&...)> | deliver (Us... xs) |
Satisfies the promise by sending a non-error response message. | |
template<class L = detail::type_list<Ts...>> | |
std::enable_if_t< std::is_same_v< L, detail::type_list< void > > > | deliver () |
Satisfies the promise by sending an empty response message. | |
void | deliver (error x) |
Satisfies the promise by sending an error response message. | |
template<class T > | |
std::enable_if_t< std::is_same_v< detail::type_list< T >, detail::type_list< Ts... > > > | deliver (expected< T > x) |
Satisfies the promise by sending either an error or a non-error response message. | |
template<message_priority P = message_priority::normal, class Handle = actor, class... Us> | |
auto | delegate (const Handle &dest, Us &&... xs) |
Satisfies the promise by delegating to another actor. | |
Friends | |
class | local_actor |
Enables statically typed actors to delay a response message by capturing the context of a request message.
This is particularly useful when an actor needs to communicate to other actors in order to fulfill a request for a client.
bool caf::typed_response_promise< Ts >::async | ( | ) | const |
Returns whether this response promise replies to an asynchronous message.
void caf::typed_response_promise< Ts >::deliver | ( | error | x | ) |
Satisfies the promise by sending an error response message.
For non-requests, nothing is done.
message_id caf::typed_response_promise< Ts >::id | ( | ) | const |
Returns the message ID of the corresponding request.
strong_actor_ptr caf::typed_response_promise< Ts >::next | ( | ) | const |
bool caf::typed_response_promise< Ts >::pending | ( | ) | const |
Queries whether this promise is a valid promise that is not satisfied yet.
strong_actor_ptr caf::typed_response_promise< Ts >::source | ( | ) | const |
Returns the source of the corresponding request.
forwarding_stack caf::typed_response_promise< Ts >::stages | ( | ) | const |
Returns the remaining stages for the corresponding request.