chrono::ros::core::MessageReader Class Reference

Description

Read-only, schema-backed view over a serialized message.

Does not own the buffer; it must outlive the reader and any BlobView obtained from it.

Access cost: each getter walks the CDR buffer from the start (CDR is a sequential format). This is the right trade for the bridge's traffic pattern - small control messages read a handful of fields, and bulk payloads are fetched with a single GetBlob.

#include <ChROSMessageCodec.h>

Public Member Functions

 MessageReader (std::shared_ptr< const Schema > schema, const uint8_t *data, size_t size)
 
bool GetBool (const std::string &path) const
 
int64_t GetInt (const std::string &path) const
 any integer field (range-checked narrowing)
 
uint64_t GetUInt (const std::string &path) const
 any non-negative integer field
 
double GetDouble (const std::string &path) const
 float fields, or lossless from integers
 
std::string GetString (const std::string &path) const
 
std::vector< std::string > GetStringArray (const std::string &path) const
 
BlobView GetBlob (const std::string &path) const
 Zero-copy view of a primitive array/sequence field.
 
size_t GetCount (const std::string &path) const
 Element count of an array/sequence field (primitive, string or message).
 
MessageReader GetMessage (const std::string &path, size_t index=0) const
 Reader scoped to a nested message: a singular nested field, or element 'index' of a message array/sequence.
 
double GetTimeSec (const std::string &path) const
 Read a builtin_interfaces/Time-shaped nested message as seconds.
 
const SchemaGetSchema () const
 

Constructor & Destructor Documentation

◆ MessageReader()

chrono::ros::core::MessageReader::MessageReader ( std::shared_ptr< const Schema schema,
const uint8_t *  data,
size_t  size 
)
Parameters
datawire-format message (encapsulation header + CDR body)

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