actor-framework
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 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. 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...
 
message_id id () const
 Returns the message ID of the corresponding request. More...
 
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. More...
 
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. 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
inline

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

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_v<type_list<T>, type_list<Ts...> > > caf::typed_response_promise< Ts >::deliver ( expected< T >  x)
inline

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
inline

Returns the message ID of the corresponding request.

◆ pending()

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

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
inline

Returns the source of the corresponding request.


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