Skip to main content

Sample Struct

Typed payload returned by Run::pull() and consumed by Run::push(). More...

Declaration

struct simaai::neat::Sample { ... }

Included Headers

#include <GraphOptions.h>

Public Operators Index

Sample &operator[] (std::size_t i)

Logical field access. For non-Bundle Samples only index 0 is meaningful. More...

const Sample &operator[] (std::size_t i) const

Public Member Functions Index

boolempty () const noexcept

Returns true when this Sample carries no payload. More...

std::size_tsize () const noexcept

Number of logical payloads represented by this Sample. More...

voidreserve (std::size_t n)

Reserve Bundle field storage. Turns an empty Sample into a Bundle builder. More...

voidpush_back (Sample sample)

Append a field to this Sample. Turns an empty Sample into a Bundle builder. More...

Sample &front ()

First logical payload. For non-Bundle Samples, this is the Sample itself. More...

const Sample &front () const
Sample &back ()

Last logical payload. For non-Bundle Samples, this is the Sample itself. More...

const Sample &back () const
iteratorbegin ()
iteratorend ()
const_iteratorbegin () const
const_iteratorend () const
const_iteratorcbegin () const
const_iteratorcend () const

Public Member Attributes Index

SampleKindkind = SampleKind::Unknown

Discriminator: which payload field is meaningful. More...

boolowned = ...

If false, the framework holds a borrowed reference to the underlying buffer. More...

std::optional< simaai::neat::Tensor >tensor

Set when kind == Tensor. More...

TensorListtensors

Set when kind == TensorSet. More...

std::vector< Sample >fields

Set when kind == Bundle (recursive multi-logical-output). More...

std::stringcaps_string

Caps string from the source GStreamer buffer (for media-typed payloads). More...

PayloadTypepayload_type = PayloadType::Auto

Public semantic payload family. More...

std::stringmedia_type

MIME-style media type (e.g., "video/x-raw", "application/vnd.simaai.tensor"). More...

std::stringpayload_tag

Subformat tag (e.g., "NV12", "FP32", "INT8"). More...

std::stringformat

Subformat tag for the payload. More...

int64_tframe_id = -1

Source-assigned frame ID, when carried. More...

std::stringstream_id

Stream identifier (multi-stream pipelines). More...

std::stringstream_label

Human-readable stream label. More...

std::stringport_name

Ingress port name (multi-input models). More...

intoutput_index = -1

Logical output index this sample corresponds to. More...

intlogical_output_index = -1

Logical output index this sample corresponds to. More...

intmemory_index = -1

Underlying memory segment index (advanced; for zero-copy routing). More...

introute_slot = -1

Route-graph slot identifier (advanced). More...

std::stringsegment_name

Memory segment name (advanced). More...

int64_tinput_seq = -1

Input sequence number assigned at push time (lets pull match push). More...

int64_torig_input_seq = ...

Original input sequence (when re-numbered through a sub-pipeline). More...

int64_tpts_ns = -1

Presentation timestamp in nanoseconds (-1 if absent). More...

int64_tdts_ns = -1

Decoding timestamp in nanoseconds (-1 if absent). More...

int64_tduration_ns = -1

Sample duration in nanoseconds (-1 if absent). More...

Description

Typed payload returned by Run::pull() and consumed by Run::push().

A Sample is a tagged union: depending on kind, exactly one of tensor, tensors, or fields is meaningful. Includes per-buffer metadata: stream/port labels, timestamps, frame IDs, and routing slot information. Use make_tensor_sample(), make_image_sample(), or make_bundle_sample() to construct typed Samples ergonomically.

Definition at line 382 of file GraphOptions.h.

Public Operators

operator[]()

Sample & simaai::neat::Sample::operator[] (std::size_t i)
inline

Logical field access. For non-Bundle Samples only index 0 is meaningful.

Definition at line 485 of file GraphOptions.h.

485 Sample& operator[](std::size_t i) {
486 if (kind == SampleKind::Bundle) {
487 return fields[i];
488 }
489 return *this;
490 }

operator[]()

const Sample & simaai::neat::Sample::operator[] (std::size_t i)
inline

Definition at line 491 of file GraphOptions.h.

491 const Sample& operator[](std::size_t i) const {
492 if (kind == SampleKind::Bundle) {
493 return fields[i];
494 }
495 return *this;
496 }

Public Member Functions

back()

Sample & simaai::neat::Sample::back ()
inline

Last logical payload. For non-Bundle Samples, this is the Sample itself.

Definition at line 471 of file GraphOptions.h.

472 if (kind == SampleKind::Bundle) {
473 return fields.back();
474 }
475 return *this;
476 }

back()

const Sample & simaai::neat::Sample::back ()
inline

Definition at line 477 of file GraphOptions.h.

477 const Sample& back() const {
478 if (kind == SampleKind::Bundle) {
479 return fields.back();
480 }
481 return *this;
482 }

begin()

iterator simaai::neat::Sample::begin ()
inline

Definition at line 560 of file GraphOptions.h.

561 return iterator(this, 0);
562 }

begin()

const_iterator simaai::neat::Sample::begin ()
inline

Definition at line 566 of file GraphOptions.h.

567 return const_iterator(this, 0);
568 }

cbegin()

const_iterator simaai::neat::Sample::cbegin ()
inline

Definition at line 572 of file GraphOptions.h.

573 return begin();
574 }

cend()

const_iterator simaai::neat::Sample::cend ()
inline

Definition at line 575 of file GraphOptions.h.

576 return end();
577 }

empty()

bool simaai::neat::Sample::empty ()
inline noexcept

Returns true when this Sample carries no payload.

Definition at line 421 of file GraphOptions.h.

421 bool empty() const noexcept {
422 return kind == SampleKind::Unknown && !tensor.has_value() && tensors.empty() && fields.empty();
423 }

end()

iterator simaai::neat::Sample::end ()
inline

Definition at line 563 of file GraphOptions.h.

564 return iterator(this, size());
565 }

end()

const_iterator simaai::neat::Sample::end ()
inline

Definition at line 569 of file GraphOptions.h.

570 return const_iterator(this, size());
571 }

front()

Sample & simaai::neat::Sample::front ()
inline

First logical payload. For non-Bundle Samples, this is the Sample itself.

Definition at line 457 of file GraphOptions.h.

458 if (kind == SampleKind::Bundle) {
459 return fields.front();
460 }
461 return *this;
462 }

front()

const Sample & simaai::neat::Sample::front ()
inline

Definition at line 463 of file GraphOptions.h.

463 const Sample& front() const {
464 if (kind == SampleKind::Bundle) {
465 return fields.front();
466 }
467 return *this;
468 }

push_back()

void simaai::neat::Sample::push_back (Sample sample)
inline

Append a field to this Sample. Turns an empty Sample into a Bundle builder.

Definition at line 446 of file GraphOptions.h.

446 void push_back(Sample sample) {
447 if (kind == SampleKind::Unknown && empty()) {
449 }
450 fields.push_back(std::move(sample));
453 }
454 }

reserve()

void simaai::neat::Sample::reserve (std::size_t n)
inline

Reserve Bundle field storage. Turns an empty Sample into a Bundle builder.

Definition at line 438 of file GraphOptions.h.

438 void reserve(std::size_t n) {
439 if (kind == SampleKind::Unknown && empty()) {
441 }
442 fields.reserve(n);
443 }

size()

std::size_t simaai::neat::Sample::size ()
inline noexcept

Number of logical payloads represented by this Sample.

A Bundle reports its number of fields. Any non-empty non-Bundle Sample reports 1. This intentionally lets Sample replace the former "list of Samples" surface while keeping a single recursive public payload type.

Definition at line 430 of file GraphOptions.h.

430 std::size_t size() const noexcept {
431 if (kind == SampleKind::Bundle) {
432 return fields.size();
433 }
434 return empty() ? 0U : 1U;
435 }

Public Member Attributes

caps_string

std::string simaai::neat::Sample::caps_string

Caps string from the source GStreamer buffer (for media-typed payloads).

Definition at line 392 of file GraphOptions.h.

dts_ns

int64_t simaai::neat::Sample::dts_ns = -1

Decoding timestamp in nanoseconds (-1 if absent).

Definition at line 417 of file GraphOptions.h.

417 int64_t dts_ns = -1;

duration_ns

int64_t simaai::neat::Sample::duration_ns = -1

Sample duration in nanoseconds (-1 if absent).

Definition at line 418 of file GraphOptions.h.

418 int64_t duration_ns = -1;

fields

std::vector<Sample> simaai::neat::Sample::fields

Set when kind == Bundle (recursive multi-logical-output).

Definition at line 389 of file GraphOptions.h.

389 std::vector<Sample> fields;

format

std::string simaai::neat::Sample::format

Subformat tag for the payload.

Deprecated

Use payload_tag. Kept for transition.

Definition at line 400 of file GraphOptions.h.

400 std::string format;

frame_id

int64_t simaai::neat::Sample::frame_id = -1

Source-assigned frame ID, when carried.

Definition at line 402 of file GraphOptions.h.

402 int64_t frame_id = -1;

input_seq

int64_t simaai::neat::Sample::input_seq = -1

Input sequence number assigned at push time (lets pull match push).

Definition at line 413 of file GraphOptions.h.

413 int64_t input_seq = -1;

kind

SampleKind simaai::neat::Sample::kind = SampleKind::Unknown

Discriminator: which payload field is meaningful.

Definition at line 383 of file GraphOptions.h.

logical_output_index

int simaai::neat::Sample::logical_output_index = -1

Logical output index this sample corresponds to.

Definition at line 409 of file GraphOptions.h.

media_type

std::string simaai::neat::Sample::media_type

MIME-style media type (e.g., "video/x-raw", "application/vnd.simaai.tensor").

Definition at line 394 of file GraphOptions.h.

394 std::string media_type;

memory_index

int simaai::neat::Sample::memory_index = -1

Underlying memory segment index (advanced; for zero-copy routing).

Definition at line 410 of file GraphOptions.h.

410 int memory_index = -1;

orig_input_seq

int64_t simaai::neat::Sample::orig_input_seq

Original input sequence (when re-numbered through a sub-pipeline).

Initialiser
= -1

Definition at line 414 of file GraphOptions.h.

output_index

int simaai::neat::Sample::output_index = -1

Logical output index this sample corresponds to.

Deprecated

Legacy alias for logical_output_index.

Definition at line 408 of file GraphOptions.h.

408 int output_index = -1;

owned

bool simaai::neat::Sample::owned

If false, the framework holds a borrowed reference to the underlying buffer.

Initialiser
= true

Definition at line 384 of file GraphOptions.h.

384 bool owned =

payload_tag

std::string simaai::neat::Sample::payload_tag

Subformat tag (e.g., "NV12", "FP32", "INT8").

Replaces deprecated format.

Definition at line 396 of file GraphOptions.h.

396 std::string payload_tag;

payload_type

PayloadType simaai::neat::Sample::payload_type = PayloadType::Auto

Public semantic payload family.

Definition at line 393 of file GraphOptions.h.

port_name

std::string simaai::neat::Sample::port_name

Ingress port name (multi-input models).

Definition at line 405 of file GraphOptions.h.

405 std::string port_name;

pts_ns

int64_t simaai::neat::Sample::pts_ns = -1

Presentation timestamp in nanoseconds (-1 if absent).

Definition at line 416 of file GraphOptions.h.

416 int64_t pts_ns = -1;

route_slot

int simaai::neat::Sample::route_slot = -1

Route-graph slot identifier (advanced).

Definition at line 411 of file GraphOptions.h.

411 int route_slot = -1;

segment_name

std::string simaai::neat::Sample::segment_name

Memory segment name (advanced).

Definition at line 412 of file GraphOptions.h.

412 std::string segment_name;

stream_id

std::string simaai::neat::Sample::stream_id

Stream identifier (multi-stream pipelines).

Definition at line 403 of file GraphOptions.h.

403 std::string stream_id;

stream_label

std::string simaai::neat::Sample::stream_label

Human-readable stream label.

Definition at line 404 of file GraphOptions.h.

404 std::string stream_label;

tensor

std::optional<simaai::neat::Tensor> simaai::neat::Sample::tensor

Set when kind == Tensor.

Definition at line 387 of file GraphOptions.h.

387 std::optional<simaai::neat::Tensor> tensor;

tensors

TensorList simaai::neat::Sample::tensors

Set when kind == TensorSet.

Definition at line 388 of file GraphOptions.h.


The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.