Communication buffer. More...
Classes | |
| struct | header_type |
| Message header. More... | |
Public Member Functions | |
| void | reset (void) noexcept |
| Resets this message for reuse. | |
| message_handle const & | handle (void) const noexcept |
| message_handle & | handle (void) noexcept |
| char * | data (void) noexcept |
| Returns a pointer to the internal buffer. More... | |
| const char * | data (void) const noexcept |
| Returns a pointer to the internal buffer. noexcept More... | |
| std::size_t | capacity (void) const noexcept |
| Returns the capacity of the internal buffer in bytes. | |
| std::size_t | size (void) const noexcept |
| Returns the size of the internal buffer in bytes. | |
| bool | is_long (void) const noexcept |
Returns true if the size is bigger than the default capacity. | |
| header_type const & | header (void) const noexcept |
| header_type & | header (void) noexcept |
| header::type | type (void) const noexcept |
| Returns the type of the message. | |
| void | retarget (const header::type t) noexcept |
| Changes the type of the message. | |
| bool | body_empty (void) const noexcept |
Returns true if there is no message body. | |
| template<typename T > | |
| T const & | fix_payload_offset (void) noexcept |
| Updates the offset to the payload and returns the extended header. | |
| template<typename T > | |
| T const & | get_extended_header (void) const noexcept |
| Returns the extended header. | |
| payload_range_type | payload (void) noexcept |
| Returns a range over the payload. | |
| std::size_t | available_space (void) const noexcept |
| Available space for the payload in bytes. | |
| void * | reserve (const std::size_t n) noexcept |
Returns a pointer to n bytes reserved in the internal buffer. | |
| void * | try_reserve (const std::size_t n) noexcept |
Returns a pointer to n bytes reserved in the internal buffer or nullptr if there is not enough space. | |
| bool | is_forwarded (void) const noexcept |
Returns true if this message has been forwarded. | |
| void | mark_forwarded (void) noexcept |
| Marks that this message has been forwarded. | |
| message_ptr | clone (void) const |
| Creates an identical copy of this message. | |
| void | add_ref (long count=1, std::memory_order order=std::memory_order_relaxed) noexcept |
Increases the reference count by count. | |
| long | remove_ref (long count=1, std::memory_order order=std::memory_order_relaxed) noexcept |
Decreases the reference count by count. More... | |
| bool | release (std::memory_order order=std::memory_order_relaxed) noexcept |
| Decreases the reference count, destroying the object if it reached 0. More... | |
| long | use_count (std::memory_order order=std::memory_order_relaxed) const noexcept |
| bool | unique (std::memory_order order=std::memory_order_relaxed) const noexcept |
Static Public Member Functions | |
| static void | initialize (option const &opts, const unsigned int nppn) |
| Initializes the memory for allocating message objects. More... | |
| static void | finalize (void) |
| Finalizes the memory for allocating message objects. | |
| static std::size_t | default_capacity (void) noexcept |
| Returns the default capacity of the internal buffer (header and body) in bytes. | |
| static std::size_t | header_size (void) noexcept |
| Returns the size of the header in bytes. | |
| static void | set_default_body_capacity (const std::size_t) |
| Sets the default capacity for the body in bytes. | |
| static std::size_t | default_body_capacity (void) noexcept |
| Returns the default capacity for the body in bytes. | |
| static message * | construct (void) |
| Constructs a message of default capacity. | |
| static message * | construct (const std::size_t n, const bool exact_size) |
Constructs a message of with capacity of n bytes. More... | |
| static void | destroy (message *msg) |
Destroys msg. | |
| static message_ptr | create (const std::size_t n, const bool exact_size=true) |
Constructs a message that can store at least n bytes. More... | |
| static message_ptr | create (const header::type h, const std::size_t n, const bool exact_size=true) |
Constructs a message that can store at least n bytes. More... | |
| template<typename ExtendedHeader > | |
| static message_ptr | create (const header::type h, const std::size_t n, ExtendedHeader &&exh, const bool exact_size=true) |
Constructs a message that can store at least n bytes. More... | |
Public Types | |
| using | payload_range_type = boost::iterator_range< char * > |
| using | slist_hook_type = boost::intrusive::slist_member_hook<> |
Public Attributes | |
| slist_hook_type | slist_hook |
Hook for boost::intrusive::slist. | |
Communication buffer.
A message consists of a standard, fixed header that gives information about the size and the type of the message and the message body. The body contains data relevant to communication, such as additional headers and/or payload.
|
static |
Initializes the memory for allocating message objects.
The following options are supported through opts:
STAPL_RUNTIME_MSG_SIZE to change the default capacity.STAPL_RUNTIME_MSG_POOL_DISABLE to disable pool message allocation.STAPL_RUNTIME_MSG_POOL_MIN_NUM Minimum number of allocated message objects when pool allocation is enabled.STAPL_RUNTIME_MSG_MAX_MEM the maximum fraction of memory to use when pool allocation is enabled.| opts | Options to pass for initialization. |
| nppn | Number of processes per node. |
|
static |
Constructs a message of with capacity of n bytes.
| n | Requested capacity in bytes. |
| exact_size | true if there is no benefit to providing extra capacity. |
|
static |
Constructs a message that can store at least n bytes.
| n | Requested capacity in bytes. |
| exact_size | true if there is no benefit to providing extra capacity. |
|
static |
Constructs a message that can store at least n bytes.
| h | Message type. |
| n | Requested capacity in bytes. |
| exact_size | true if there is no benefit to providing extra capacity. |
|
static |
Constructs a message that can store at least n bytes.
| h | Message type. |
| n | Requested capacity in bytes. |
| exh | Extended header. |
| exact_size | true if there is no benefit to providing extra capacity. |
|
noexcept |
Returns a pointer to the internal buffer.
Flexible array members are not supported in C++. This function returns a pointer past the end of this message object which is properly sized and aligned to store requests in it.
|
noexcept |
Returns a pointer to the internal buffer. noexcept
Flexible array members are not supported in C++. This function returns a pointer past the end of this message object which is properly sized and aligned to store requests in it. noexcept
|
noexceptinherited |
Decreases the reference count by count.
|
noexceptinherited |
Decreases the reference count, destroying the object if it reached 0.
release() returns true, then the object has been destroyed.true if the object was destroyed, otherwise false.
1.8.13