VLink  2.0.0
A high-performance communication middleware
vlink::zerocopy Namespace Reference

Functions

struct VLINK_EXPORT_AND_ALIGNED (8) AudioFrame final
 
constexpr uint32_t version_major (uint32_t version) noexcept
 Extracts the major component from an encoded zero-copy wire version. More...
 

Variables

constexpr uint32_t kWireVersion
 Encoded VLink library version stamped into every zero-copy wire envelope. More...
 

Function Documentation

◆ version_major()

constexpr uint32_t vlink::zerocopy::version_major ( uint32_t  version)
inlineconstexprnoexcept

Extracts the major component from an encoded zero-copy wire version.

Parameters
versionEncoded version as produced by kWireVersion.
Returns
Major component, i.e. version / 1000000.
Here is the caller graph for this function:

◆ VLINK_EXPORT_AND_ALIGNED()

struct vlink::zerocopy::VLINK_EXPORT_AND_ALIGNED ( )
final

Encoded sample format of the audio payload.

< Uninitialised / unspecified format.

< Signed 16-bit linear PCM.

< Signed 24-bit linear PCM packed into 3 bytes.

< Signed 32-bit linear PCM.

< IEEE-754 single-precision linear PCM.

< Unsigned 8-bit linear PCM.

< Opus codec payload.

< AAC codec payload.

< MP3 codec payload.

< FLAC codec payload.

Arrangement of multi-channel samples within the payload buffer.

< Uninitialised / unspecified layout.

< Channels interleaved per-sample (L R L R ...).

< Channels stored in consecutive contiguous planes.

Default-constructs an empty frame and asserts the 128-byte contract.

Frees the owned audio buffer when is_owner() is true.

Deep-copies target into a freshly allocated frame.

Parameters
targetSource frame to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource frame moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource frame to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource frame moved from.
Returns
Reference to *this.

Deserialises an AudioFrame from bytes with zero-copy borrowing semantics.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus audio bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when too small.
Returns
Always true.

Validates that bytes carries a well-formed AudioFrame envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when the magic sentinels match and the minimum length holds.

Total bytes that operator>> would write for this frame.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(AudioFrame) + size() + sizeof(magic_end).

Whether the audio buffer pointer is non-null and its size is positive.

Returns
true when the frame holds usable audio data.

Borrows target's audio buffer without copying.

Parameters
targetSource frame whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's audio.

Parameters
targetSource frame to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource frame moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned audio buffer of size bytes.

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned audio buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Capture-side timestamp in nanoseconds.

Returns
Stored value.

Advertised frame duration in nanoseconds.

Returns
Stored value.

Codec hint string (e.g. "PCM", "OPUS").

Returns
Non-owning view into the embedded buffer.

Language tag used by speech-to-text consumers (e.g. "en", "zh").

Returns
Non-owning view into the embedded buffer.

Microphone / sensor channel identifier.

Returns
Stored value.

Nominal publish frequency in Hz.

Returns
Stored value.

PCM sample rate in Hz (e.g. 48 000).

Returns
Stored value.

Number of samples per channel within the buffer.

Returns
Stored value.

Compressed bitrate in bits per second (zero for uncompressed PCM).

Returns
Stored value.

Channel count (1 = mono, 2 = stereo, ...).

Returns
Stored value.

Bit depth per PCM sample (16, 24, 32, ...).

Returns
Stored value.

Encoded sample format tag.

Returns
Format enum value.

Multi-channel layout tag.

Returns
Layout enum value.

Read-only pointer to the audio bytes.

Returns
Pointer to payload start.

Audio buffer size in bytes.

Returns
Byte count.

Whether this frame owns its audio buffer.

Returns
true when the destructor would free the buffer.

Stores the capture-side timestamp.

Parameters
update_time_nsTimestamp in nanoseconds.

Stores the advertised frame duration.

Parameters
duration_nsDuration in nanoseconds.

Stores the codec hint, truncated to sizeof(codec) - 1 bytes.

Parameters
codecCodec label.

Stores the language tag, truncated to sizeof(language) - 1 bytes.

Parameters
languageLanguage identifier.

Stores the microphone / sensor channel identifier.

Parameters
channelChannel id.

Stores the nominal publish frequency.

Parameters
freqFrequency in Hz.

Stores the PCM sample rate.

Parameters
sample_rateSample rate in Hz.

Stores the number of samples per channel.

Parameters
num_samplesSample count.

Stores the compressed bitrate.

Parameters
bitrateBitrate in bits per second.

Stores the channel count.

Parameters
num_channelsChannel count.

Stores the PCM bit depth.

Parameters
bit_depthBit depth.

Stores the sample format tag.

Parameters
formatFormat enum value.

Stores the channel layout tag.

Parameters
layoutLayout enum value.

