OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::msgbus::stored_message Class Reference

Combines message information and an owned message content buffer. More...

#include <eagine/message_bus/message.hpp>

Public Member Functions

 stored_message ()=default
 Default constructor.
 
 stored_message (message_view message, memory::buffer buf) noexcept
 Construction from a message view and storage buffer. Adopts the buffer and copies the content from the message view into it.
 
 operator message_view () const
 Conversion to message view.
 
template<typename Source >
void fetch_all_from (Source &source)
 Copies the remaining data from the specified serialization source.
 
void store_content (memory::const_block blk)
 Copies the content from the given block into the internal buffer.
 
template<typename Value >
auto store_value (const Value &value, span_size_t max_size) -> bool
 Serializes and stores the specified value (up to max_size).
 
template<typename Value >
auto fetch_value (Value &value) -> bool
 Deserializes the stored content into the specified value.
 
auto storage () noexcept -> memory::block
 Returns a mutable view of the storage buffer.
 
auto data () const noexcept -> memory::const_block
 Returns a const view of the storage buffer.
 
auto is_signed () const noexcept -> bool
 Indicates if the header or the content is signed. More...
 
auto signature () const noexcept -> memory::const_block
 Returns the message signature. More...
 
auto content () noexcept -> memory::block
 Returns a mutable view of the data content of the message. More...
 
auto content () const noexcept -> memory::const_block
 Returns a const view of the data content of the message. More...
 
auto text_content () noexcept
 Returns the content as a mutable string view. More...
 
auto text_content () const noexcept
 Returns the content as a const string view. More...
 
void clear_data () noexcept
 Clears the content of the storage buffer.
 
auto release_buffer () noexcept -> memory::buffer
 Releases and returns the storage buffer (without clearing it).
 
auto store_and_sign (memory::const_block data, span_size_t max_size, context &, main_ctx_object &) -> bool
 Stores the specified data and signs it.
 
auto verify_bits (context &, main_ctx_object &) const noexcept -> verification_bits
 Verifies the signatures of this message.
 
- Public Member Functions inherited from eagine::msgbus::message_info
auto too_many_hops () const noexcept -> bool
 Indicates that the message made too many hops. More...
 
auto add_hop () noexcept -> auto &
 Increments the hop counter. More...
 
auto too_old () const noexcept -> bool
 Indicates that the message is too old. More...
 
auto add_age (message_age age) noexcept -> auto &
 Adds to the age seconds counter. More...
 
auto age () const noexcept -> message_age
 Returns the message age. More...
 
auto set_priority (message_priority new_priority) noexcept -> auto &
 Sets the priority of this message.
 
auto set_source_id (identifier_t id) noexcept -> auto &
 Sets the source endpoint identifier.
 
auto set_target_id (identifier_t id) noexcept -> auto &
 Sets the target endpoint identifier.
 
auto has_serializer_id (identifier id) const noexcept -> bool
 Tests if a data serializer with the specified id was used. More...
 
auto set_serializer_id (identifier id) noexcept -> auto &
 Sets the id of the used data content serializer. More...
 
auto set_sequence_no (message_sequence_t no) noexcept -> auto &
 Sets the sequence number of this message (has message-type specific meaning). More...
 
auto setup_response (const message_info &info) noexcept -> auto &
 Sets the target id to be the source id from info, copies sequence number. More...
 

Additional Inherited Members

- Public Types inherited from eagine::msgbus::message_info
using sequence_t = message_sequence_t
 Alias for the sequence number type. More...
 
using hop_count_t = std::int8_t
 Alias for type used to store the message hop count.
 
using age_t = std::int8_t
 Alias for type used to store the message age in quarter seconds.
 
- Public Attributes inherited from eagine::msgbus::message_info
identifier_t source_id
 Returns the source endpoint identifier. More...
 
identifier_t target_id
 Returns the target endpoint identifier. More...
 
identifier_t serializer_id
 Returns the identifier of the used serializer. More...
 
sequence_t sequence_no
 The message sequence number. More...
 
hop_count_t hop_count
 The message hop counter. More...
 
age_t age_quarter_seconds
 The message age in quarter seconds. More...
 
message_priority priority
 The message priority. More...
 
message_crypto_flags crypto_flags
 The message cryptography flags.
 

Detailed Description

Combines message information and an owned message content buffer.

Member Function Documentation

◆ content() [1/2]

auto eagine::msgbus::stored_message::content ( ) const -> memory::const_block
inlinenoexcept

Returns a const view of the data content of the message.

See also
signature
text_content

◆ content() [2/2]

auto eagine::msgbus::stored_message::content ( ) -> memory::block
inlinenoexcept

Returns a mutable view of the data content of the message.

See also
signature

Referenced by text_content().

◆ is_signed()

auto eagine::msgbus::stored_message::is_signed ( ) const -> bool
inlinenoexcept

Indicates if the header or the content is signed.

See also
signature

Referenced by signature().

◆ signature()

auto eagine::msgbus::stored_message::signature ( ) const -> memory::const_block
inlinenoexcept

Returns the message signature.

See also
is_signed
content

◆ text_content() [1/2]

auto eagine::msgbus::stored_message::text_content ( ) const
inlinenoexcept

Returns the content as a const string view.

See also
content

◆ text_content() [2/2]

auto eagine::msgbus::stored_message::text_content ( )
inlinenoexcept

Returns the content as a mutable string view.

See also
content

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).