97 #include <string_view>
101 #include "../base/bytes.h"
102 #include "../base/macros.h"
173 kEnumCameraFormat = 1,
174 kEnumCameraStream = 2,
175 kEnumGridCellType = 3,
176 kEnumTensorDataType = 4,
177 kEnumTensorDevice = 5,
178 kEnumAudioFormat = 6,
179 kEnumAudioLayout = 7,
189 uint16_t native_type{0};
190 uint16_t storage_size{0};
194 bool is_reserved{
false};
195 size_t byte_offset{0};
196 size_t element_index{
static_cast<size_t>(-1)};
203 using Value = std::variant<int64_t, uint64_t, double, std::string, Bytes>;
238 bool parse(std::string_view serialized_type, const
Bytes& bytes);
252 void clear() noexcept;
257 [[nodiscard]]
Type type() const noexcept;
262 [[nodiscard]]
bool valid() const noexcept;
271 bool value(std::string_view path,
Value& out) const;
282 bool value(std::string_view collection,
size_t index, std::string_view field,
Value& out) const;
291 bool value(std::string_view collection,
size_t index, const
Field& field,
Value& out) const;
301 bool numeric(std::string_view path,
double& out,
bool* precision_loss =
nullptr) const;
313 bool numeric(std::string_view collection,
size_t index, std::string_view field,
double& out,
314 bool* precision_loss =
nullptr) const;
319 bool numeric(std::string_view collection,
size_t index, const
Field& field,
double& out,
320 bool* precision_loss =
nullptr) const;
329 bool text(std::string_view path, std::
string& out) const;
340 bool text(std::string_view collection,
size_t index, std::string_view field, std::
string& out) const;
348 [[nodiscard]]
size_t collection_size(std::string_view collection) const noexcept;
355 [[nodiscard]] std::vector<
Field> fields() const;
363 [[nodiscard]] std::vector<
Field> element_fields(std::string_view collection) const;
375 template <typename T>
376 bool copy_to(T& out) const;
384 static
Type detect_type(std::string_view serialized_type) noexcept;
392 static std::string_view type_name(
Type type) noexcept;
398 template <typename T>
399 [[nodiscard]] const T*
get() const noexcept;
404 bool root_value(std::string_view path,
Value& out) const;
409 bool element_value(std::string_view collection,
size_t index, std::string_view field,
Value& out) const;
414 bool point_value(
size_t index, const
Field& field,
Value& out) const;
418 std::array<uint64_t, 5> reserved_{};
419 std::vector<Field> point_fields_;
420 std::vector<size_t> point_field_buckets_;
421 std::vector<size_t> point_field_next_;
432 template <
typename T>
433 inline const T* MessageParser::get() const noexcept {
434 return std::get_if<T>(&message_);
437 template <
typename T>
439 const auto* message = get<T>();
478 bool* truncated =
nullptr);
Zero-copy audio frame container carrying one PCM or codec-encoded packet.
Zero-copy container for a single image / video frame plus pixel-format metadata.
Fixed-size 128-byte buffer holder with SBO, five ownership modes and integrated codecs.
Definition: bytes.h:120
Unified parser and field reader for built-in zero-copy messages.
Definition: message_parser.h:130
MessageParser(const MessageParser &)=delete
Parsers are non-copyable because decoded containers may borrow wire storage.
bool copy_to(T &out) const
Deep-copies the retained message into a matching typed container.
Definition: message_parser.h:438
MessageParser()=default
Constructs an invalid parser with no retained message.
Type type() const noexcept
Returns the retained built-in type, or kUnknown when invalid.
Definition: message_parser.h:428
std::variant< int64_t, uint64_t, double, std::string, Bytes > Value
Exact schema-neutral field value without implicit integer-to-double conversion.
Definition: message_parser.h:203
MessageParser(MessageParser &&) noexcept=default
Move-constructs or move-assigns the retained parser state.
Type
Built-in zero-copy wire type retained by the parser.
Definition: message_parser.h:136
ValueType
Exact C++ alternative stored by Value for a field.
Definition: message_parser.h:152
bool valid() const noexcept
Returns whether the parser currently retains a successfully decoded message.
Definition: message_parser.h:430
~MessageParser()=default
Releases the retained typed message.
EnumKind
Built-in enumeration a scalar field maps to, for symbolic-name rendering.
Definition: message_parser.h:171
MessageParser & operator=(const MessageParser &)=delete
#define VUNLIKELY(...)
Short alias for VLINK_UNLIKELY.
Definition: macros.h:289
#define VLINK_EXPORT
Definition: macros.h:81
constexpr std::string_view get() noexcept
Returns the trimmed compile-time identifier for TypeT.
Definition: name_detector.h:603
@ kUnknown
Placeholder for unrecognised status events.
Definition: status.h:119
VLINK_EXPORT std::string format_message(const MessageParser &parser, const MessageFormatOptions &options, bool *truncated=nullptr)
Renders a parsed zero-copy message as canonical human-readable text.
Zero-copy variable-length array of fixed-size 3-D detection / tracking records.
Zero-copy 2-D occupancy / cost-map grid container with typed cell storage.
Zero-copy, schema-aware 3-D point cloud container with per-field type protocol.
Routing envelope used by the VLink proxy / monitoring path.
Generic zero-copy byte-buffer container with a Header prefix.
128-byte POD container holding one audio packet with full sample-format metadata.
80-byte POD container holding one camera / video frame plus image-format metadata.
112-byte POD container holding a packed array of 144-byte Object records.
152-byte POD container holding a typed 2-D occupancy / cost grid plus pose metadata.
256-byte POD container holding a schema-described array of N-field point records.
80-byte POD envelope packing payload, URL, serialisation type and host string.
64-byte POD container that wraps an opaque byte payload with a Header prefix.
248-byte POD container holding a dense N-D tensor plus shape / dtype / device metadata.
Schema-neutral field descriptor returned by field enumeration.
Definition: message_parser.h:186
std::string name
Canonical path or collection element field name.
Definition: message_parser.h:187
Zero-copy N-dimensional dense tensor container with shape, strides, and dtype metadata.