Mutable accessor for the first wire-locked reserved field (uint8_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf2_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Pixel / codec encoding of the image payload.

< Uninitialised / unspecified format.

< Planar YUV 4:2:0 (I420).

< Planar YUV 4:2:2.

< Planar YUV 4:4:4.

< Semi-planar Y + interleaved UV (4:2:0).

< Semi-planar Y + interleaved VU (4:2:0).

< Packed YUYV 4:2:2.

< Packed YVYU 4:2:2.

< Packed UYVY 4:2:2.

< Packed VYUY 4:2:2.

< Packed 24-bit BGR (3 bytes per pixel).

< Packed 24-bit RGB (3 bytes per pixel).

< Planar 24-bit RGB (separate R, G, B planes).

< JPEG bitstream.

< H.264 / AVC frame.

< H.265 / HEVC frame.

Stream-frame type for compressed video payloads.

< Uninitialised / unspecified frame type.

< Intra-coded key frame.

< Predicted frame referencing earlier frames.

< Bi-directionally predicted frame.

Default-constructs an empty frame and asserts the 80-byte contract.

Frees the owned pixel buffer when is_owner() is true.

Deep-copies target into a freshly allocated frame.

Parameters
targetSource frame to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource frame moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource frame to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource frame moved from.
Returns
Reference to *this.

Deserialises a CameraFrame from bytes with zero-copy borrowing semantics.

Validates the magic-number envelope and total length, then borrows the pixel pointer from bytes. Callers must keep bytes alive for as long as this CameraFrame is in use.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus pixel bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed CameraFrame envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this frame.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(CameraFrame) + size() + sizeof(magic_end).

Whether the pixel buffer pointer is non-null and its size is positive.

Returns
true when the frame holds usable pixel data.

Borrows target's pixel buffer without copying.

Parameters
targetSource frame whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's pixels.

Parameters
targetSource frame to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource frame moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned pixel buffer of size bytes.

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned pixel buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Camera channel / sensor index.

Returns
Stored channel id.

Image width in pixels.

Returns
Stored width.

Image height in pixels.

Returns
Stored height.

Capture frequency in frames per second.

Returns
Stored frequency.

Pixel / codec encoding tag.

Returns
Format enum value.

Video stream-frame type tag.

Returns
Stream enum value.

Read-only pointer to the pixel bytes.

Returns
Pointer to payload start; may be non-null with size() == 0 for empty deserialised frames.

Pixel buffer size in bytes.

Returns
Byte count, or 0 when empty.

Whether this frame owns its pixel buffer.

Returns
true when the destructor would free the buffer.

Stores the camera channel / sensor index.

Parameters
channelChannel id.

Stores the image width in pixels.

Parameters
widthPixel width.

Stores the image height in pixels.

Parameters
heightPixel height.

Stores the capture frequency.

Parameters
freqCapture rate in Hz.

Stores the pixel / codec encoding tag.

Parameters
formatFormat enum value.

Stores the video stream-frame type tag.

Parameters
streamStream enum value.

Mutable accessor for the 32-bit reserved slot in the wire format.

Returns
Reference to reserved_buf_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

< Coordinate-frame / sensor identifier; not necessarily NUL-terminated.

< Monotonically increasing per-publisher sequence; wraps at UINT32_MAX.

< Reserved bytes; part of the wire contract, must not be repurposed.

< Capture / acquisition timestamp in nanoseconds since the UNIX epoch.

< Dispatch / publish timestamp in nanoseconds since the UNIX epoch.

Default constructor that asserts the 40-byte sizeof contract.

The static_assert inside the constructor body guarantees that any accidental field reordering or padding change breaks the build instead of silently corrupting the wire format.

Returns a bounded view over frame_id so consumers cannot read past the buffer.

frame_id may be filled to its full 16-byte capacity without a terminator, so this helper uses strnlen to compute the view length safely.

Returns
Non-owning view over the populated portion of frame_id.

Per-cell storage type tag (drives cell_size()).

< Uninitialised / unspecified cell type.

< Signed 8-bit cell (ROS nav_msgs/OccupancyGrid style).

< Unsigned 8-bit cell (0..255 costmap / grayscale).

< Unsigned 16-bit cell (high-resolution costmap).

< IEEE-754 single-precision cell (log-odds, probability, SDF).

Default-constructs an empty grid and asserts the 152-byte contract.

Frees the owned cell buffer when is_owner() is true.

Deep-copies target into a freshly allocated grid.

Parameters
targetSource grid to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource grid moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource grid to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource grid moved from.
Returns
Reference to *this.

Deserialises an OccupancyGrid from bytes with zero-copy borrowing semantics.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus cell bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed OccupancyGrid envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this grid.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(OccupancyGrid) + size() + sizeof(magic_end).

Whether the cell buffer pointer is non-null and the byte size is positive.

Returns
true when the grid holds usable cell data.

Borrows target's cell buffer without copying.

Parameters
targetSource grid whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's cells.

Parameters
targetSource grid to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource grid moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned cell buffer of size bytes.

The caller is responsible for keeping size consistent with width() * height() * cell_size().

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned cell buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned cell buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Producer-side timestamp recording when the map was last updated.

Returns
Stored nanosecond timestamp.

Unique map identifier (e.g. "local", "global", "lane").

Returns
Non-owning view into the embedded buffer.

Sensor / producer channel identifier.

Returns
Stored channel id.

Nominal publish frequency in Hz.

Returns
Stored value.

Grid width in cells (columns).

Returns
Stored width.

Grid height in cells (rows).

Returns
Stored height.

Number of cells whose value differs from default_value() (producer-supplied hint).

Returns
Stored count; zero means "not provided".

Cell side length in metres.

Returns
Stored resolution.

World-frame X coordinate of the bottom-left grid corner.

Returns
Stored origin X.

World-frame Y coordinate of the bottom-left grid corner.

Returns
Stored origin Y.

World-frame Z coordinate of the 2-D plane.

Returns
Stored origin Z.

Yaw rotation of the grid origin in radians (REP-103).

Returns
Stored origin yaw.

Lower bound of cell values used for normalisation / visualisation.

Returns
Stored minimum.

Upper bound of cell values used for normalisation / visualisation.

Returns
Stored maximum.

Value used for unknown / uninitialised cells.

Returns
Stored default value (e.g. -1 for ROS int8 occupancy).

Threshold above which a cell is considered occupied.

Returns
Stored threshold.

Threshold below which a cell is considered free.

Returns
Stored threshold.

Per-cell storage type tag.

Returns
CellType enum value.

Byte size of one cell derived from cell_type().

Returns
Cell stride in bytes (0 for kCellUnknown).

Read-only pointer to the cell bytes.

Returns
Pointer to payload start.

Cell buffer size in bytes.

Returns
Byte count, or 0 when empty.

Whether this grid owns its cell buffer.

Returns
true when the destructor would free the buffer.

Stores the producer-side map timestamp.

Parameters
update_time_nsTimestamp in nanoseconds.

Stores the unique map identifier (truncated to sizeof(map_id) - 1 bytes).

Parameters
map_idIdentifier string.

Stores the sensor / producer channel identifier.

Parameters
channelChannel id.

Stores the nominal publish frequency.

Parameters
freqFrequency in Hz.

Stores the grid width.

Parameters
widthNumber of columns.

Stores the grid height.

Parameters
heightNumber of rows.

Stores the count of cells differing from the default value.

Parameters
valid_cell_countProducer-supplied hint.

Stores the cell resolution.

Parameters
resolutionMetres per cell.

Stores the world-frame X origin.

Parameters
origin_xWorld X coordinate of the bottom-left corner.

Stores the world-frame Y origin.

Parameters
origin_yWorld Y coordinate of the bottom-left corner.

Stores the world-frame Z value of the 2-D plane.

Parameters
origin_zWorld Z coordinate of the plane.

Stores the yaw rotation of the grid origin.

Parameters
origin_yawRotation in radians (REP-103).

Stores the lower bound for cell values.

Parameters
value_minStored minimum.

Stores the upper bound for cell values.

Parameters
value_maxStored maximum.

Stores the value used for unknown cells.

Parameters
default_valueDefault cell value.

Stores the occupied threshold.

Parameters
occupied_thresholdStored threshold.

Stores the free threshold.

Parameters
free_thresholdStored threshold.

Stores the per-cell storage type tag.

Parameters
cell_typeCellType enum value.

Returns the byte size of one cell of type.

Parameters
typeCell type tag.
Returns
Cell stride in bytes (0 for kCellUnknown).

Mutable accessor for the first wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf2_.

Mutable accessor for the third wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf3_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Default-constructs an empty envelope and asserts the 80-byte contract.

Frees the owned tail buffer when is_owner() is true.

Deep-copies target into a freshly allocated envelope.

Parameters
targetSource envelope to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource envelope moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource envelope to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource envelope moved from.
Returns
Reference to *this.

Deserialises an envelope from bytes with zero-copy borrowing semantics.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or region inconsistency.

Serialises the struct snapshot plus tail buffer into bytes.

Parameters
bytesOutput buffer; reallocated automatically when undersized.
Returns
Always true.

Proxy control identifier set by set_control_id().

Returns
Stored control id.

Proxy operation mode set by set_mode().

Returns
Stored mode value.

Microsecond-resolution timestamp set by set_timestamp().

Returns
Timestamp.

Sequence number set by set_seq().

Returns
Sequence number.

Coarse schema family tag set by set_schema().

Returns
Numeric SchemaType value.

Shallow Bytes view of the raw payload region (no copy).

Returns
Bytes pointing into the internal tail buffer; lifetime tracks *this.

View of the URL region within the internal tail buffer.

Returns
Non-owning view, or empty when no URL was provided.

View of the serialisation-type region within the internal tail buffer.

Returns
Non-owning view, or empty when no serialisation label was provided.

View of the optional source hostname region.

Returns
Non-owning view, or empty when no hostname was provided.

Stores the proxy control identifier.

Parameters
control_idIdentifier value.

Stores the proxy operation mode.

Parameters
modeMode value.

Stores the microsecond-resolution timestamp.

Parameters
timestampTimestamp value.

Stores the message sequence number.

Parameters
seqSequence number.

Stores the coarse schema family tag.

Parameters
schemaNumeric SchemaType value.

Validates that bytes carries a well-formed ProxyData envelope.

Parameters
bytesWire buffer to inspect.
Returns
true on magic match and minimum-size check.

Total bytes that operator>> writes for this envelope.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(ProxyData) + size() + sizeof(magic_end).

Validates that internal region positions and sizes are consistent.

Confirms the four sub-regions are contiguous, sum to size(), and the data pointer is non-null. Useful after operator<< when forwarding untrusted input.

Returns
true when the layout is internally consistent.

Borrows target's tail buffer without copying.

Parameters
targetSource envelope; its backing buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and clones target's payload.

Parameters
targetSource envelope to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource envelope moved from.
Returns
false on self-move, otherwise true.

Builds the envelope by packing all four regions into a single allocation.

Allocates raw.size() + url.size() + ser.size() + hostname.size() bytes and copies each region in order. If any region (or the total) would exceed UINT32_MAX the envelope is cleared. Callers passing dynamic input must verify success via is_valid() or size().

Parameters
rawRaw payload bytes.
urlTopic URL string.
serSerialisation type label.
schemaOptional coarse schema family tag.
hostnameOptional source hostname.

Frees the owned buffer (if any) and zeroes every field.

Total size of the variable-length tail buffer.

Returns
Byte count, or 0 when empty.

Whether this envelope currently owns its tail buffer.

Returns
true when the destructor would free the buffer.

Mutable accessor for the first wire-locked reserved field (uint8_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf2_.

< Marker probed by the VLink type-trait machinery.

Default-constructs an empty container and verifies the sizeof contract.

Releases the owned buffer when is_owner() is true.

Deep-copies the payload of target into a freshly allocated owned buffer.

Parameters
targetSource container to clone.

Steals target's ownership and metadata; target is left empty.

Parameters
targetSource container moved from.

Deep-copy-assigns from target; self-assignment is a no-op.

Parameters
targetSource container to clone.
Returns
Reference to *this.

Move-assigns target's resources into *this; self-assignment is a no-op.

Parameters
targetSource container moved from.
Returns
Reference to *this.

Deserialises a RawData from bytes using zero-copy borrowing semantics.

Validates the magic-number envelope and total length, then borrows the payload pointer from bytes. The caller must keep bytes alive for as long as this RawData is used.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus payload into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed RawData envelope.

Parameters
bytesBuffer to inspect.
Returns
true when the magic sentinels match and the minimum length holds.

Total bytes that operator>> would write for this container.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(RawData) + size() + sizeof(magic_end).

Whether the payload pointer is non-null and the byte size is positive.

Returns
true when the container holds usable data.

Borrows target's payload pointer without copying.

Parameters
targetSource container whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's payload.

Parameters
targetSource container to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target becomes empty.

Parameters
targetSource container moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned buffer of size bytes.

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and zeroes the Header.

Borrows an externally owned raw byte buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer (allocating as needed).

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Mutable accessor for the 16-bit user-reserved field carried in the wire format.

Returns
Reference to reserved_buf_.

Read-only pointer to the payload bytes.

Returns
Pointer to payload start; may be non-null with size() == 0 for empty deserialised frames.

Payload size in bytes (0 when empty).

Returns
Byte count.

Whether this container currently owns its buffer.

Returns
true when the destructor would free the buffer.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Maximum number of dimensions a single Tensor may carry.

Scalar element type tag (drives element_size()).

< Uninitialised / unspecified element type.

< bool (1 byte).

< int8_t (1 byte).

< uint8_t (1 byte).

< int16_t (2 bytes).

< uint16_t (2 bytes).

< int32_t (4 bytes).

< uint32_t (4 bytes).

< int64_t (8 bytes).

< uint64_t (8 bytes).

< IEEE-754 half precision (2 bytes).

< Brain float (2 bytes).

< IEEE-754 single precision (4 bytes).

< IEEE-754 double precision (8 bytes).

Device hint indicating where the data buffer physically lives.

< Host / CPU memory.

< Discrete or integrated GPU memory.

< Neural processing unit (e.g. automotive NPU).

< Digital signal processor.

Default-constructs an empty tensor and asserts the 248-byte contract.

Frees the owned data buffer when is_owner() is true.

Deep-copies target into a freshly allocated tensor.

Parameters
targetSource tensor to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource tensor moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource tensor to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource tensor moved from.
Returns
Reference to *this.

Deserialises a Tensor from bytes with zero-copy borrowing semantics.

Two fields are sanitised after the struct snapshot is restored: rank_ is clamped to kMaxRank, and element_size_ is re-derived from dtype_ to stay consistent regardless of producer-side mistakes.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success.

Serialises the struct snapshot plus element bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed Tensor envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this tensor.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(Tensor) + size() + sizeof(magic_end).

Whether the data buffer pointer is non-null and the byte size is positive.

Returns
true when the tensor holds usable data.

Borrows target's data buffer without copying.

Parameters
targetSource tensor whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's elements.

Parameters
targetSource tensor to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource tensor moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned data buffer of size bytes.

The caller is responsible for keeping size consistent with num_elements() * element_size().

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned data buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Producer-side tensor timestamp in nanoseconds.

Returns
Stored value.

Cached total element count (product of shape() dimensions).

Returns
Stored element count.

Tensor name (e.g. "image", "hidden_state").

Returns
Non-owning view into the embedded buffer.

Source model identifier.

Returns
Non-owning view into the embedded buffer.

Layout label (e.g. "NCHW", "NHWC", "BLC").

Returns
Non-owning view into the embedded buffer.

Read-only pointer to the kMaxRank-sized shape array.

Returns
Pointer into the embedded array; never nullptr.

Shape value at dimension dim, or 0 if dim is out of range.

Parameters
dimDimension index.
Returns
Shape entry.

Read-only pointer to the kMaxRank-sized stride array (in elements, not bytes).

Returns
Pointer into the embedded array; never nullptr.

Stride value at dimension dim, or 0 if dim is out of range.

Parameters
dimDimension index.
Returns
Stride entry.

Sensor / producer / output-port channel identifier.

Returns
Stored channel id.

Nominal publish frequency in Hz.

Returns
Stored value.

Cached batch size (typically shape_at(0)).

Returns
Stored batch size.

INT8 quantisation scale (0 when unused).

Returns
Stored scale.

INT8 quantisation zero point (0 when unused).

Returns
Stored zero point.

Scalar element type tag.

Returns
DataType enum value.

Actual tensor rank in the range 1..kMaxRank.

Returns
Stored rank.

Device hint indicating where the data buffer lives.

Returns
Device enum value.

Cached byte size of one element derived from dtype().

Returns
Element size in bytes.

Read-only pointer to the element bytes.

Returns
Pointer to payload start.

Element buffer size in bytes.

Returns
Byte count.

Whether this tensor owns its data buffer.

Returns
true when the destructor would free the buffer.

Stores the tensor timestamp.

Parameters
update_time_nsTimestamp in nanoseconds.

Stores the tensor name (truncated to sizeof(name) - 1 bytes).

Parameters
nameTensor name.

Stores the source model identifier (truncated to sizeof(model_id) - 1 bytes).

Parameters
model_idModel identifier.

Stores the layout label (truncated to sizeof(layout) - 1 bytes).

Parameters
layoutLayout descriptor.

Stores the full shape array and recomputes row-major strides plus num_elements.

rank is clamped to kMaxRank. Strides are derived assuming a contiguous row-major layout (last dimension changes fastest). batch_size is cached from shape[0] when rank > 0.

Parameters
shapePointer to a shape array of length rank.
rankNumber of valid dimensions.

Stores a single shape entry without recomputing strides.

Parameters
dimDimension index.
valueShape value.

Stores a single stride entry.

Parameters
dimDimension index.
valueStride value (in elements, not bytes).

Stores the sensor / producer / output-port channel identifier.

Parameters
channelChannel id.

Stores the nominal publish frequency.

Parameters
freqFrequency in Hz.

Stores the cached batch size.

Parameters
batch_sizeStored value.

Stores the INT8 quantisation scale.

Parameters
quant_scaleStored value.

Stores the INT8 quantisation zero point.

Parameters
quant_zero_pointStored value.

Stores the scalar element type tag and caches the derived element size.

Parameters
dtypeDataType enum value.

Stores the device hint.

Parameters
deviceDevice enum value.

Returns the byte size of one element of dtype.

Parameters
dtypeElement type tag.
Returns
Element size in bytes (0 for kDataUnknown).

Mutable accessor for the first wire-locked reserved field (uint8_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf2_.

Mutable accessor for the third wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf3_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Pixel / codec encoding of the image payload.

< Uninitialised / unspecified format.

< Planar YUV 4:2:0 (I420).

< Planar YUV 4:2:2.

< Planar YUV 4:4:4.

< Semi-planar Y + interleaved UV (4:2:0).

< Semi-planar Y + interleaved VU (4:2:0).

< Packed YUYV 4:2:2.

< Packed YVYU 4:2:2.

< Packed UYVY 4:2:2.

< Packed VYUY 4:2:2.

< Packed 24-bit BGR (3 bytes per pixel).

< Packed 24-bit RGB (3 bytes per pixel).

< Planar 24-bit RGB (separate R, G, B planes).

< JPEG bitstream.

< H.264 / AVC frame.

< H.265 / HEVC frame.

Stream-frame type for compressed video payloads.

< Uninitialised / unspecified frame type.

< Intra-coded key frame.

< Predicted frame referencing earlier frames.

< Bi-directionally predicted frame.

Default-constructs an empty frame and asserts the 80-byte contract.

Frees the owned pixel buffer when is_owner() is true.

Deep-copies target into a freshly allocated frame.

Parameters
targetSource frame to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource frame moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource frame to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource frame moved from.
Returns
Reference to *this.

Deserialises a CameraFrame from bytes with zero-copy borrowing semantics.

Validates the magic-number envelope and total length, then borrows the pixel pointer from bytes. Callers must keep bytes alive for as long as this CameraFrame is in use.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus pixel bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed CameraFrame envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this frame.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(CameraFrame) + size() + sizeof(magic_end).

Whether the pixel buffer pointer is non-null and its size is positive.

Returns
true when the frame holds usable pixel data.

Borrows target's pixel buffer without copying.

Parameters
targetSource frame whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's pixels.

Parameters
targetSource frame to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource frame moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned pixel buffer of size bytes.

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned pixel buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Camera channel / sensor index.

Returns
Stored channel id.

Image width in pixels.

Returns
Stored width.

Image height in pixels.

Returns
Stored height.

Capture frequency in frames per second.

Returns
Stored frequency.

Pixel / codec encoding tag.

Returns
Format enum value.

Video stream-frame type tag.

Returns
Stream enum value.

Read-only pointer to the pixel bytes.

Returns
Pointer to payload start; may be non-null with size() == 0 for empty deserialised frames.

Pixel buffer size in bytes.

Returns
Byte count, or 0 when empty.

Whether this frame owns its pixel buffer.

Returns
true when the destructor would free the buffer.

Stores the camera channel / sensor index.

Parameters
channelChannel id.

Stores the image width in pixels.

Parameters
widthPixel width.

Stores the image height in pixels.

Parameters
heightPixel height.

Stores the capture frequency.

Parameters
freqCapture rate in Hz.

Stores the pixel / codec encoding tag.

Parameters
formatFormat enum value.

Stores the video stream-frame type tag.

Parameters
streamStream enum value.

Mutable accessor for the 32-bit reserved slot in the wire format.

Returns
Reference to reserved_buf_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

< Coordinate-frame / sensor identifier; not necessarily NUL-terminated.

< Monotonically increasing per-publisher sequence; wraps at UINT32_MAX.

< Reserved bytes; part of the wire contract, must not be repurposed.

< Capture / acquisition timestamp in nanoseconds since the UNIX epoch.

< Dispatch / publish timestamp in nanoseconds since the UNIX epoch.

Default constructor that asserts the 40-byte sizeof contract.

The static_assert inside the constructor body guarantees that any accidental field reordering or padding change breaks the build instead of silently corrupting the wire format.

Returns a bounded view over frame_id so consumers cannot read past the buffer.

frame_id may be filled to its full 16-byte capacity without a terminator, so this helper uses strnlen to compute the view length safely.

Returns
Non-owning view over the populated portion of frame_id.

Per-cell storage type tag (drives cell_size()).

< Uninitialised / unspecified cell type.

< Signed 8-bit cell (ROS nav_msgs/OccupancyGrid style).

< Unsigned 8-bit cell (0..255 costmap / grayscale).

< Unsigned 16-bit cell (high-resolution costmap).

< IEEE-754 single-precision cell (log-odds, probability, SDF).

Default-constructs an empty grid and asserts the 152-byte contract.

Frees the owned cell buffer when is_owner() is true.

Deep-copies target into a freshly allocated grid.

Parameters
targetSource grid to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource grid moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource grid to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource grid moved from.
Returns
Reference to *this.

Deserialises an OccupancyGrid from bytes with zero-copy borrowing semantics.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus cell bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed OccupancyGrid envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this grid.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(OccupancyGrid) + size() + sizeof(magic_end).

Whether the cell buffer pointer is non-null and the byte size is positive.

Returns
true when the grid holds usable cell data.

Borrows target's cell buffer without copying.

Parameters
targetSource grid whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's cells.

Parameters
targetSource grid to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource grid moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned cell buffer of size bytes.

The caller is responsible for keeping size consistent with width() * height() * cell_size().

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned cell buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned cell buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Producer-side timestamp recording when the map was last updated.

Returns
Stored nanosecond timestamp.

Unique map identifier (e.g. "local", "global", "lane").

Returns
Non-owning view into the embedded buffer.

Sensor / producer channel identifier.

Returns
Stored channel id.

Nominal publish frequency in Hz.

Returns
Stored value.

Grid width in cells (columns).

Returns
Stored width.

Grid height in cells (rows).

Returns
Stored height.

Number of cells whose value differs from default_value() (producer-supplied hint).

Returns
Stored count; zero means "not provided".

Cell side length in metres.

Returns
Stored resolution.

World-frame X coordinate of the bottom-left grid corner.

Returns
Stored origin X.

World-frame Y coordinate of the bottom-left grid corner.

Returns
Stored origin Y.

World-frame Z coordinate of the 2-D plane.

Returns
Stored origin Z.

Yaw rotation of the grid origin in radians (REP-103).

Returns
Stored origin yaw.

Lower bound of cell values used for normalisation / visualisation.

Returns
Stored minimum.

Upper bound of cell values used for normalisation / visualisation.

Returns
Stored maximum.

Value used for unknown / uninitialised cells.

Returns
Stored default value (e.g. -1 for ROS int8 occupancy).

Threshold above which a cell is considered occupied.

Returns
Stored threshold.

Threshold below which a cell is considered free.

Returns
Stored threshold.

Per-cell storage type tag.

Returns
CellType enum value.

Byte size of one cell derived from cell_type().

Returns
Cell stride in bytes (0 for kCellUnknown).

Read-only pointer to the cell bytes.

Returns
Pointer to payload start.

Cell buffer size in bytes.

Returns
Byte count, or 0 when empty.

Whether this grid owns its cell buffer.

Returns
true when the destructor would free the buffer.

Stores the producer-side map timestamp.

Parameters
update_time_nsTimestamp in nanoseconds.

Stores the unique map identifier (truncated to sizeof(map_id) - 1 bytes).

Parameters
map_idIdentifier string.

Stores the sensor / producer channel identifier.

Parameters
channelChannel id.

Stores the nominal publish frequency.

Parameters
freqFrequency in Hz.

Stores the grid width.

Parameters
widthNumber of columns.

Stores the grid height.

Parameters
heightNumber of rows.

Stores the count of cells differing from the default value.

Parameters
valid_cell_countProducer-supplied hint.

Stores the cell resolution.

Parameters
resolutionMetres per cell.

Stores the world-frame X origin.

Parameters
origin_xWorld X coordinate of the bottom-left corner.

Stores the world-frame Y origin.

Parameters
origin_yWorld Y coordinate of the bottom-left corner.

Stores the world-frame Z value of the 2-D plane.

Parameters
origin_zWorld Z coordinate of the plane.

Stores the yaw rotation of the grid origin.

Parameters
origin_yawRotation in radians (REP-103).

Stores the lower bound for cell values.

Parameters
value_minStored minimum.

Stores the upper bound for cell values.

Parameters
value_maxStored maximum.

Stores the value used for unknown cells.

Parameters
default_valueDefault cell value.

Stores the occupied threshold.

Parameters
occupied_thresholdStored threshold.

Stores the free threshold.

Parameters
free_thresholdStored threshold.

Stores the per-cell storage type tag.

Parameters
cell_typeCellType enum value.

Returns the byte size of one cell of type.

Parameters
typeCell type tag.
Returns
Cell stride in bytes (0 for kCellUnknown).

Mutable accessor for the first wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf2_.

Mutable accessor for the third wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf3_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Default-constructs an empty envelope and asserts the 80-byte contract.

Frees the owned tail buffer when is_owner() is true.

Deep-copies target into a freshly allocated envelope.

Parameters
targetSource envelope to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource envelope moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource envelope to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource envelope moved from.
Returns
Reference to *this.

Deserialises an envelope from bytes with zero-copy borrowing semantics.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or region inconsistency.

Serialises the struct snapshot plus tail buffer into bytes.

Parameters
bytesOutput buffer; reallocated automatically when undersized.
Returns
Always true.

Proxy control identifier set by set_control_id().

Returns
Stored control id.

Proxy operation mode set by set_mode().

Returns
Stored mode value.

Microsecond-resolution timestamp set by set_timestamp().

Returns
Timestamp.

Sequence number set by set_seq().

Returns
Sequence number.

Coarse schema family tag set by set_schema().

Returns
Numeric SchemaType value.

Shallow Bytes view of the raw payload region (no copy).

Returns
Bytes pointing into the internal tail buffer; lifetime tracks *this.

View of the URL region within the internal tail buffer.

Returns
Non-owning view, or empty when no URL was provided.

View of the serialisation-type region within the internal tail buffer.

Returns
Non-owning view, or empty when no serialisation label was provided.

View of the optional source hostname region.

Returns
Non-owning view, or empty when no hostname was provided.

Stores the proxy control identifier.

Parameters
control_idIdentifier value.

Stores the proxy operation mode.

Parameters
modeMode value.

Stores the microsecond-resolution timestamp.

Parameters
timestampTimestamp value.

Stores the message sequence number.

Parameters
seqSequence number.

Stores the coarse schema family tag.

Parameters
schemaNumeric SchemaType value.

Validates that bytes carries a well-formed ProxyData envelope.

Parameters
bytesWire buffer to inspect.
Returns
true on magic match and minimum-size check.

Total bytes that operator>> writes for this envelope.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(ProxyData) + size() + sizeof(magic_end).

Validates that internal region positions and sizes are consistent.

Confirms the four sub-regions are contiguous, sum to size(), and the data pointer is non-null. Useful after operator<< when forwarding untrusted input.

Returns
true when the layout is internally consistent.

Borrows target's tail buffer without copying.

Parameters
targetSource envelope; its backing buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and clones target's payload.

Parameters
targetSource envelope to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource envelope moved from.
Returns
false on self-move, otherwise true.

Builds the envelope by packing all four regions into a single allocation.

Allocates raw.size() + url.size() + ser.size() + hostname.size() bytes and copies each region in order. If any region (or the total) would exceed UINT32_MAX the envelope is cleared. Callers passing dynamic input must verify success via is_valid() or size().

Parameters
rawRaw payload bytes.
urlTopic URL string.
serSerialisation type label.
schemaOptional coarse schema family tag.
hostnameOptional source hostname.

Frees the owned buffer (if any) and zeroes every field.

Total size of the variable-length tail buffer.

Returns
Byte count, or 0 when empty.

Whether this envelope currently owns its tail buffer.

Returns
true when the destructor would free the buffer.

Mutable accessor for the first wire-locked reserved field (uint8_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf2_.

< Marker probed by the VLink type-trait machinery.

Default-constructs an empty container and verifies the sizeof contract.

Releases the owned buffer when is_owner() is true.

Deep-copies the payload of target into a freshly allocated owned buffer.

Parameters
targetSource container to clone.

Steals target's ownership and metadata; target is left empty.

Parameters
targetSource container moved from.

Deep-copy-assigns from target; self-assignment is a no-op.

Parameters
targetSource container to clone.
Returns
Reference to *this.

Move-assigns target's resources into *this; self-assignment is a no-op.

Parameters
targetSource container moved from.
Returns
Reference to *this.

Deserialises a RawData from bytes using zero-copy borrowing semantics.

Validates the magic-number envelope and total length, then borrows the payload pointer from bytes. The caller must keep bytes alive for as long as this RawData is used.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success; false on magic mismatch or size mismatch.

Serialises the struct snapshot plus payload into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed RawData envelope.

Parameters
bytesBuffer to inspect.
Returns
true when the magic sentinels match and the minimum length holds.

Total bytes that operator>> would write for this container.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(RawData) + size() + sizeof(magic_end).

Whether the payload pointer is non-null and the byte size is positive.

Returns
true when the container holds usable data.

Borrows target's payload pointer without copying.

Parameters
targetSource container whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's payload.

Parameters
targetSource container to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target becomes empty.

Parameters
targetSource container moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned buffer of size bytes.

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and zeroes the Header.

Borrows an externally owned raw byte buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer (allocating as needed).

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Mutable accessor for the 16-bit user-reserved field carried in the wire format.

Returns
Reference to reserved_buf_.

Read-only pointer to the payload bytes.

Returns
Pointer to payload start; may be non-null with size() == 0 for empty deserialised frames.

Payload size in bytes (0 when empty).

Returns
Byte count.

Whether this container currently owns its buffer.

Returns
true when the destructor would free the buffer.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Maximum number of dimensions a single Tensor may carry.

Scalar element type tag (drives element_size()).

< Uninitialised / unspecified element type.

< bool (1 byte).

< int8_t (1 byte).

< uint8_t (1 byte).

< int16_t (2 bytes).

< uint16_t (2 bytes).

< int32_t (4 bytes).

< uint32_t (4 bytes).

< int64_t (8 bytes).

< uint64_t (8 bytes).

< IEEE-754 half precision (2 bytes).

< Brain float (2 bytes).

< IEEE-754 single precision (4 bytes).

< IEEE-754 double precision (8 bytes).

Device hint indicating where the data buffer physically lives.

< Host / CPU memory.

< Discrete or integrated GPU memory.

< Neural processing unit (e.g. automotive NPU).

< Digital signal processor.

Default-constructs an empty tensor and asserts the 248-byte contract.

Frees the owned data buffer when is_owner() is true.

Deep-copies target into a freshly allocated tensor.

Parameters
targetSource tensor to clone.

Steals target's allocation and metadata; target ends empty.

Parameters
targetSource tensor moved from.

Deep-copy-assigns target; self-assignment is a no-op.

Parameters
targetSource tensor to clone.
Returns
Reference to *this.

Move-assigns target; self-assignment is a no-op.

Parameters
targetSource tensor moved from.
Returns
Reference to *this.

Deserialises a Tensor from bytes with zero-copy borrowing semantics.

Two fields are sanitised after the struct snapshot is restored: rank_ is clamped to kMaxRank, and element_size_ is re-derived from dtype_ to stay consistent regardless of producer-side mistakes.

Parameters
bytesWire buffer previously produced by operator>>.
Returns
true on success.

Serialises the struct snapshot plus element bytes into bytes.

Parameters
bytesOutput buffer; resized automatically when its size differs from the serialized size.
Returns
Always true.

Validates that bytes carries a well-formed Tensor envelope.

Parameters
bytesWire buffer to inspect.
Returns
true when both magic sentinels match and the minimum size holds.

Total bytes that operator>> would write for this tensor.

Returns
sizeof(magic_begin) + sizeof(version) + sizeof(Tensor) + size() + sizeof(magic_end).

Whether the data buffer pointer is non-null and the byte size is positive.

Returns
true when the tensor holds usable data.

Borrows target's data buffer without copying.

Parameters
targetSource tensor whose buffer must outlive *this.
Returns
false on self-borrow, otherwise true.

Allocates (or reuses) an owned buffer and copies target's elements.

Parameters
targetSource tensor to clone.
Returns
false on self-copy, otherwise true.

Transfers ownership from target; target ends empty.

Parameters
targetSource tensor moved from.
Returns
false on self-move, otherwise true.

Allocates an uninitialised owned data buffer of size bytes.

The caller is responsible for keeping size consistent with num_elements() * element_size().

Parameters
sizeByte count; must be non-zero.
Returns
false when size is zero, otherwise true.

Releases the owned buffer (if any) and resets metadata except reserved fields.

Borrows an externally owned data buffer without copying.

Parameters
dataNon-null source pointer that must outlive *this.
sizeBuffer length in bytes; must be non-zero.
Returns
false on invalid arguments or unchanged pointer, otherwise true.

Copies size bytes from data into an owned buffer.

Parameters
dataNon-null source pointer.
sizeNumber of bytes to copy; must be non-zero.
Returns
false on invalid arguments or aliasing, otherwise true.

Compatibility alias for deep_copy(uint8_t*, size_t).

Parameters
dataSource pointer.
sizeNumber of bytes.
Returns
Result of the delegated deep_copy call.

Producer-side tensor timestamp in nanoseconds.

Returns
Stored value.

Cached total element count (product of shape() dimensions).

Returns
Stored element count.

Tensor name (e.g. "image", "hidden_state").

Returns
Non-owning view into the embedded buffer.

Source model identifier.

Returns
Non-owning view into the embedded buffer.

Layout label (e.g. "NCHW", "NHWC", "BLC").

Returns
Non-owning view into the embedded buffer.

Read-only pointer to the kMaxRank-sized shape array.

Returns
Pointer into the embedded array; never nullptr.

Shape value at dimension dim, or 0 if dim is out of range.

Parameters
dimDimension index.
Returns
Shape entry.

Read-only pointer to the kMaxRank-sized stride array (in elements, not bytes).

Returns
Pointer into the embedded array; never nullptr.

Stride value at dimension dim, or 0 if dim is out of range.

Parameters
dimDimension index.
Returns
Stride entry.

Sensor / producer / output-port channel identifier.

Returns
Stored channel id.

Nominal publish frequency in Hz.

Returns
Stored value.

Cached batch size (typically shape_at(0)).

Returns
Stored batch size.

INT8 quantisation scale (0 when unused).

Returns
Stored scale.

INT8 quantisation zero point (0 when unused).

Returns
Stored zero point.

Scalar element type tag.

Returns
DataType enum value.

Actual tensor rank in the range 1..kMaxRank.

Returns
Stored rank.

Device hint indicating where the data buffer lives.

Returns
Device enum value.

Cached byte size of one element derived from dtype().

Returns
Element size in bytes.

Read-only pointer to the element bytes.

Returns
Pointer to payload start.

Element buffer size in bytes.

Returns
Byte count.

Whether this tensor owns its data buffer.

Returns
true when the destructor would free the buffer.

Stores the tensor timestamp.

Parameters
update_time_nsTimestamp in nanoseconds.

Stores the tensor name (truncated to sizeof(name) - 1 bytes).

Parameters
nameTensor name.

Stores the source model identifier (truncated to sizeof(model_id) - 1 bytes).

Parameters
model_idModel identifier.

Stores the layout label (truncated to sizeof(layout) - 1 bytes).

Parameters
layoutLayout descriptor.

Stores the full shape array and recomputes row-major strides plus num_elements.

rank is clamped to kMaxRank. Strides are derived assuming a contiguous row-major layout (last dimension changes fastest). batch_size is cached from shape[0] when rank > 0.

Parameters
shapePointer to a shape array of length rank.
rankNumber of valid dimensions.

Stores a single shape entry without recomputing strides.

Parameters
dimDimension index.
valueShape value.

Stores a single stride entry.

Parameters
dimDimension index.
valueStride value (in elements, not bytes).

Stores the sensor / producer / output-port channel identifier.

Parameters
channelChannel id.

Stores the nominal publish frequency.

Parameters
freqFrequency in Hz.

Stores the cached batch size.

Parameters
batch_sizeStored value.

Stores the INT8 quantisation scale.

Parameters
quant_scaleStored value.

Stores the INT8 quantisation zero point.

Parameters
quant_zero_pointStored value.

Stores the scalar element type tag and caches the derived element size.

Parameters
dtypeDataType enum value.

Stores the device hint.

Parameters
deviceDevice enum value.

Returns the byte size of one element of dtype.

Parameters
dtypeElement type tag.
Returns
Element size in bytes (0 for kDataUnknown).

Mutable accessor for the first wire-locked reserved field (uint8_t).

Returns
Reference to reserved_buf_.

Mutable accessor for the second wire-locked reserved field (uint16_t).

Returns
Reference to reserved_buf2_.

Mutable accessor for the third wire-locked reserved field (uint32_t).

Returns
Reference to reserved_buf3_.

< Sequencing and timestamp metadata prefix.

< Marker probed by the VLink type-trait machinery.

Variable Documentation

◆ kWireVersion

constexpr uint32_t vlink::zerocopy::kWireVersion
inlineconstexpr
Initial value:
= (static_cast<uint32_t>(VLINK_VERSION_MAJOR) * 1000000U) +
(static_cast<uint32_t>(VLINK_VERSION_MINOR) * 1000U) +
static_cast<uint32_t>(VLINK_VERSION_PATCH)
#define VLINK_VERSION_PATCH
Definition: version.h:94
#define VLINK_VERSION_MAJOR
Definition: version.h:92
#define VLINK_VERSION_MINOR
Definition: version.h:93

Encoded VLink library version stamped into every zero-copy wire envelope.

The library version triple is packed as decimal major*1000000 + minor*1000 + patch (each component in 0..100), e.g. version 2.10.8 encodes as the integer 2010008. Producers write this uint32_t immediately after the begin-magic sentinel; consumers reject any payload whose major component differs from the local kWireVersion (see version_major()). Minor and patch components are carried for diagnostics but are not gated.