C++ Actor Framework 0.19
Loading...
Searching...
No Matches
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>

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
 
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
 

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()

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.

◆ 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: