libcaf  0.14.4
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
caf Namespace Reference

Root namespace of libcaf. More...

Namespaces

 exit_reason
 Contains all predefined exit reasons.
 
 io
 Contains all IO-related classes and functions.
 
 mixin
 Contains mixin classes implementing several actor traits.
 
 policy
 Contains policies encapsulating characteristics or algorithms.
 

Classes

class  abstract_actor
 Base class for all actor implementations. More...
 
class  abstract_channel
 Interface for all message receivers. More...
 
class  abstract_event_based_actor
 Base type for statically and dynamically typed event-based actors. More...
 
class  abstract_group
 A multicast group. More...
 
class  abstract_uniform_type_info
 Implements all pure virtual functions of uniform_type_info except serialize() and deserialize(). More...
 
class  actor
 Identifies an untyped actor. More...
 
class  actor_addr
 Stores the address of typed as well as untyped actors. More...
 
class  actor_companion
 An co-existing forwarding all messages through a user-defined callback to another object, thus serving as gateway to allow any object to interact with other actors. More...
 
class  actor_exited
 Thrown if an actor finished execution. More...
 
class  actor_namespace
 Groups a (distributed) set of actors and allows actors in the same namespace to exchange messages. More...
 
class  actor_ostream
 Provides support for thread-safe output operations on character streams. More...
 
class  actor_pool
 An actor poool is a lightweight abstraction for a set of workers. More...
 
class  actor_proxy
 Represents an actor running on a remote machine, or different hardware, or in a separate process. More...
 
class  advanced_match_case_impl
 
struct  anything
 Acts as wildcard expression in patterns. More...
 
struct  atom_constant
 Lifts an atom_value to a compile-time constant. More...
 
class  attachable
 Callback utility class. More...
 
class  behavior
 Describes the behavior of an actor, i.e., provides a message handler and an optional timeout. More...
 
class  binary_deserializer
 Implements the deserializer interface with a binary serialization protocol. More...
 
class  binary_serializer
 Implements the serializer interface with a binary serialization protocol. More...
 
class  bind_failure
 Thrown to indicate that an actor publishing failed because the requested port could not be used. More...
 
class  blocking_actor
 A thread-mapped or context-switching actor using a blocking receive rather than a behavior-stack based message processing. More...
 
struct  blocking_response_handle_tag
 This tag identifies response handles featuring a blocking API by providing an await member function. More...
 
class  caf_exception
 Base class for exceptions. More...
 
class  callback
 Describes a simple callback, usually implemented via lambda expression. More...
 
class  callback_impl
 Utility class for wrapping a function object of type Base. More...
 
class  channel
 A handle to instances of abstract_channel. More...
 
class  continue_helper
 Helper class to enable users to add continuations when dealing with synchronous sends. More...
 
struct  delegated
 Helper class to indicate that a request has been forwarded. More...
 
class  deserializer
 Technology-independent deserialization interface. More...
 
struct  down_msg
 Sent to all actors monitoring an actor when it is terminated. More...
 
class  duration
 Time duration consisting of a time_unit and a 64 bit unsigned integer. More...
 
class  event_based_actor
 A cooperatively scheduled, event-based actor implementation. More...
 
class  execution_unit
 Identifies an execution unit, e.g., a worker thread of the scheduler. More...
 
struct  exit_msg
 Sent to all links when an actor is terminated. More...
 
struct  extend
 Allows convenient definition of types using mixins. More...
 
class  forwarding_actor_proxy
 Implements a simple proxy forwarding all operations to a manager. More...
 
struct  group_down_msg
 Sent to all members of a group when it goes offline. More...
 
class  handle
 Base class for IO handles such as accept_handle or connection_handle. More...
 
struct  illegal_message_element
 Marker class identifying classes in CAF that are not allowed to be used as message element. More...
 
class  intrusive_ptr
 An intrusive, reference counting smart pointer impelementation. More...
 
struct  invalid_node_id_t
 Objects of this type identify an invalid node_id. More...
 
struct  is_anything
 
struct  is_same_ish
 Compares T to U und evaluates to true_type if either `T == U or if T and U are both integral types of the same size and signedness. More...
 
class  local_actor
 Base class for actors running on this node, either living in an own thread or cooperatively scheduled. More...
 
class  maybe
 Represents a computation returning either T or std::error_condition. More...
 
class  memory_managed
 This base enables derived classes to enforce a different allocation strategy than new/delete by providing a virtual protected request_deletion() function and non-public destructor. More...
 
class  message
 Describes a fixed-length, copy-on-write, type-erased tuple with elements of any type. More...
 
class  message_builder
 Provides a convenient interface for createing message objects from a series of values using the member function append. More...
 
class  message_handler
 A partial function implementation used to process a message. More...
 
class  message_id
 Denotes whether a message is asynchronous or synchronous. More...
 
class  network_error
 Thrown to indicate that either an actor publishing failed or the middleman was unable to connect to a remote host. More...
 
class  node_id
 A node ID consists of a host ID and process ID. More...
 
struct  nonblocking_response_handle_tag
 This tag identifies response handles featuring a nonblocking API by providing a then member function. More...
 
struct  ratio_to_time_unit_helper
 Converts the ratio Num/Denom to a time_unit if the ratio describes seconds, milliseconds, microseconds, or minutes. More...
 
class  ref_counted
 Base class for reference counted objects with an atomic reference count. More...
 
class  response_handle
 This helper class identifies an expected response message and enables sync_send(...).then(...). More...
 
class  response_promise
 A response promise can be used to deliver a uniquely identifiable response message from the server (i.e. More...
 
class  resumable
 A cooperatively executed task managed by one or more instances of execution_unit. More...
 
class  scoped_actor
 A scoped handle to a blocking actor. More...
 
struct  select_callback
 Utility class for selecting a callback_impl. More...
 
class  serializer
 Technology-independent serialization interface. More...
 
struct  skip_message_t
 Optional return type for functors used in pattern matching expressions. More...
 
class  spawn_options
 Stores options passed to the spawn function family. More...
 
class  stateful_actor
 An event-based actor with managed state. More...
 
struct  sync_exited_msg
 Sent whenever a terminated actor receives a synchronous request. More...
 
struct  sync_timeout_msg
 Sent whenever a timeout occurs during a synchronous send. More...
 
struct  timeout_msg
 Signalizes a timeout event. More...
 
class  typed_actor
 Identifies a statically typed actor. More...
 
class  typed_event_based_actor
 A cooperatively scheduled, event-based actor implementation with strong type checking. More...
 
struct  unbox_message_element
 Unboxes atom constants, i.e., converts atom_constant<V> to V. More...
 
class  uniform_type_info
 Provides a platform independent type name and a (very primitive) kind of reflection in combination with uniform_value. More...
 
struct  uniform_value_t
 Generic container for storing a value with associated type information. More...
 
class  variant
 A variant represents always a valid value of one of the types Ts.... More...
 

Typedefs

using abstract_actor_ptr = intrusive_ptr< abstract_actor >
 
using add_atom = atom_constant< atom("ADD")>
 Generic 'ADD' atom for request operations.
 
using get_atom = atom_constant< atom("GET")>
 Generic 'GET' atom for request operations.
 
using put_atom = atom_constant< atom("PUT")>
 Generic 'PUT' atom for request operations.
 
using update_atom = atom_constant< atom("UPDATE")>
 Generic 'UPDATE' atom, e.g., or signalizing updates in a key-value store.
 
using delete_atom = atom_constant< atom("DELETE")>
 Generic 'DELETE' atom for request operations.
 
using ok_atom = atom_constant< atom("OK")>
 Generic 'OK' atom for response messages.
 
using error_atom = atom_constant< atom("ERROR")>
 Generic 'ERROR' atom for response messages.
 
using sys_atom = atom_constant< atom("SYS")>
 Marker 'SYS' atom for prefixing messages to a forwarding chain to address an otherwise transparent actor. More...
 
using join_atom = atom_constant< atom("JOIN")>
 Generic 'JOIN' atom, e.g., for signaling group subscriptions.
 
using leave_atom = atom_constant< atom("LEAVE")>
 Generic 'LEAVE' atom, e.g., for signaling group unsubscriptions.
 
using forward_atom = atom_constant< atom("FORWARD")>
 Generic 'FORWARD' atom, e.g., for signaling an actor that it should drop the first element and forward the remainder to a list of predefined receivers. More...
 
using flush_atom = atom_constant< atom("FLUSH")>
 Generic 'FLUSH' atom, e.g., used by aout.
 
using redirect_atom = atom_constant< atom("REDIRECT")>
 Generic 'REDIRECT' atom, e.g., used by aout.
 
using link_atom = atom_constant< atom("LINK")>
 Generic 'LINK' atom for link requests over network.
 
using unlink_atom = atom_constant< atom("UNLINK")>
 Generic 'UNLINK' atom for removing networked links.
 
using publish_atom = atom_constant< atom("PUBLISH")>
 Generic 'PUBLISH' atom, e.g., for publishing actors at a given port.
 
using unpublish_atom = atom_constant< atom("UNPUBLISH")>
 Generic 'UNPUBLISH' atom, e.g., for removing an actor/port mapping.
 
using subscribe_atom = atom_constant< atom("SUBSCRIBE")>
 Generic 'PUBLISH' atom, e.g., for publishing actors at a given port.
 
using unsubscribe_atom = atom_constant< atom("UNSUBSCRIB")>
 Generic 'UNPUBLISH' atom, e.g., for removing an actor/port mapping.
 
using connect_atom = atom_constant< atom("CONNECT")>
 Generic 'CONNECT' atom, e.g., for connecting to remote CAF instances.
 
using open_atom = atom_constant< atom("OPEN")>
 Generic 'OPEN' atom, e.g., for opening a port or file.
 
using close_atom = atom_constant< atom("CLOSE")>
 Generic 'CLOSE' atom, e.g., for closing a port or file.
 
using spawn_atom = atom_constant< atom("SPAWN")>
 Generic 'SPAWN' atom, e.g., for spawning remote actors.
 
using migrate_atom = atom_constant< atom("MIGRATE")>
 Atom to signalize an actor to migrate its state to another actor.
 
using actor_id = uint64_t uint32_t
 
using mailbox_element_ptr = std::unique_ptr< mailbox_element, detail::disposer >
 
template<spawn_mode X>
using spawn_mode_token = std::integral_constant< spawn_mode, X >
 
template<class Lockable >
using unique_lock = std::unique_lock< Lockable >
 
template<class SharedLockable >
using upgrade_lock = shared_lock< SharedLockable >
 
using T = maybe< T >
 
using config_value = variant< std::string, double, int64_t, bool >
 Denotes a configuration value.
 
using config_consumer = std::function< void(std::string, config_value)>
 Denotes a callback for config parser implementations.
 
using primitive_variant = variant< int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, float, double, long double, std::string, std::u16string, std::u32string, atom_value, bool >
 
template<class... Is>
using reacts_to = typed_mpi< detail::type_list< Is...>, detail::type_list< void >, detail::empty_type_list >
 
using generic_timeout_definition = timeout_definition< std::function< void()>>
 
using uniform_value = std::unique_ptr< uniform_value_t >
 A unique pointer holding a uniform_value_t.
 

Enumerations

enum  atom_value : uint64_t
 The value type of atoms.
 
enum  time_unit : uint32_t
 SI time units to specify timeouts.
 
enum  spawn_mode {
  function,
  function_with_selfptr,
  clazz
}
 
enum  invoke_message_result {
  im_success,
  im_skipped,
  im_dropped
}
 
enum  message_priority : uint32_t {
  normal,
  high
}
 
enum  config_format { ini }
 Denotes the format of a configuration file.
 

Functions

template<class T , typename U >
T actor_cast (const U &what)
 Converts actor handle what to a different actor handle of type T.
 
actor_ostream aout (const scoped_actor &self)
 Convenience factory function for creating an actor output stream.
 
actor_ostream aout (abstract_actor *self)
 Convenience factory function for creating an actor output stream.
 
const uniform_type_infoannounce (const std::type_info &tinfo, uniform_type_info_ptr utype)
 Adds a new mapping to the type system. More...
 
template<class Member , class Parent , class... Ts>
std::pair< Member Parent::*, abstract_uniform_type_info< Member > * > compound_member (Member Parent::*memptr, const Ts &...xs)
 Creates meta information for a non-trivial Member, whereas xs are the "sub-members" of Member. More...
 
template<class Member , class Parent , class... Ts>
std::pair< Member &(Parent::*)(), abstract_uniform_type_info< Member > * > compound_member (Member &(Parent::*getter)(), const Ts &...xs)
 Creates meta information for a non-trivial Member accessed via the getter member function getter returning a mutable reference, whereas xs are the "sub-members" of Member. More...
 
template<class Parent , class GRes , class SRes , class SArg , class... Ts>
std::pair< std::pair< GRes(Parent::*)() const, SRes(Parent::*)(SArg)>, abstract_uniform_type_info< typename std::decay< GRes >::type > * > compound_member (const std::pair< GRes(Parent::*)() const, SRes(Parent::*)(SArg)> &gspair, const Ts &...xs)
 Creates meta information for a non-trivial Member accessed via the pair of getter and setter member function pointers gspair, whereas xs are the "sub-members" of Member. More...
 
template<class T , class... Ts>
const uniform_type_infoannounce (std::string tname, const Ts &...xs)
 Adds a new type mapping for T to the type system using tname as its uniform name and the list of member pointers xs. More...
 
template<size_t Size>
constexpr atom_value atom (char const (&str)[Size])
 Creates an atom from given string literal.
 
void await_all_actors_done ()
 Blocks execution of this actor until all other actors finished execution. More...
 
template<class... Sigs, class... Ts>
void check_typed_input (const typed_actor< Sigs...> &, const detail::type_list< Ts...> &)
 Checks whether R does support an input of type {Ts...} via a static assertion (always returns 0). More...
 
template<class T >
void operator& (deserializer &source, T &value)
 
template<class T >
Tunopt (T &v)
 
template<class T >
Tunopt (maybe< T > &v)
 
bool operator< (const match_case_info &x, const match_case_info &y)
 
template<class F >
std::enable_if< !std::is_base_of< match_case, F >::value, std::tuple< trivial_match_case< F > >>::type to_match_case_tuple (F fun)
 
template<class MatchCase >
std::enable_if< std::is_base_of< match_case, MatchCase >::value, std::tuple< const MatchCase & >>::type to_match_case_tuple (const MatchCase &x)
 
template<class... Ts>
const std::tuple< Ts...> & to_match_case_tuple (const std::tuple< Ts...> &x)
 
template<class T , class U >
std::enable_if< std::is_base_of< match_case, T >::value||std::is_base_of< match_case, U >::value >::type operator, (T, U)
 
template<class T , typename U >
bool operator== (const maybe< T > &lhs, const U &rhs)
 Returns true if lhs is available and its value is equal to rhs.
 
template<class T >
constexpr detail::boxed< T >::type val ()
 A wildcard that matches any value of type T.
 
template<class T , typename BinaryPredicate >
std::function< maybe< T >const T &)> guarded (BinaryPredicate p, T value)
 Generates function objects from a binary predicate and a value.
 
template<class T , typename Predicate >
unit_t guarded (Predicate, const detail::wrapped< T > &)
 
unit_t to_guard (const anything &)
 
template<class T >
unit_t to_guard (detail::wrapped< T >(*)())
 
template<class T >
unit_t to_guard (const detail::wrapped< T > &)
 
template<class T >
std::function< maybe< typename detail::strip_and_convert< T >::type > const typename detail::strip_and_convert< T >::type &)> to_guard (const T &value, typename std::enable_if<!detail::is_callable< T >::value >::type *=0)
 
template<class F >
to_guard (F fun, typename std::enable_if< detail::is_callable< F >::value >::type *=0)
 
template<atom_value V>
auto to_guard (const atom_constant< V > &) -> decltype(to_guard(V))
 
template<class... Ts>
auto on (const Ts &...xs) -> detail::advanced_match_case_builder< detail::type_list< decltype(to_guard(xs))... >, detail::type_list< typename detail::pattern_type< typename std::decay< Ts >::type >::type...> >
 Returns a generator for match_case objects.
 
template<class T , class... Ts>
decltype(on(val< T >(), val< Ts >()...)) on ()
 Returns a generator for match_case objects.
 
template<atom_value A0, class... Ts>
decltype(on(A0, val< Ts >()...)) on ()
 Returns a generator for match_case objects.
 
template<atom_value A0, atom_value A1, class... Ts>
decltype(on(A0, A1, val< Ts >()...)) on ()
 Returns a generator for match_case objects.
 
template<atom_value A0, atom_value A1, atom_value A2, class... Ts>
decltype(on(A0, A1, A2, val< Ts >()...)) on ()
 Returns a generator for match_case objects.
 
template<atom_value A0, atom_value A1, atom_value A2, atom_value A3, class... Ts>
decltype(on(A0, A1, A2, A3, val< Ts >()...)) on ()
 Returns a generator for match_case objects.
 
template<class Rep , class Period >
constexpr detail::timeout_definition_builder after (const std::chrono::duration< Rep, Period > &d)
 Returns a generator for timeouts.
 
void parse_config (std::istream &input_stream, config_format format, maybe< std::ostream & > errors=none)
 Read configuration from input_stream using given format. More...
 
void parse_config (const std::string &file_name, maybe< config_format > cf=none, maybe< std::ostream & > errors=none)
 Read configuration from file_name using given format or try to deduce file format automatically if cf == none. More...
 
template<class... Ts>
void send_as (const actor &from, message_priority prio, const channel &to, Ts &&...xs)
 Sends to a message under the identity of from with priority prio.
 
template<class... Ts>
void send_as (const actor &from, const channel &to, Ts &&...xs)
 Sends to a message under the identity of from.
 
template<class... Sigs, class... Ts>
void send_as (const actor &from, message_priority prio, const typed_actor< Sigs...> &to, Ts &&...xs)
 Sends to a message under the identity of from with priority prio.
 
template<class... Sigs, class... Ts>
void send_as (const actor &from, const typed_actor< Sigs...> &to, Ts &&...xs)
 Sends to a message under the identity of from.
 
template<class... Ts>
void anon_send (message_priority prio, const channel &to, Ts &&...xs)
 Anonymously sends to a message with priority prio.
 
template<class... Ts>
void anon_send (const channel &to, Ts &&...xs)
 Anonymously sends to a message.
 
template<class... Sigs, class... Ts>
void anon_send (message_priority prio, const typed_actor< Sigs...> &to, Ts &&...xs)
 Anonymously sends to a message with priority prio.
 
template<class... Sigs, class... Ts>
void anon_send (const typed_actor< Sigs...> &to, Ts &&...xs)
 Anonymously sends to a message.
 
void anon_send_exit (const actor_addr &to, uint32_t reason)
 Anonymously sends to an exit message.
 
template<class ActorHandle >
void anon_send_exit (const ActorHandle &to, uint32_t reason)
 Anonymously sends to an exit message.
 
template<class T >
void operator& (serializer &sink, const T &value)
 
void set_scheduler (scheduler::abstract_coordinator *ptr)
 Sets a user-defined scheduler. More...
 
template<class Policy = policy::work_stealing>
void set_scheduler (size_t nw=std::thread::hardware_concurrency(), size_t max_throughput=std::numeric_limits< size_t >::max())
 Sets a user-defined scheduler using given policies. More...
 
void shutdown ()
 Destroys all singletons and stops the scheduler. More...
 
constexpr skip_message_t skip_message ()
 Tells the runtime system to skip a message when used as message handler, i.e., causes the runtime to leave the message in the mailbox of an actor. More...
 
std::ostream & operator<< (std::ostream &, skip_message_t)
 
template<class C , spawn_options Os, class BeforeLaunch , class... Ts>
intrusive_ptr< C > spawn_impl (execution_unit *host, BeforeLaunch before_launch_fun, Ts &&...xs)
 Returns a newly spawned instance of type C using xs... as constructor arguments. More...
 
template<class C , spawn_options Os, typename BeforeLaunch , class... Ts>
intrusive_ptr< C > spawn_class (execution_unit *host, BeforeLaunch before_launch_fun, Ts &&...xs)
 Called by spawn when used to create a class-based actor (usually should not be called by users of the library). More...
 
template<spawn_options Os, class C , class BeforeLaunch , class F , class... Ts>
intrusive_ptr< C > spawn_functor_impl (execution_unit *eu, BeforeLaunch cb, F fun, Ts &&...xs)
 
template<spawn_options Os, typename BeforeLaunch , typename F , class... Ts>
infer_handle_from_fun< F >::type spawn_functor (execution_unit *eu, BeforeLaunch cb, F fun, Ts &&...xs)
 Called by spawn when used to create a functor-based actor (usually should not be called by users of the library). More...
 
template<spawn_options Os, typename BeforeLaunch , typename F , class... Ts>
infer_typed_actor_handle< typename detail::get_callable_trait< F >::result_type, typename detail::tl_head< typename detail::get_callable_trait< F >::arg_types >::type >::type spawn_typed_functor (execution_unit *, BeforeLaunch bl, F fun, Ts &&...xs) CAF_DEPRECATED
 Spawns a typed actor from a functor .
 
template<class Archive , class U >
std::enable_if< detail::is_serializable< U >::value >::type serialize_state (Archive &ar, U &st, const unsigned int version)
 
template<class Archive , class U >
std::enable_if<!detail::is_serializable< U >::value >::type serialize_state (Archive &, U &, const unsigned int)
 
std::string is_any_of (std::string arg)
 
template<class Container , class Delim >
void split (Container &result, const std::string &str, const Delim &delims, bool keep_all=true)
 
template<class Container >
std::string join (const Container &c, const std::string &glue)
 
void splice (std::string &, const std::string &)
 
template<class T , class... Ts>
void splice (std::string &str, const std::string &glue, T &&arg, Ts &&...xs)
 
template<ptrdiff_t WhatSize, ptrdiff_t WithSize>
void replace_all (std::string &str, const char(&what)[WhatSize], const char(&with)[WithSize])
 
template<class T , typename U >
std::enable_if< !std::is_floating_point< T >::value &&!std::is_floating_point< U >::value, bool >::type safe_equal (const T &lhs, const U &rhs)
 Compares two values by using operator== unless two floating point numbers are compared. More...
 
template<class T , typename U >
std::enable_if< std::is_floating_point< T >::value||std::is_floating_point< U >::value, bool >::type safe_equal (const T &lhs, const U &rhs)
 
template<class T >
std::enable_if< std::is_arithmetic< T >::value, std::string >::type convert_to_str (T value)
 
std::string convert_to_str (std::string value)
 
template<class T >
caf::maybe< Tspro (const std::string &str)
 
std::string to_verbose_string (const std::exception &e)
 Converts e to a string including e.what().
 
uniform_value from_string_impl (const std::string &what)
 Converts a string created by to_string to its original value.
 
template<class T >
maybe< Tfrom_string (const std::string &what)
 Convenience function that tries to deserializes a value from what and converts the result to T. More...
 
template<class T >
std::enable_if< detail::tl_exists< detail::type_list< exit_msg, down_msg, sync_exited_msg >, detail::tbind< std::is_same, T >::template type >::value, bool >::type operator== (const T &lhs, const T &rhs)
 
template<class T >
std::enable_if< detail::tl_exists< detail::type_list< exit_msg, down_msg, sync_exited_msg >, detail::tbind< std::is_same, T >::template type >::value, bool >::type operator!= (const T &lhs, const T &rhs)
 
bool operator== (const group_down_msg &lhs, const group_down_msg &rhs)
 
bool operator!= (const group_down_msg &lhs, const group_down_msg &rhs)
 
bool operator== (const timeout_msg &lhs, const timeout_msg &rhs)
 
bool operator!= (const timeout_msg &lhs, const timeout_msg &rhs)
 
template<class T >
std::string type_name_access_impl (std::true_type)
 
template<class T >
std::string type_name_access_impl (std::false_type)
 
template<class T >
std::string type_name_access ()
 
template<class T , class... Ts>
uniform_value make_uniform_value (const uniform_type_info *uti, Ts &&...xs)
 Creates a uniform value of type T.
 
const uniform_type_infouniform_typeid_by_nr (uint16_t nr)
 Returns the uniform type info for the builtin type identified by nr. More...
 
const uniform_type_infouniform_typeid (const std::type_info &tinf, bool allow_nullptr=false)
 Returns the uniform type info for type tinf. More...
 
template<class T >
const uniform_type_infouniform_typeid (bool allow_nullptr=false)
 Returns the uniform type info for type T. More...
 

Variables

constexpr actor_id invalid_actor_id = 0
 Denotes an ID that is never used by an actor.
 
constexpr invalid_message_id_t invalid_message_id = invalid_message_id_t{}
 
static constexpr none_t none = none_t{}
 
constexpr auto any_vals = anything()
 A wildcard that matches any number of any values.
 
constexpr auto arg_match = detail::boxed<detail::arg_match_t>::type()
 A wildcard that matches the argument types of a given callback, must be the last argument to on(). More...
 
constexpr auto others = detail::catch_all_match_case_builder()
 Generates catch-all match_case objects.
 
constexpr auto on_arg_match = detail::trivial_match_case_builder()
 Semantically equal to on(arg_match), but uses a (faster) special-purpose match_case implementation. More...
 
template<class TypedBehavior , class FirstArg >
struct CAF_DEPRECATED infer_typed_actor_handle
 
constexpr spawn_options no_spawn_options = spawn_options::no_flags
 Denotes default settings.
 
constexpr spawn_options monitored = spawn_options::monitor_flag
 Causes spawn to call `self->monitor(...) immediately after the new actor was spawned. More...
 
