actor-framework
Public Member Functions | Friends | List of all members
caf::behavior Class Reference

Describes the behavior of an actor, i.e., provides a message handler and an optional timeout. More...

#include <behavior.hpp>

Public Member Functions

 behavior (behavior &&)=default
 
 behavior (const behavior &)=default
 
behavioroperator= (behavior &&)=default
 
behavioroperator= (const behavior &)=default
 
 behavior (unsafe_behavior_init_t, behavior from)
 
 behavior (const message_handler &mh)
 Creates a behavior from fun without timeout.
 
template<class T , class... Ts>
 behavior (T x, Ts &&... xs)
 The list of arguments can contain match expressions, message handlers, and up to one timeout (if set, the timeout has to be the last argument). More...
 
template<class F >
 behavior (timeout_definition< F > tdef)
 Creates a behavior from tdef without message handler.
 
template<class... Ts>
void assign (Ts &&... xs)
 Assigns new handlers.
 
void swap (behavior &other)
 
void assign (intrusive_ptr< detail::behavior_impl > ptr)
 
void assign (message_handler other)
 Equal to *this = other.
 
void assign (behavior other)
 Equal to *this = other.
 
void handle_timeout ()
 Invokes the timeout callback if set.
 
timespan timeout () const noexcept
 Returns the timespan after which receive operations using this behavior should time out. More...
 
std::optional< messageoperator() (message &xs)
 Runs this handler and returns its (optional) result.
 
bool operator() (detail::invoke_result_visitor &f, message &xs)
 Runs this handler with callback.
 
 operator bool () const
 Checks whether this behavior is not empty.
 

Friends

class message_handler
 

Detailed Description

Describes the behavior of an actor, i.e., provides a message handler and an optional timeout.

Constructor & Destructor Documentation

◆ behavior()

template<class T , class... Ts>
caf::behavior::behavior ( x,
Ts &&...  xs 
)
inline

The list of arguments can contain match expressions, message handlers, and up to one timeout (if set, the timeout has to be the last argument).

Member Function Documentation

◆ timeout()

timespan caf::behavior::timeout ( ) const
inlinenoexcept

Returns the timespan after which receive operations using this behavior should time out.


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