C++ Actor Framework  0.18
Public Types | Public Member Functions | Friends | List of all members
caf::typed_response_promise< Ts > Class Template Reference

Enables statically typed actors to delay a response message by capturing the context of a request message. More...

#include <typed_response_promise.hpp>

Collaboration diagram for caf::typed_response_promise< Ts >:
Collaboration graph

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_promiseoperator= (typed_response_promise &&)=default
 
typed_response_promiseoperator= (const typed_response_promise &)=default
 
 typed_response_promise (none_t x)
 
bool async () const
 Returns whether this response promise replies to an asynchronous message. More...
 
bool pending () const
 Queries whether this promise is a valid promise that is not satisfied yet. More...
 
strong_actor_ptr source () const
 Returns the source of the corresponding request. More...
 
forwarding_stack stages () const
 Returns the remaining stages for the corresponding request. More...
 
strong_actor_ptr next () const
 Returns the actor that will receive the response, i.e., stages().front() if !stages().empty() or source() otherwise. More...
 
message_id id () const
 Returns the message ID of the corresponding request. More...
 
 operator response_promise & ()
 
template<class... Us>
std::enable_if_t<(std::is_constructible< Ts, Us >::value &&...)> 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< L, detail::type_list< void > >::value > deliver ()
 Satisfies the promise by sending an empty response message.
 
void deliver (error x)
 Satisfies the promise by sending an error response message. More...
 
template<class T >
std::enable_if_t< std::is_same< detail::type_list< T >, detail::type_list< Ts... > >::value > deliver (expected< T > x)
 Satisfies the promise by sending either an error or a non-error response message. More...
 
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
 

Detailed Description

template<class... Ts>
class caf::typed_response_promise< Ts >

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.

Member Function Documentation

◆ async()

template<class... Ts>
bool caf::typed_response_promise< Ts >::async ( ) const

Returns whether this response promise replies to an asynchronous message.

◆ deliver() [1/2]

template<class... Ts>
void caf::typed_response_promise< Ts >::deliver ( error  x)

Satisfies the promise by sending an error response message.

For non-requests, nothing is done.

◆ deliver() [2/2]

template<class... Ts>
template<class T >
std::enable_if_t< std::is_same<detail::type_list<T>, detail::type_list<Ts...> >::value> caf::typed_response_promise< Ts >::deliver ( expected< T >  x)

Satisfies the promise by sending either an error or a non-error response message.

◆ id()

template<class... Ts>
message_id caf::typed_response_promise< Ts >::id ( ) const

Returns the message ID of the corresponding request.

◆ next()

template<class... Ts>
strong_actor_ptr caf::typed_response_promise< Ts >::next ( ) const

Returns the actor that will receive the response, i.e., stages().front() if !stages().empty() or source() otherwise.

◆ pending()

template<class... Ts>
bool caf::typed_response_promise< Ts >::pending ( ) const

Queries whether this promise is a valid promise that is not satisfied yet.

◆ source()

template<class... Ts>
strong_actor_ptr caf::typed_response_promise< Ts >::source ( ) const

Returns the source of the corresponding request.

◆ stages()

template<class... Ts>
forwarding_stack caf::typed_response_promise< Ts >::stages ( ) const

Returns the remaining stages for the corresponding request.


The documentation for this class was generated from the following files: