libcaf  0.15.3
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 (const message_handler &mh)
 Creates a behavior from fun without timeout.
 
template<class T , class... Ts>
 behavior (const T &x, const 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 (const 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. More...
 
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:
dining_philosophers.cpp, and hello_world.cpp.

Constructor & Destructor Documentation

template<class T , class... Ts>
caf::behavior::behavior ( const T &  x,
const 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).

Member Function Documentation

const duration& caf::behavior::timeout ( ) const

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


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