libcaf  0.16.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
caf::message_id Class Reference

Denotes whether a message is asynchronous or synchronous. More...

#include <message_id.hpp>

Inherits comparable< message_id >.

Public Member Functions

constexpr message_id ()
 Constructs a message ID for asynchronous messages with normal priority.
 
constexpr message_id (invalid_message_id_t)
 Constructs a message ID for asynchronous messages with normal priority.
 
 message_id (const message_id &)=default
 
message_idoperator= (const message_id &)=default
 
bool is_async () const
 Returns whether a message is asynchronous, i.e., neither a request nor a stream message. More...
 
bool is_response () const
 Returns whether a message is a response to a previously send request.
 
bool is_request () const
 Returns whether a message is a request.
 
bool is_answered () const
 Returns whether a message is tagged as answered by the receiving actor.
 
uint64_t category () const
 Returns the message category, i.e., one of default_message_category, upstream_message_category, downstream_message_category, or urgent_message_category. More...
 
bool is_default_message () const
 Returns whether category() == default_message_category.
 
bool is_urgent_message () const
 Returns whether category() == urgent_message_category.
 
bool is_upstream_message () const
 Returns whether category() == upstream_message_category.
 
bool is_downstream_message () const
 Returns whether category() == downstream_message_category.
 
bool valid () const
 Returns whether a message is a request or a response.
 
message_id response_id () const
 Returns a response ID for the current request or an asynchronous ID with the same priority as this ID. More...
 
message_id request_id () const
 Extracts the request number part of this ID.
 
message_id with_high_priority () const
 Returns the same ID but with high instead of default message priority. More...
 
message_id with_normal_priority () const
 Returns the same ID but with high instead of default message priority.
 
uint64_t integer_value () const
 Returns the "raw bytes" for this ID.
 
int64_t compare (const message_id &other) const
 Returns a negative value if *this < other, zero if *this == other, and a positive value otherwise. More...
 
message_idoperator++ ()
 
void mark_as_answered ()
 Sets the flag for marking an incoming message as answered.
 

Static Public Member Functions

template<class... Ts>
static message_id make (Ts &&... xs) CAF_DEPRECATED_MSG("use make_message_id instead")
 

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 default_message_category = 0
 Identifies one-to-one messages with normal priority.
 
static constexpr uint64_t upstream_message_category = 1
 Identifies stream messages that flow upstream, e.g., upstream_msg::ack_batch. More...
 
static constexpr uint64_t downstream_message_category = 2
 Identifies stream messages that flow downstream, e.g., downstream_msg::batch. More...
 
static constexpr uint64_t urgent_message_category = 3
 Identifies one-to-one messages with high priority.
 
static constexpr uint64_t category_offset = 60
 Number of bits trailing the category.
 

Friends

struct make_message_id_t
 
template<class Inspector >
Inspector::result_type inspect (Inspector &f, message_id &x)
 

Detailed Description

Denotes whether a message is asynchronous or synchronous.

Note
Asynchronous messages always have an invalid message id.

Member Function Documentation

◆ category()

uint64_t caf::message_id::category ( ) const

Returns the message category, i.e., one of default_message_category, upstream_message_category, downstream_message_category, or urgent_message_category.

◆ compare()

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

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

◆ is_async()

bool caf::message_id::is_async ( ) const

Returns whether a message is asynchronous, i.e., neither a request nor a stream message.

◆ response_id()

message_id caf::message_id::response_id ( ) const

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

◆ with_high_priority()

message_id caf::message_id::with_high_priority ( ) const

Returns the same ID but with high instead of default message priority.

Precondition
!is_upstream_message() && !is_downstream_message()

Member Data Documentation

◆ downstream_message_category

constexpr uint64_t caf::message_id::downstream_message_category = 2
static

Identifies stream messages that flow downstream, e.g., downstream_msg::batch.

◆ upstream_message_category

constexpr uint64_t caf::message_id::upstream_message_category = 1
static

Identifies stream messages that flow upstream, e.g., upstream_msg::ack_batch.


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