C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
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 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.
 
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 = type_list<Ts...>>
std::enable_if_t< std::is_same_v< L, 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< type_list< T >, 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.

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


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