constexpr spawn_options linked = spawn_options::link_flag
 Causes spawn to call `self->link_to(...) immediately after the new actor was spawned. More...
 
constexpr spawn_options detached = spawn_options::detach_flag
 Causes the new actor to opt out of the cooperative scheduling.
 
constexpr spawn_options hidden = spawn_options::hide_flag
 Causes the runtime to ignore the new actor in await_all_actors_done().
 
constexpr spawn_options blocking_api = spawn_options::blocking_api_flag
 Causes the new actor to opt in to the blocking API, i.e., the actor uses a context-switching or thread-based backend instead of the default event-based implementation. More...
 
constexpr spawn_options priority_aware = spawn_options::priority_aware_flag
 Causes the new actor to evaluate message priorities. More...
 
constexpr spawn_options lazy_init = spawn_options::lazy_init_flag
 Causes the new actor to delay its initialization until a message arrives. More...
 
constexpr bool token_compress_on = false
 
static constexpr unit_t unit = unit_t{}
 
caf::sb_actor CAF_DEPRECATED
 
template<class Result , class FirstArg , bool FirstArgPtr = std::is_pointer<FirstArg>::value && std::is_base_of< local_actor, typename std::remove_pointer<FirstArg>::type >::value>
struct CAF_DEPRECATED infer_typed_actor_base
 Infers the appropriate base class for a functor-based typed actor from the result and the first argument of the functor. More...
 
template<class C , spawn_options Os = no_spawn_options, class... Ts>
infer_handle_from_class< C >::type spawn (Ts &&...xs)
 Returns a new actor of type C using xs... as constructor arguments. More...
 
template<spawn_options Os = no_spawn_options, class F , class... Ts>
infer_handle_from_fun< F >::type spawn (F fun, Ts &&...xs)
 Returns a new functor-based actor. More...
 
template<class C , spawn_options Os = no_spawn_options, class Groups , class... Ts>
actor spawn_in_groups (const Groups &grps, Ts &&...xs)
 Returns a new actor that immediately, i.e., before this function returns, joins grps of type C using xs as constructor arguments.
 
template<class C , spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_groups (std::initializer_list< group > grps, Ts &&...xs)
 
template<class C , spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_group (const group &grp, Ts &&...xs)
 Returns a new actor that immediately, i.e., before this function returns, joins grp of type C using xs as constructor arguments.
 
template<spawn_options Os = no_spawn_options, class Groups , class... Ts>
actor spawn_in_groups (const Groups &grps, Ts &&...xs)
 Returns a new actor that immediately, i.e., before this function returns, joins grps. More...
 
template<spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_groups (std::initializer_list< group > grps, Ts &&...xs)
 
template<spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_group (const group &grp, Ts &&...xs)
 Returns a new actor that immediately, i.e., before this function returns, joins grp. More...
 
template<class C , spawn_options Os = no_spawn_options, class... Ts>
CAF_DEPRECATED actor_handle_from_signature_list< typename C::signatures >::type spawn_typed (Ts &&...xs)
 Returns a new typed actor of type C using xs... as constructor arguments. More...
 
template<spawn_options Os, typename BeforeLaunch , typename F , class... Ts>
CAF_DEPRECATED infer_typed_actor_handle< typename detail::get_callable_trait< F >::result_type, typename detail::tl_head< typename detail::get_callable_trait< F >::arg_types >::type >::type spawn_typed_functor (execution_unit *eu, BeforeLaunch cb, F fun, Ts &&...xs)
 Spawns a typed actor from a functor .
 
template<spawn_options Os = no_spawn_options, typename F , class... Ts>
CAF_DEPRECATED infer_typed_actor_handle< typename detail::get_callable_trait< F >::result_type, typename detail::tl_head< typename detail::get_callable_trait< F >::arg_types >::type >::type spawn_typed (F fun, Ts &&...xs)
 Returns a new typed actor from a functor. More...
 

Detailed Description

Root namespace of libcaf.

Typedef Documentation

using caf::forward_atom = typedef atom_constant<atom("FORWARD")>

Generic 'FORWARD' atom, e.g., for signaling an actor that it should drop the first element and forward the remainder to a list of predefined receivers.

using caf::sys_atom = typedef atom_constant<atom("SYS")>

Marker 'SYS' atom for prefixing messages to a forwarding chain to address an otherwise transparent actor.

Function Documentation

void caf::await_all_actors_done ( )

Blocks execution of this actor until all other actors finished execution.

Warning
This function will cause a deadlock if called from multiple actors.
Do not call this function in cooperatively scheduled actors.
Examples:
announce_1.cpp, announce_2.cpp, announce_3.cpp, announce_4.cpp, announce_5.cpp, dancing_kirby.cpp, dining_philosophers.cpp, and hello_world.cpp.
template<class... Sigs, class... Ts>
void caf::check_typed_input ( const typed_actor< Sigs...> &  ,
const detail::type_list< Ts...> &   
)

Checks whether R does support an input of type {Ts...} via a static assertion (always returns 0).

template<class T >
maybe<T> caf::from_string ( const std::string &  what)

Convenience function that tries to deserializes a value from what and converts the result to T.

void caf::parse_config ( std::istream &  input_stream,
config_format  format,
maybe< std::ostream & >  errors = none 
)

Read configuration from input_stream using given format.

Parameters
input_streamASCII-formatted configuration.
formatConfiguration format such as INI.
errorsOutput streams for error messages.
void caf::parse_config ( const std::string &  file_name,
maybe< config_format cf = none,
maybe< std::ostream & >  errors = none 
)

Read configuration from file_name using given format or try to deduce file format automatically if cf == none.

Parameters
file_namePath to configuration file.
cfForces the parser to use a specific file format unless none.
errorsOutput streams for error messages.
template<class T , typename U >
std::enable_if< ! std::is_floating_point<T>::value && ! std::is_floating_point<U>::value, bool>::type caf::safe_equal ( const T lhs,
const U &  rhs 
)

Compares two values by using operator== unless two floating point numbers are compared.

In the latter case, the function performs an epsilon comparison.

void caf::set_scheduler ( scheduler::abstract_coordinator *  ptr)

Sets a user-defined scheduler.

Note
This function must be used before actor is spawned. Dynamically changing the scheduler at runtime is not supported.
Exceptions
std::logic_errorif a scheduler is already defined
template<class Policy = policy::work_stealing>
void caf::set_scheduler ( size_t  nw = std::thread::hardware_concurrency(),
size_t  max_throughput = std::numeric_limits<size_t>::max() 
)

Sets a user-defined scheduler using given policies.

The scheduler is instantiated with nw number of workers and allows each actor to consume up to max_throughput per resume (must be > 0).

Note
This function must be used before actor is spawned. Dynamically changing the scheduler at runtime is not supported.
Exceptions
std::logic_errorif a scheduler is already defined
std::invalid_argumentif max_throughput == 0
void caf::shutdown ( )

Destroys all singletons and stops the scheduler.

It is recommended to use this function as very last function call before leaving main().

Examples:
announce_1.cpp, announce_2.cpp, announce_3.cpp, announce_4.cpp, announce_5.cpp, dancing_kirby.cpp, dining_philosophers.cpp, and hello_world.cpp.
constexpr skip_message_t caf::skip_message ( )

Tells the runtime system to skip a message when used as message handler, i.e., causes the runtime to leave the message in the mailbox of an actor.

template<spawn_options Os = no_spawn_options, class F , class... Ts>
infer_handle_from_fun<F>::type caf::spawn ( fun,
Ts &&...  xs 
)

Returns a new functor-based actor.

The first argument must be the functor, the remainder of xs... is used to invoke the functor. The behavior of spawn can be modified by setting Os, e.g., to opt-out of the cooperative scheduling.

template<class C , spawn_options Os, typename BeforeLaunch , class... Ts>
intrusive_ptr< C > caf::spawn_class ( execution_unit host,
BeforeLaunch  before_launch_fun,
Ts &&...  xs 
)

Called by spawn when used to create a class-based actor (usually should not be called by users of the library).

This function simply forwards its arguments to spawn_impl using detail::spawn_fwd.

template<spawn_options Os, typename BeforeLaunch , typename F , class... Ts>
infer_handle_from_fun< F >::type caf::spawn_functor ( execution_unit eu,
BeforeLaunch  cb,
fun,
Ts &&...  xs 
)

Called by spawn when used to create a functor-based actor (usually should not be called by users of the library).

This function selects a proper implementation class and then delegates to spawn_class.

template<class C , spawn_options Os, class BeforeLaunch , class... Ts>
intrusive_ptr<C> caf::spawn_impl ( execution_unit host,
BeforeLaunch  before_launch_fun,
Ts &&...  xs 
)

Returns a newly spawned instance of type C using xs... as constructor arguments.

The instance will be added to the job list of host. However, before the instance is launched, before_launch_fun will be called, e.g., to join a group before the actor is running.

template<spawn_options Os = no_spawn_options, class... Ts>
actor caf::spawn_in_group ( const group &  grp,
Ts &&...  xs 
)

Returns a new actor that immediately, i.e., before this function returns, joins grp.

The first element of xs must be the functor, the remaining arguments its arguments.

template<spawn_options Os = no_spawn_options, class Groups , class... Ts>
actor caf::spawn_in_groups ( const Groups &  grps,
Ts &&...  xs 
)

Returns a new actor that immediately, i.e., before this function returns, joins grps.

The first element of xs must be the functor, the remaining arguments its arguments.

template<class C , spawn_options Os = no_spawn_options, class... Ts>
CAF_DEPRECATED actor_handle_from_signature_list<typename C::signatures>::type caf::spawn_typed ( Ts &&...  xs)

Returns a new typed actor of type C using xs... as constructor arguments.

template<spawn_options Os = no_spawn_options, typename F , class... Ts>
CAF_DEPRECATED infer_typed_actor_handle< typename detail::get_callable_trait<F>::result_type, typename detail::tl_head< typename detail::get_callable_trait<F>::arg_types >::type>::type caf::spawn_typed ( fun,
Ts &&...  xs 
)

Returns a new typed actor from a functor.

The first element of xs must be the functor, the remaining arguments are used to invoke the functor. This function delegates its arguments to spawn_typed_functor.

const uniform_type_info* caf::uniform_typeid ( const std::type_info &  tinf,
bool  allow_nullptr = false 
)

Returns the uniform type info for type tinf.

Parameters
allow_nullptrif set to true, this function returns nullptr instead of throwing an exception on error
template<class T >
const uniform_type_info* caf::uniform_typeid ( bool  allow_nullptr = false)

Returns the uniform type info for type T.

Parameters
allow_nullptrif set to true, this function returns nullptr instead of throwing an exception on error
const uniform_type_info* caf::uniform_typeid_by_nr ( uint16_t  nr)

Returns the uniform type info for the builtin type identified by nr.

Precondition
nr > 0 && nr < detail::type_nrs

Variable Documentation

constexpr auto caf::arg_match = detail::boxed<detail::arg_match_t>::type()

A wildcard that matches the argument types of a given callback, must be the last argument to on().

template<class Result , class FirstArg , bool FirstArgPtr = std::is_pointer<FirstArg>::value && std::is_base_of< local_actor, typename std::remove_pointer<FirstArg>::type >::value>
struct CAF_DEPRECATED caf::infer_typed_actor_base

Infers the appropriate base class for a functor-based typed actor from the result and the first argument of the functor.

constexpr auto caf::on_arg_match = detail::trivial_match_case_builder()

Semantically equal to on(arg_match), but uses a (faster) special-purpose match_case implementation.