Class simulation_framework::autonomy::communication::messages::AutonomyMsg
Last update: 09.03.2026
Definition: autonomy/communication/messages/autonomy_msg.h (line 41)
AutonomyMsg: shared base for autonomy messages. Provides timestamp view, sequence id, ByteSizeLong and SerializeToArray with small helpers for derived payloads.
Inherited by:
Members
- AutonomyMsg
- BaseSize
- ByteSizeLong
- ParseFromArray
- ParsePayload
- PayloadSize
- readLE
- sequence_id
- SerializePayload
- SerializeToArray
- SetTimestamp
- timestamp
- writeLE
Public attributes
Variable sequence_id
Definition: autonomy/communication/messages/autonomy_msg.h (line 48)
uint64_t simulation_framework::autonomy::communication::messages::AutonomyMsg::sequence_id {0ULL}
Sequence identifier for the message (user-settable).
Type: uint64_t
Protected attributes
Variable timestamp_view_
Definition: autonomy/communication/messages/autonomy_msg.h (line 218)
TimestampView simulation_framework::autonomy::communication::messages::AutonomyMsg::timestamp_view_
Internal storage for the timestamp. Use timestamp() and SetTimestamp() for controlled access.
Type: TimestampView
Public functions
Function AutonomyMsg
simulation_framework::autonomy::communication::messages::AutonomyMsg::AutonomyMsg()
Default constructor.
Return type:
Function ByteSizeLong
size_t simulation_framework::autonomy::communication::messages::AutonomyMsg::ByteSizeLong() const noexcept
Total serialized size of this message (base + payload).
Returns:
number of bytes required to SerializeToArray
?> This queries the fixed-size BaseSize() and the derived PayloadSize() for the total length. Use this value to allocate a buffer before calling SerializeToArray().
Return type: size_t
Function timestamp
TimestampView simulation_framework::autonomy::communication::messages::AutonomyMsg::timestamp() const noexcept
Return a view of the message timestamp.
Returns:
TimestampView containing seconds() and nanos()
Return type: TimestampView
Function SetTimestamp
void simulation_framework::autonomy::communication::messages::AutonomyMsg::SetTimestamp(uint64_t seconds, uint64_t nanos) noexcept
Set the message timestamp.
Parameters:
- seconds: Seconds since epoch.
- nanos: Nanoseconds part of the timestamp.
?> Both seconds and nanos are stored as uint64_t to provide a fixed-size, overflow-resistant representation.
Parameters:
Return type: void
Function SerializeToArray
void simulation_framework::autonomy::communication::messages::AutonomyMsg::SerializeToArray(void *data, size_t size) const
Serialize the entire message into the provided buffer.
Parameters:
- data: Pointer to target buffer. Must be non-null.
- size: Size of the provided buffer in bytes.
Exceptions:
- std::runtime_error: If
datais null orsizeis smaller than ByteSizeLong().
?> This writes the common base fields (sequence_id, timestamp) in little-endian byte order and then calls the derived SerializePayload to write the message-specific payload. The function will throw on buffer errors; callers may catch std::runtime_error to recover.
Parameters:
Return type: void
Function ParseFromArray
void simulation_framework::autonomy::communication::messages::AutonomyMsg::ParseFromArray(const void *data, size_t size)
Parse a serialized message from a buffer and populate this object.
Parameters:
- data: Pointer to source buffer. Must be non-null.
- size: Size of source buffer in bytes.
Exceptions:
- std::runtime_error: on parse errors or buffer underflow.
?> ParseFromArray will call the derived ParsePayload to extract message-specific fields. The function throws on any malformed data or buffer underflow.
Parameters:
Return type: void
Protected static functions
Function BaseSize
static constexpr size_t simulation_framework::autonomy::communication::messages::AutonomyMsg::BaseSize() noexcept
Size of common base fields written by SerializeToArray.
Returns:
number of bytes for sequence_id + timestamp (fixed-size)
?> This is a compile-time constant and does not depend on derived classes.
Function readLE
static std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, void >::type simulation_framework::autonomy::communication::messages::AutonomyMsg::readLE(const unsigned char *&ptr, size_t &remaining, T &out)
Read a little-endian encoded primitive value from buffer.
parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"T"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"Integral or floating-point type (e.g., uint32_t, int64_t, float). "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}
Parameters:
- ptr: Reference to current buffer pointer; advanced on success.
- remaining: Reference to remaining bytes in buffer; decreased on success.
- out: Reference to destination where the read value is stored.
Exceptions:
- std::runtime_error: if buffer does not contain enough bytes.
?> This function performs endianness conversion so the caller receives the value in native host representation.
Parameters:
Return type: std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, void >::type
Function writeLE
static std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, void >::type simulation_framework::autonomy::communication::messages::AutonomyMsg::writeLE(unsigned char *&ptr, size_t &remaining, T value)
Write a native C++ integer or floating-point value as little-endian bytes into the provided buffer.
parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"T"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"Integral or floating-point type (e.g., uint32_t, int64_t, float, double) "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}
Parameters:
- ptr: Reference to the current output buffer pointer; advanced on success.
- remaining: Reference to the number of bytes left in the buffer; decreased on success.
- value: The value to write.
Exceptions:
- std::runtime_error: if remaining < sizeof(T).
?> This function converts to little-endian format before writing, so the serialized bytes are portable across host endianness. It is only enabled for arithmetic types; complex or non-trivially-copyable types must be serialized via explicit helpers.
Parameters:
Return type: std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, void >::type
Protected functions
Function PayloadSize
virtual size_t simulation_framework::autonomy::communication::messages::AutonomyMsg::PayloadSize() const noexcept=0
Derived classes must return the size of their payload.
Returns:
number of bytes the derived SerializePayload will write
Return type: size_t
Reimplemented by:
Function SerializePayload
virtual void simulation_framework::autonomy::communication::messages::AutonomyMsg::SerializePayload(unsigned char *&ptr, size_t &remaining) const =0
Derived classes must implement payload serialization.
Parameters:
- ptr: Reference to the current buffer write pointer. Implementations should advance
ptras bytes are written. - remaining: Reference to remaining bytes available in the buffer; update this to reflect bytes consumed.
Exceptions:
- std::runtime_error: on buffer overflow or other serialization errors.
?> Implementations should rely on the provided writeLE helpers which already perform buffer checks and endianness conversion; do not perform manual pointer arithmetic.
Parameters:
Return type: void
Reimplemented by:
Function ParsePayload
virtual void simulation_framework::autonomy::communication::messages::AutonomyMsg::ParsePayload(const unsigned char *&ptr, size_t &remaining)=0
Derived classes must implement payload parsing.
Parameters:
- ptr: Reference to current buffer pointer; advanced as values are read.
- remaining: Reference to remaining bytes in the buffer.
Exceptions:
- std::runtime_error: on malformed payload or underflow.
?> Implementations should use readLE helper to read primitive values and honor endianness.
Parameters:
Return type: void
Reimplemented by: