libcaf  0.13.2
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 &fun)
 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 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 &arg)
 Runs this handler and returns its (optional) result.
 
 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 ( 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).

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: