VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::zerocopy 命名空间参考

函数

struct VLINK_EXPORT_AND_ALIGNED (8) CameraFrame final

函数说明

◆ VLINK_EXPORT_AND_ALIGNED()

struct vlink::zerocopy::VLINK_EXPORT_AND_ALIGNED ( 8 )
final

Pixel/codec encoding format of the image payload.

Values 1-12 describe uncompressed planar/packed formats. Values 101-103 describe compressed codec formats. Pass to set_format() and read via format().

< Unknown or uninitialised format.

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

< Planar YUV 4:2:2.

< Planar YUV 4:4:4.

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

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

< 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/pixel).

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

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

< JPEG compressed image.

< H.264 / AVC compressed video frame.

< H.265 / HEVC compressed video frame.

Video stream frame type for compressed formats.

Relevant when format() is kFormatH264 or kFormatH265. Set via set_stream(); read via stream().

< Unknown stream type.

< I-frame (intra-coded, key frame).

< P-frame (predicted from previous frame).

< B-frame (bi-directionally predicted).

Default constructor.

Verifies via static_assert that the struct is exactly 80 bytes on 64-bit platforms. 32-bit architectures emit a compile-time warning.

Destructor – frees the owned pixel buffer if is_owner() is true.

Copy constructor – performs a deep copy of target.

参数
targetSource frame to copy.

Move constructor – transfers ownership from target.

After the call target is empty and does not own any buffer.

参数
targetSource frame to move from.

Copy-assignment operator – deep-copies target.

参数
targetSource frame to copy. Self-assignment is a no-op.
返回
Reference to *this.

Move-assignment operator – transfers ownership from target.

参数
targetSource frame to move. Self-assignment is a no-op.
返回
Reference to *this.

Deserialises a CameraFrame from a Bytes wire buffer.

Validates the magic-number envelope, copies the struct header, and sets the pixel data pointer to reference memory inside bytes (zero-copy). is_owner() will be false after a successful call; bytes must outlive this CameraFrame.

参数
bytesBuffer produced by operator>>.
返回
true on success, false if the buffer fails validation or the total size is inconsistent.

Serialises this CameraFrame into a Bytes wire buffer.

Writes the magic-number envelope, struct fields, and pixel payload into bytes, resizing it if necessary.

参数
bytesOutput buffer (reallocated automatically if needed).
返回
Always true.

Checks whether bytes contains a valid CameraFrame wire buffer.

Verifies minimum size and both magic-number sentinels.

参数
bytesBuffer to validate.
返回
true if the sentinels match and the size is sufficient.

Returns the total serialised byte count for this frame.

Equals: sizeof(magic_begin) + sizeof(CameraFrame) + size() + sizeof(magic_end)

返回
Total bytes written by operator>>.

Returns true when the pixel buffer is present and non-empty.

返回
true if data() is non-null and size() > 0.

Borrows the pixel buffer from target without copying.

Sets metadata and data pointer to match target; is_owner() becomes false. Any previously owned buffer is freed first.

参数
targetSource frame to borrow from.
返回
false if target == *this, otherwise true.

Deep-copies the pixel buffer from target.

If *this already owns a same-size buffer the data is copied in-place; otherwise a new buffer is allocated.

参数
targetSource frame to copy.
返回
false if target == *this, otherwise true.

Transfers ownership from target to *this.

After the call target is empty. Self-move is a no-op.

参数
targetSource frame to move from.
返回
false if target == *this, otherwise true.

Allocates an owned pixel buffer of size bytes.

Frees any existing owned buffer before allocating the new one. Buffer content is uninitialised after the call.

参数
sizeNumber of bytes to allocate. Must be non-zero.
返回
false if size is zero, otherwise true.

Releases all resources and zeroes all fields including header.

Borrows an external raw pixel pointer without copying.

Sets the internal data pointer to data with is_owner() == false. The caller is responsible for the buffer lifetime.

参数
dataNon-null pointer to pixel data.
sizeSize of the buffer in bytes.
返回
false on invalid arguments or if the pointer is unchanged.

Deep-copies pixel data from a raw pointer.

Allocates or reuses an owned buffer and copies size bytes from data.

参数
dataSource pixel data pointer. Must be non-null.
sizeNumber of bytes to copy. Must be non-zero.
返回
false on invalid arguments, otherwise true.

Alias for deep_copy(uint8_t*, size_t).

参数
dataSource pointer.
sizeNumber of bytes.
返回
Result of the underlying deep_copy call.

Returns the camera channel (sensor index).

返回
Channel number set by set_channel().

Returns the image width in pixels.

返回
Width set by set_width().

Returns the image height in pixels.

返回
Height set by set_height().

Returns the capture frequency in Hz.

返回
Frequency set by set_freq().

Returns the pixel/codec encoding format.

返回
Format value set by set_format().

Returns the video stream frame type.

返回
Stream value set by set_stream().

Returns a read-only pointer to the pixel data buffer.

返回
Pointer to pixel bytes, or nullptr if the frame is empty.

Returns the pixel buffer size in bytes.

返回
Number of payload bytes, or 0 if empty.

Returns true if this object owns its pixel buffer.

An owned buffer is freed in the destructor. Borrowed buffers (created by shallow_copy or operator<<) are not freed.

返回
true when memory ownership is held.

Sets the camera channel (sensor index).

参数
channelChannel identifier.

Sets the image width in pixels.

参数
widthPixel width of the image.

Sets the image height in pixels.

参数
heightPixel height of the image.

Sets the capture frequency in Hz.

参数
freqCapture rate in frames per second.

Sets the pixel/codec encoding format.

参数
formatOne of the Format enum values.

Sets the video stream frame type.

参数
streamOne of the Stream enum values.

Gets the reserved field.

返回
Reference to the reserved field.

< Sequencing and timestamp metadata for this frame.

Internal

< Frame identifier; semantics defined by the producing sensor.

< Monotonically increasing sequence number, wraps at UINT32_MAX.

< Reserved for future use; must be zero.

< Measurement timestamp in nanoseconds since epoch.

< Publish timestamp in nanoseconds since epoch.

Default constructor.

Verifies via static_assert that the struct is exactly 40 bytes on 64-bit platforms (the check is omitted on 32-bit architectures).

Default constructor.

Verifies via static_assert that the struct is exactly 80 bytes on 64-bit platforms.

Destructor – frees the owned tail buffer if is_owner() is true.

Copy constructor – deep-copies target.

参数
targetSource to copy.

Move constructor – transfers ownership from target.

After the call target is empty and does not own any buffer.

参数
targetSource to move from.

Copy-assignment operator.

参数
targetSource to copy. Self-assignment is a no-op.
返回
Reference to *this.

Move-assignment operator.

参数
targetSource to move. Self-assignment is a no-op.
返回
Reference to *this.

Deserialises a ProxyData from a Bytes wire buffer.

Validates magic-number sentinels and the internal region layout (positions and sizes must be contiguous and sum to size_). The tail buffer pointer references memory inside bytes (zero-copy); bytes must outlive this ProxyData.

参数
bytesBuffer produced by operator>>.
返回
true on success; false on magic-number mismatch, size inconsistency, or invalid region layout.

Serialises this ProxyData into a Bytes wire buffer.

Writes the magic-number envelope, the struct fields, and the tail payload into bytes, resizing it as needed.

参数
bytesOutput buffer (reallocated automatically if necessary).
返回
Always true.

Returns the proxy control identifier.

返回
Value set by set_control_id().

Returns the proxy operation mode.

返回
Value set by set_mode().

Returns the message timestamp in microseconds.

返回
Value set by set_timestamp().

Returns the message sequence number.

返回
Value set by set_seq().

Returns the coarse schema family carried with this payload.

返回
Numeric SchemaType value stored by set_schema().

Returns a shallow Bytes view of the raw message payload.

The returned Bytes points into the internal tail buffer without copying. It must not outlive this ProxyData.

返回
Shallow Bytes of the raw payload, or empty if not set.

Returns the topic URL as a string_view.

Points into the internal tail buffer. Lifetime is tied to this object.

返回
View of the URL string, or empty if not set.

Returns the serialisation type string as a string_view.

For example "demo.proto.PointCloud" or "demo.fbs.CameraFrame". Points into the internal tail buffer.

返回
View of the serialisation type string, or empty if not set.

Returns the source hostname as a string_view.

Optional field; empty if not provided to create(). Points into the internal tail buffer.

返回
View of the hostname string, or empty if not set.

Sets the proxy control identifier.

参数
control_idControl identifier value.

Sets the proxy operation mode.

参数
modeMode value.

Sets the message timestamp in microseconds.

参数
timestampTimestamp value (microseconds since epoch).

Sets the message sequence number.

参数
seqSequence number.

Sets the coarse schema family associated with the payload.

参数
schemaNumeric SchemaType value.

Checks whether bytes contains a valid ProxyData wire buffer.

Verifies minimum buffer size and both magic-number sentinels.

参数
bytesBuffer to validate.
返回
true if magic numbers match and size is sufficient.

Returns the total serialised byte count for this ProxyData.

Equals: sizeof(magic_begin) + sizeof(ProxyData) + size() + sizeof(magic_end)

返回
Total bytes written by operator>>.

Returns true when all internal region positions and sizes are consistent.

Checks that raw, url, ser, and hostname regions are contiguous and that their combined size equals the tail buffer size. Also requires a non-null data pointer and non-zero total size.

返回
true when the object holds valid, usable data.

Borrows the tail buffer from target without copying.

Sets metadata and pointer to match target; is_owner() becomes false. Any previously owned buffer is freed.

参数
targetSource to borrow from.
返回
false if target == *this, otherwise true.

Deep-copies the tail buffer from target.

Allocates a new buffer of the same size and copies the payload. If *this already owns a same-size buffer the data is copied in-place.

参数
targetSource to copy.
返回
false if target == *this, otherwise true.

Transfers ownership from target to *this.

After the call target is empty.

参数
targetSource to move from.
返回
false if target == *this, otherwise true.

Constructs the envelope by packing all fields into a single allocation.

Allocates a buffer of size raw.size() + url.size() + ser.size() + hostname.size() and copies each region in order. Any previously owned buffer is freed first.

参数
rawRaw serialised message payload.
urlTopic URL string (e.g., "dds://my/topic").
serSerialisation type (e.g., "demo.proto.PointCloud").
schemaCoarse schema family, typically a SchemaType value.
hostnameOptional source hostname; empty if not provided.

Releases all resources and resets all fields to zero.

Returns the total tail buffer size in bytes.

Equals the sum of the raw payload, URL, serialisation type, and hostname sizes.

返回
Total variable-length buffer size, or 0 if empty.

Returns true if this object owns its tail buffer.

Owned buffers are freed in the destructor. Borrowed buffers (from shallow_copy or operator<<) are not freed.

返回
true when memory ownership is held.

Internal

Default constructor.

Verifies via static_assert that the struct is exactly 64 bytes on 64-bit platforms. 32-bit architectures emit a compile-time warning.

Destructor.

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

Copy constructor.

Performs a deep copy of target, allocating a new buffer and copying the payload.

参数
targetSource to copy from.

Move constructor.

Transfers ownership from target. After the call target is empty and no longer owns any buffer.

参数
targetSource to move from.

Copy-assignment operator.

Deep-copies target into *this. Self-assignment is a no-op.

参数
targetSource to copy from.
返回
Reference to *this.

Move-assignment operator.

Transfers ownership from target into *this. Self-assignment is a no-op. After the call target is empty.

参数
targetSource to move from.
返回
Reference to *this.

Deserialises a RawData from a Bytes wire buffer.

Validates the magic-number envelope, then memcpy's the struct fields from the buffer. The internal data pointer is set to point directly into bytes (zero-copy, is_owner() == false). The caller must ensure bytes outlives this RawData.

参数
bytesSerialised buffer produced by operator>>.
返回
true on success, false if the buffer is invalid or the total size does not match get_serialized_size().

Serialises this RawData into a Bytes wire buffer.

Writes the magic-number envelope, the struct fields, and the payload into bytes. If bytes is the wrong size it is reallocated automatically.

参数
bytesOutput buffer (resized if necessary).
返回
Always true.

Checks whether bytes contains a valid RawData wire format.

Verifies that the buffer is large enough and that both the begin and end magic numbers match the expected constants.

参数
bytesBuffer to check.
返回
true if the magic numbers are present and the minimum size constraint is satisfied.

Returns the total serialised byte count for this RawData.

Computed as:

sizeof(magic_begin) + sizeof(RawData) + size() + sizeof(magic_end)
Generic zero-copy raw-byte data container with Header metadata.
返回
Total number of bytes that operator>> will write.

Returns true if the data pointer is non-null and the size is non-zero.

返回
true when there is a valid payload available.

Borrows (shallow-copies) the payload from another RawData.

Sets the internal pointer to the same buffer as target without copying data. is_owner() becomes false. The source must outlive this object. Any previously owned buffer is freed first.

参数
targetSource to borrow from.
返回
false if target == *this, otherwise true.

Deep-copies the payload from another RawData.

Allocates a new buffer and copies the payload from target. If *this already owns a buffer of the same size, the data is copied in-place without reallocation.

参数
targetSource to copy from.
返回
false if target == *this, otherwise true.

Transfers ownership from another RawData.

Equivalent to a move operation implemented as a member function. After the call target is empty and is_owner() on target is false.

参数
targetSource to move from.
返回
false if target == *this, otherwise true.

Allocates an owned buffer of size bytes.

Any previously owned buffer is freed before the new allocation. The new buffer content is uninitialised.

参数
sizeNumber of bytes to allocate. Must be non-zero.
返回
false if size is zero, otherwise true.

Releases all resources and resets all fields to zero.

Frees the owned buffer if is_owner() is true. The Header is also zeroed.

Borrows a raw pointer without copying.

Sets the internal pointer to data without allocating. Any previously owned buffer is freed. The caller is responsible for the lifetime of data.

参数
dataPointer to the data to borrow. Must be non-null.
sizeSize of the data in bytes. Must be non-zero.
返回
false if data is null, size is zero, or data already equals the current internal pointer.

Copies data from a raw pointer into an owned buffer.

If *this already owns a buffer of the same size the data is copied in-place; otherwise a new buffer is allocated first via create().

参数
dataSource data pointer. Must be non-null.
sizeNumber of bytes to copy. Must be non-zero.
返回
false on invalid arguments, otherwise true.

Alias for deep_copy(uint8_t*, size_t).

参数
dataSource data pointer.
sizeNumber of bytes.
返回
Result of the underlying deep_copy call.

Returns a mutable reference to the 16-bit user-reserved field.

This field travels through serialisation and can be used by the application for flags or minor sub-type identification without extending the struct.

返回
Mutable reference to reserved_buf_.

Returns a read-only pointer to the payload bytes.

返回
Pointer to the payload, or nullptr if the object is empty.

Returns the payload size in bytes.

返回
Number of payload bytes, or 0 if the object is empty.

Returns true if this object owns its data buffer.

An owned buffer is freed in the destructor. Non-owned buffers (created by shallow_copy or operator<<) are never freed.

返回
true when memory ownership is held.

< Sequencing and timestamp metadata for this data packet.

Internal