MessageSerializer Class Reference

Space-ng SDK: sol3::core::MessageSerializer Class Reference
Space-ng SDK
sol3::core::MessageSerializer Class Reference

#include <sol3/core/message_serializer.h>

Public Member Functions

 MessageSerializer (MessagePort port)
 Initialize with the destination message port. More...
 
MessagePort const & port () const
 Destination message port. More...
 
msg::MessageHeaderT const & header () const
 A constant view of the message header. More...
 
void addStamp (msg::Stamp const &stamp)
 Append a timestamp to the header. More...
 
flatbuffers::span< uint8_t const > headerSpan () const
 Size-prefixed header span for the most recently finished message. More...
 
size_t finishHeaderFromPayloadBuffer (flatbuffers::span< uint8_t const > payload_span, msg::Stamp stamp)
 
flatbuffers::span< uint8_t const > payloadSpan () const
 Non-size-prefixed payload span for the most recently finished message. More...
 
template<typename TTableType , typename TBuilderFunction >
size_t finishPayload (TBuilderFunction &&builder_function, msg::Stamp stamp)
 
template<typename TNativeTableType >
size_t finishPayload (TNativeTableType const &payload, msg::Stamp stamp)
 

Detailed Description

Provides FlatBuffers builders and common utilities to finish a payload, retrieve header/payload spans, and add stamps.

Constructor & Destructor Documentation

◆ MessageSerializer()

sol3::core::MessageSerializer::MessageSerializer ( MessagePort  port)
explicit

Initialize with the destination message port.

Member Function Documentation

◆ addStamp()

void sol3::core::MessageSerializer::addStamp ( msg::Stamp const &  stamp)
inline

Append a timestamp to the header.

◆ finishHeaderFromPayloadBuffer()

size_t sol3::core::MessageSerializer::finishHeaderFromPayloadBuffer ( flatbuffers::span< uint8_t const >  payload_span,
msg::Stamp  stamp 
)
inline

Builds a size-prefixed header for a provided payload span without copying the payload into the serializer.

◆ finishPayload() [1/2]

template<typename TTableType , typename TBuilderFunction >
size_t sol3::core::MessageSerializer::finishPayload ( TBuilderFunction &&  builder_function,
msg::Stamp  stamp 
)
inline

◆ finishPayload() [2/2]

template<typename TNativeTableType >
size_t sol3::core::MessageSerializer::finishPayload ( TNativeTableType const &  payload,
msg::Stamp  stamp 
)
inline

This function serializes the payload, and header. After this call the latest header and payload are available in serialized form via calls to headerSpan and payloadSpan Note that this will add the given stamp to the header, and then clear the stamps field of the header after serialization. This function also increments the header's count field. returns the size of the header + payload span

◆ header()

msg::MessageHeaderT const& sol3::core::MessageSerializer::header ( ) const
inline

A constant view of the message header.

◆ headerSpan()

flatbuffers::span<uint8_t const> sol3::core::MessageSerializer::headerSpan ( ) const
inline

Size-prefixed header span for the most recently finished message.

◆ payloadSpan()

flatbuffers::span<uint8_t const> sol3::core::MessageSerializer::payloadSpan ( ) const

Non-size-prefixed payload span for the most recently finished message.

◆ port()

MessagePort const& sol3::core::MessageSerializer::port ( ) const
inline

Destination message port.


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