actor-framework
Public Member Functions | List of all members
caf::event_based_mtl< Self, Adapter, Reader > Class Template Reference

Enables event-based actors to generate messages from a user-defined data exchange format such as JSON and to send the generated messages to another (typed) actor. More...

#include <mtl.hpp>

Public Member Functions

 event_based_mtl (Self *self, Adapter adapter, Reader *reader) noexcept
 
 event_based_mtl (const event_based_mtl &) noexcept=default
 
event_based_mtloperator= (const event_based_mtl &) noexcept=default
 
auto self ()
 
auto & adapter ()
 
auto & reader ()
 
template<class... Fs>
bool try_send (const typed_actor< Fs... > &dst)
 Tries to get a message from the reader that matches any of the accepted inputs of dst and sends the converted messages on success. More...
 
template<class... Fs, class Timeout , class OnResult , class OnError >
bool try_request (const typed_actor< Fs... > &dst, Timeout timeout, OnResult on_result, OnError on_error)
 Tries to get a message from the reader that matches any of the accepted inputs of dst and sends a request message to dst on success. More...
 

Detailed Description

template<class Self, class Adapter, class Reader>
class caf::event_based_mtl< Self, Adapter, Reader >

Enables event-based actors to generate messages from a user-defined data exchange format such as JSON and to send the generated messages to another (typed) actor.

Member Function Documentation

◆ try_request()

template<class Self , class Adapter , class Reader >
template<class... Fs, class Timeout , class OnResult , class OnError >
bool caf::event_based_mtl< Self, Adapter, Reader >::try_request ( const typed_actor< Fs... > &  dst,
Timeout  timeout,
OnResult  on_result,
OnError  on_error 
)
inline

Tries to get a message from the reader that matches any of the accepted inputs of dst and sends a request message to dst on success.

Parameters
dstThe destination for the next message.
timeoutThe relative timeout for the request message.
on_resultThe one-shot handler for the response message. This function object must accept all possible response types from dst.
on_errorThe one-shot handler for timeout and other errors.
Returns
true if the adapter was able to generate and send a message, false otherwise.

◆ try_send()

template<class Self , class Adapter , class Reader >
template<class... Fs>
bool caf::event_based_mtl< Self, Adapter, Reader >::try_send ( const typed_actor< Fs... > &  dst)
inline

Tries to get a message from the reader that matches any of the accepted inputs of dst and sends the converted messages on success.

Parameters
dstThe destination for the next message.
Returns
true if the adapter was able to generate and send a message, false otherwise.

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