actor-framework
Public Member Functions | Static Public Attributes | Related Functions | List of all members
caf::message_id Class Reference

Bundles various flags along with an optional request ID. More...

#include <message_id.hpp>

Inheritance diagram for caf::message_id:
Inheritance graph
[legend]
Collaboration diagram for caf::message_id:
Collaboration graph
[legend]

Public Member Functions

constexpr message_id ()
 Constructs a message ID for asynchronous messages with normal priority.
 
constexpr message_id (uint64_t value)
 
 message_id (const message_id &)=default
 
message_idoperator= (const message_id &)=default
 
constexpr uint64_t category () const noexcept
 Returns the message category, i.e., normal_message_category or urgent_message_category. More...
 
constexpr message_id with_category (uint64_t x) const noexcept
 Returns a new message ID with given category.
 
constexpr bool is_async () const noexcept
 Returns whether a message is asynchronous, i.e., not a request.
 
constexpr bool is_request () const noexcept
 Returns whether a message is a request.
 
constexpr bool is_response () const noexcept
 Returns whether a message is a response to a previously send request.
 
constexpr bool is_answered () const noexcept
 Returns whether a message is tagged as answered by the receiving actor.
 
constexpr bool is_urgent_message () const noexcept
 Returns whether category() == urgent_message_category.
 
constexpr bool is_normal_message () const noexcept
 Returns whether category() == normal_message_category.
 
constexpr message_priority priority () const noexcept
 Returns the priority part from the category().
 
constexpr message_id response_id () const noexcept
 Returns a response ID for the current request or an asynchronous ID with the same priority as this ID. More...
 
constexpr message_id request_id () const noexcept
 Extracts the request number part of this ID.
 
constexpr message_id with_high_priority () const noexcept
 Returns the same ID but high message priority.
 
constexpr message_id with_normal_priority () const noexcept
 Returns the same ID with normal message priority.
 
constexpr uint64_t integer_value () const noexcept
 Returns the "raw bytes" for this ID.
 
constexpr int64_t compare (const message_id &other) const noexcept
 Returns a negative value if *this < other, zero if *this == other, and a positive value otherwise. More...
 
void mark_as_answered () noexcept
 Sets the flag for marking an incoming message as answered.
 
message_idoperator++ () noexcept
 

Static Public Attributes

static constexpr uint64_t response_flag_mask = 0x8000000000000000
 The first bit flags response messages.
 
static constexpr uint64_t answered_flag_mask = 0x4000000000000000
 The second bit flags whether the actor already responded.
 
static constexpr uint64_t category_flag_mask = 0x3000000000000000
 
static constexpr uint64_t request_id_mask = 0x0FFFFFFFFFFFFFFF
 The trailing 60 bits are used for the actual ID.
 
static constexpr uint64_t urgent_message_category = 0
 Identifies one-to-one messages with high priority.
 
static constexpr uint64_t normal_message_category = 1
 Identifies one-to-one messages with normal priority.
 
static constexpr uint64_t category_offset = 60
 Number of bits trailing the category.
 
static constexpr uint64_t default_async_value = 0x1000000000000000
 Default value for asynchronous messages with normal message category.
 

Related Functions

(Note that these are not member functions.)

constexpr message_id make_message_id (normal_message_priority_constant, uint64_t value)
 Generates a message_id with given integer value.
 
constexpr message_id make_message_id (high_message_priority_constant, uint64_t value)
 Generates a message_id with given integer value.
 
template<message_priority P = message_priority::normal>
constexpr message_id make_message_id (uint64_t value=0)
 Generates a message_id with given integer value.
 
constexpr message_id make_message_id (message_priority p)
 Generates a message_id with given priority.
 

Detailed Description

Bundles various flags along with an optional request ID.

Member Function Documentation

◆ category()

constexpr uint64_t caf::message_id::category ( ) const
inlinenoexcept

Returns the message category, i.e., normal_message_category or urgent_message_category.

◆ compare()

constexpr int64_t caf::message_id::compare ( const message_id other) const
inlinenoexcept

Returns a negative value if *this < other, zero if *this == other, and a positive value otherwise.

◆ response_id()

constexpr message_id caf::message_id::response_id ( ) const
inlinenoexcept

Returns a response ID for the current request or an asynchronous ID with the same priority as this ID.


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