C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::message Class Reference

Describes a fixed-length, copy-on-write, type-erased tuple with elements of any type. More...

#include <message.hpp>

Public Types

using data_ptr = intrusive_cow_ptr<detail::message_data>
 

Public Member Functions

 message (data_ptr data) noexcept
 
 message (message &&) noexcept=default
 
 message (const message &) noexcept=default
 
messageoperator= (message &&) noexcept=default
 
messageoperator= (const message &) noexcept=default
 
auto types () const noexcept
 
size_t size () const noexcept
 
size_t empty () const noexcept
 
bool unique () const noexcept
 
template<class... Ts>
bool match_elements () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
template<class... Ts>
bool matches (const Ts &... values) const
 Checks whether this messages contains the types Ts... with values values....
 
bool save (serializer &sink) const
 
bool save (binary_serializer &sink) const
 
bool save (detail::stringification_inspector &sink) const
 
bool load (deserializer &source)
 
bool load (binary_deserializer &source)
 
type_id_t type_at (size_t index) const noexcept
 Returns the type ID of the element at index.
 
template<class T >
bool match_element (size_t index) const noexcept
 Returns whether the element at index is of type T.
 
template<class T >
const T & get_as (size_t index) const noexcept
 
template<class T >
T & get_mutable_as (size_t index) noexcept
 
void swap (message &other) noexcept
 
void reset (detail::message_data *new_ptr=nullptr, bool add_ref=true) noexcept
 
void force_unshare ()
 Forces the message to copy its content if more than one reference to the content exists.
 

Static Public Member Functions

template<class... Ts>
static message concat (Ts &&... xs)
 

Related Symbols

(Note that these are not member symbols.)

message make_message ()
 
template<class... Ts>
message make_message (Ts &&... xs)
 
template<class T , class... Ts>
message make_message_nowrap (T &&arg, Ts &&... args)
 Same as make_message except when called with a single message argument.
 
template<class Tuple , size_t... Is>
message make_message_from_tuple (Tuple &&xs, std::index_sequence< Is... >)
 
template<class Tuple >
message make_message_from_tuple (Tuple &&xs)
 
template<class Inspector >
auto inspect (Inspector &f, message &x) -> std::enable_if_t< Inspector::is_loading, decltype(x.load(f))>
 
template<class Inspector >
auto inspect (Inspector &f, message &x) -> std::enable_if_t<!Inspector::is_loading, decltype(x.save(f))>
 
CAF_CORE_EXPORT std::string to_string (const message &x)
 

Detailed Description

Describes a fixed-length, copy-on-write, type-erased tuple with elements of any type.

Examples
dining_philosophers.cpp.

Member Function Documentation

◆ get_as()

template<class T >
const T & caf::message::get_as ( size_t index) const
noexcept
Precondition
index < size()
match_element<T>(index)

◆ get_mutable_as()

template<class T >
T & caf::message::get_mutable_as ( size_t index)
noexcept
Precondition
index < size()
match_element<T>(index)

◆ match_element()

template<class T >
bool caf::message::match_element ( size_t index) const
noexcept

Returns whether the element at index is of type T.

Precondition
index < size()

◆ matches()

template<class... Ts>
bool caf::message::matches ( const Ts &... values) const

Checks whether this messages contains the types Ts... with values values....

Users may pass std::ignore as a wildcard for individual elements. Elements are compared using operator==.

◆ type_at()

type_id_t caf::message::type_at ( size_t index) const
noexcept

Returns the type ID of the element at index.

Precondition
index < size()

Friends And Related Symbol Documentation

◆ make_message_nowrap()

template<class T , class... Ts>
message make_message_nowrap ( T && arg,
Ts &&... args )
related

Same as make_message except when called with a single message argument.

In the latter case, simply returns the message instead of wrapping it into another message.


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