CAF 0.17.6
Loading...
Searching...
No Matches
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
behavior & operator= (behavior &&)=default
behavior & operator= (const behavior &)=default
 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).
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.
const durationtimeout () const
 Returns the duration after which receive operations using this behavior should time out.
optional< messageoperator() (message &xs)
 Runs this handler and returns its (optional) result.
optional< messageoperator() (type_erased_tuple &xs)
match_case::result operator() (detail::invoke_result_visitor &f, type_erased_tuple &xs)
 Runs this handler with callback.
match_case::result 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.

Examples
dancing_kirby.cpp, and hello_world.cpp.

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