chrono::ros::core::CdrReader Class Reference

Description

Bounds-checked reader over a CDR-encoded byte range. Does not own the data.

#include <ChROSCdr.h>

Public Member Functions

 CdrReader (const uint8_t *data, size_t size, bool with_encapsulation=true)
 
bool ReadBool ()
 
uint8_t ReadUInt8 ()
 
int8_t ReadInt8 ()
 
uint16_t ReadUInt16 ()
 
int16_t ReadInt16 ()
 
uint32_t ReadUInt32 ()
 
int32_t ReadInt32 ()
 
uint64_t ReadUInt64 ()
 
int64_t ReadInt64 ()
 
float ReadFloat32 ()
 
double ReadFloat64 ()
 
std::string ReadString ()
 
void ReadBytes (void *out, size_t size)
 Read raw bytes (no alignment, no length prefix).
 
std::vector< uint8_t > ReadBlob ()
 Read a length-prefixed byte blob written by CdrWriter::WriteBlob.
 
void Align (size_t alignment)
 Advance to the given alignment relative to the encapsulation origin.
 
void Skip (size_t size)
 Skip forward without copying (bounds-checked).
 
size_t Position () const
 Current read position (absolute offset from the start of the data).
 
size_t Remaining () const
 Bytes remaining.
 
const uint8_t * Current () const
 Pointer to the current position (valid for Remaining() bytes). More...
 

Constructor & Destructor Documentation

◆ CdrReader()

chrono::ros::core::CdrReader::CdrReader ( const uint8_t *  data,
size_t  size,
bool  with_encapsulation = true 
)
Parameters
datastart of the CDR data (encapsulation header first, if any)
sizetotal size in bytes
with_encapsulationif true, a 4-byte encapsulation header is validated (must be CDR little-endian) and alignment is computed after it. Big-endian input is rejected with a clear error.

Member Function Documentation

◆ Current()

const uint8_t* chrono::ros::core::CdrReader::Current ( ) const
inline

Pointer to the current position (valid for Remaining() bytes).

Used for zero-copy access to bulk primitive arrays.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_ros/core/ChROSCdr.h
  • /builds/uwsbel/chrono/src/chrono_ros/core/ChROSCdr.cpp