Struct CdrReader
#include <serialization.hpp>
Public Attributes
| Type | Name |
|---|---|
| const uint8_t * | buf Payload start (points at wire header + 4). |
| std::size_t | len Payload length (wire_len - 4). |
| std::size_t | pos Current payload cursor. |
| bool | swap_bytes = { false }true when the wire encapsulation is big-endian. |
Public Functions
| Type | Name |
|---|---|
| void | align (std::size_t a) |
| bool | read_bytes (void * dst, std::size_t n) Copy n bytes intodst and advance the cursor. |
| bool | read_u16 (uint16_t & v) Read a 2-byte value (either endianness) after aligning to 2 bytes. |
| bool | read_u32 (uint32_t & v) Read a 4-byte value (either endianness) after aligning to 4 bytes. |
| bool | read_u64 (uint64_t & v) Read an 8-byte value (either endianness) after aligning to 8 bytes. |
| bool | read_u8 (uint8_t & v) Read a single byte and advance the cursor. |
Detailed Description
Stateful walker over a CDR-encoded payload range.
buf points at the payload (after the 4-byte header); align() adds 4 before taking the modulus so alignment is measured from byte 0 of the wire buffer. Supports both little- and big-endian wire encapsulations (the host is always assumed little-endian per cdr_write_le); the caller sets swap_bytes from the encapsulation header's representation-id kind before the first read.
Public Attributes Documentation
variable buf
Payload start (points at wire header + 4).
const uint8_t* CdrReader::buf;
variable len
Payload length (wire_len - 4).
std::size_t CdrReader::len;
variable pos
Current payload cursor.
std::size_t CdrReader::pos;
variable swap_bytes
true when the wire encapsulation is big-endian.
bool CdrReader::swap_bytes;
Public Functions Documentation
function align
inline void CdrReader::align (
std::size_t a
)
Advance pos so the next read is at an a-byte boundary measured from the wire buffer's byte 0.
function read_bytes
Copy n bytes intodst and advance the cursor.
inline bool CdrReader::read_bytes (
void * dst,
std::size_t n
)
function read_u16
Read a 2-byte value (either endianness) after aligning to 2 bytes.
inline bool CdrReader::read_u16 (
uint16_t & v
)
function read_u32
Read a 4-byte value (either endianness) after aligning to 4 bytes.
inline bool CdrReader::read_u32 (
uint32_t & v
)
function read_u64
Read an 8-byte value (either endianness) after aligning to 8 bytes.
inline bool CdrReader::read_u64 (
uint64_t & v
)
function read_u8
Read a single byte and advance the cursor.
inline bool CdrReader::read_u8 (
uint8_t & v
)
The documentation for this class was generated from the following file include/astutedds/rmw/serialization.hpp