VLink  2.1.0
A high-performance communication middleware
message_parser.h 文件参考

Unified runtime parser for built-in VLink zero-copy wire messages. 更多...

#include <array>
#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include "../base/bytes.h"
#include "../base/macros.h"
#include "./audio_frame.h"
#include "./camera_frame.h"
#include "./object_array.h"
#include "./occupancy_grid.h"
#include "./point_cloud.h"
#include "./proxy_data.h"
#include "./raw_data.h"
#include "./tensor.h"
message_parser.h 的引用(Include)关系图:

浏览源代码.

class  vlink::zerocopy::MessageParser
 Unified parser and field reader for built-in zero-copy messages. 更多...
 
struct  vlink::zerocopy::MessageParser::Field
 Schema-neutral field descriptor returned by field enumeration. 更多...
 
struct  vlink::zerocopy::MessageFormatOptions
 Presentation toggles for format_message. 更多...
 

命名空间

 
 

函数

VLINK_EXPORT std::string vlink::zerocopy::format_message (const MessageParser &parser, const MessageFormatOptions &options, bool *truncated=nullptr)
 Renders a parsed zero-copy message as canonical human-readable text. 更多...
 

详细描述

Unified runtime parser for built-in VLink zero-copy wire messages.

MessageParser centralises type detection, deserialization, indexed field access, collection bounds, and exact integer representation for all eight built-in VLink zero-copy wire types. Root paths use names such as header.time_meas and width. Indexed payloads use data[N].field; tensors additionally expose shape[N] and strides[N].

Integer fields remain int64_t or uint64_t in MessageParser::Value. Conversion through numeric reports values outside the exact IEEE-754 integer range. Deserialized containers borrow the input wire storage; the input must therefore outlive the parser and any returned Bytes view.

Parsing and access flow
*   serialized type + wire Bytes
*               |
*               v
*      MessageParser::detect_type
*               |
*               v
*      MessageParser::parse  ---- failure ----> invalid / empty state
*               |
*               +----> exact field: value(path)
*               |
*               +----> collection: value(name, index, field)
* 
Path and value mapping
Payload kind Example path Value alternative
Header / metadata header.time_meas uint64_t
Point record data[4].intensity Schema-dependent
Object record objects[2].track_id uint64_t
Grid / tensor cell data[7] Dtype-dependent
Tensor dimension shape[1] / strides[1] uint64_t
Raw payload data / raw Borrowed Bytes
Collection mapping
Message type Indexed collections Element field form
RawData None
CameraFrame None
PointCloud data / points Dynamic point key
ProxyData None
OccupancyGrid data / cells Empty or value
Tensor data / elements, shape, strides Empty or value
ObjectArray data / objects Object member or alias
AudioFrame data Empty or value
Example – parse and read an exact integer field
if (!parser.parse("vlink::zerocopy::ObjectArray", wire)) {
return;
}
if (parser.value("data[0].track_id", value)) {
consume(std::get<uint64_t>(value));
}