98 #include <string_view>
102 #include "../base/bytes.h"
103 #include "../base/macros.h"
176 kEnumCameraFormat = 1,
177 kEnumCameraStream = 2,
178 kEnumGridCellType = 3,
179 kEnumTensorDataType = 4,
180 kEnumTensorDevice = 5,
181 kEnumAudioFormat = 6,
182 kEnumAudioLayout = 7,
183 kEnumFastBufferStorage = 8,
184 kEnumFastBufferMemory = 9,
194 uint16_t native_type{0};
195 uint16_t storage_size{0};
199 bool is_reserved{
false};
200 size_t byte_offset{0};
201 size_t element_index{
static_cast<size_t>(-1)};
208 using Value = std::variant<int64_t, uint64_t, double, std::string, Bytes>;
243 bool parse(std::string_view serialized_type, const
Bytes& bytes);
257 void clear() noexcept;
262 [[nodiscard]]
Type type() const noexcept;
267 [[nodiscard]]
bool valid() const noexcept;
276 bool value(std::string_view path,
Value& out) const;
287 bool value(std::string_view collection,
size_t index, std::string_view field,
Value& out) const;
296 bool value(std::string_view collection,
size_t index, const
Field& field,
Value& out) const;
306 bool numeric(std::string_view path,
double& out,
bool* precision_loss =
nullptr) const;
318 bool numeric(std::string_view collection,
size_t index, std::string_view field,
double& out,
319 bool* precision_loss =
nullptr) const;
324 bool numeric(std::string_view collection,
size_t index, const
Field& field,
double& out,
325 bool* precision_loss =
nullptr) const;
334 bool text(std::string_view path, std::
string& out) const;
345 bool text(std::string_view collection,
size_t index, std::string_view field, std::
string& out) const;
353 [[nodiscard]]
size_t collection_size(std::string_view collection) const noexcept;
360 [[nodiscard]] std::vector<
Field> fields() const;
368 [[nodiscard]] std::vector<
Field> element_fields(std::string_view collection) const;
381 template <typename T>
382 bool copy_to(T& out) const;
390 static
Type detect_type(std::string_view serialized_type) noexcept;
398 static std::string_view type_name(
Type type) noexcept;
404 template <typename T>
405 [[nodiscard]] const T*
get() const noexcept;
410 bool root_value(std::string_view path,
Value& out) const;
415 bool element_value(std::string_view collection,
size_t index, std::string_view field,
Value& out) const;
420 bool point_value(
size_t index, const
Field& field,
Value& out) const;
424 std::array<uint64_t, 5> reserved_{};
425 std::vector<Field> point_fields_;
426 std::vector<size_t> point_field_buckets_;
427 std::vector<size_t> point_field_next_;
438 template <
typename T>
440 const auto* message = get<T>();
450 template <
typename T>
451 inline const T* MessageParser::get() const noexcept {
452 return std::get_if<T>(&message_);
484 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:132
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:439
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:434
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:208
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:138
ValueType
Exact C++ alternative stored by Value for a field.
Definition: message_parser.h:155
bool valid() const noexcept
Returns whether the parser currently retains a successfully decoded message.
Definition: message_parser.h:436
~MessageParser()=default
Releases the retained typed message.
EnumKind
Built-in enumeration a scalar field maps to, for symbolic-name rendering.
Definition: message_parser.h:174
MessageParser & operator=(const MessageParser &)=delete
Platform-independent buffer with a Header and a pointer-free wire envelope.
#define VUNLIKELY(...)
Short alias for VLINK_UNLIKELY.
Definition: macros.h:292
#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.
Holds a local memory address and an owned provider reference.
Definition: fast_buffer.h:138
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:191
std::string name
Canonical path or collection element field name.
Definition: message_parser.h:192
Zero-copy N-dimensional dense tensor container with shape, strides, and dtype metadata.