Skip to navigation

holoscan::Input

Beta
View as Markdown
template <PublishedPayload T>
class Input

Declare one typed sample input as a stable Operator member.

Runtime late-binds the declaration for an activation; the authoring object owns no queue or backend endpoint. All accessors use the same deterministic error precedence: unbound, stale, closed, not selected, cardinality mismatch, empty, then backend failure.

#include <holoscan/port.hpp>

Template parameters

T
PublishedPayload

Inherits from: holoscan::InputBase (public)


Constructors

Input

holoscan::Input<T>::Input() = default

Construct an unnamed unbound input declaration.

Destructor

~Input

holoscan::Input<T>::~Input() override = default

Destroy this stable input declaration after all runtime bindings have retired.


Methods

selection

InputSelection holoscan::Input<T>::selection() const noexcept

Return the frozen selection status for the current activation.

Preconditions

The declaration is inspected only during its Operator callback.

Returns: Status recorded by the selector, or absent/never-seen when unbound.

is_missing

bool holoscan::Input<T>::is_missing() const noexcept

Return whether selection produced no usable value.

Returns: true for absent, safe-default, or not-selected states.

is_stale

bool holoscan::Input<T>::is_stale() const noexcept

Return whether selection reused or rejected stale history.

Returns: true for a reused value or a kTooStale reason.

receive

expected<Sample<T>, Error> holoscan::Input<T>::receive()

Copy the selected scalar sample and its metadata.

Repeated calls return independent copies of the same frozen selection; they do not pop a queue or advance selection state. Each success nevertheless owns an independent finite read claim until that sample and all of its copies are destroyed.

Returns: An owning sample, or the deterministic accessor error.

receive_data

expected<T, Error> holoscan::Input<T>::receive_data()

Copy only the selected scalar payload.

The public semantic copy is ordinary caller-observable C++ behavior. Runtime-internal materialization failures are classified by the bound scalar operation before this copy. This payload-only accessor acquires no finite sample read claim.

Returns: Owning payload value, or the same classified error as receive.

Throws: Any exception raised by the admitted semantic copy in an exception-enabled build.

selected_sample

expected<SelectedSampleView<T>, Error> holoscan::Input<T>::selected_sample() const noexcept

Borrow the frozen scalar selection without copying or acquiring a read claim.

Repeated calls expose the same sample, even when owning read claims are exhausted. The view does not extend descriptor, Tensor, or backing ownership. Submit GPU work only on Runtime-registered streams; do not retain the view or its descriptor pointers past compute.

Returns: Immutable activation-scoped view, or the same classified scalar accessor error.

selected_batch

expected<SelectedBatchView<T>, Error> holoscan::Input<T>::selected_batch() const noexcept

Borrow the completed batch-shaped selection.

Returns: Immutable activation-scoped view, including a successful empty view, or a classified accessor error.

for_each_selected

template <typename Fn>
expected<void, Error> holoscan::Input<T>::for_each_selected(
Fn &&fn
) const

Invoke a fallible callable for each selected batch sample.

The callable is bound once as an lvalue before iteration; an rvalue callable is never repeatedly forwarded or moved between selected samples.

Returns: Success after every call, or the first accessor/callable error.

Template parameters

Fn
typename

Callable compatible with expected<void, Error>(const Sample<T>&).

Parameters

fn
Fn &&

Callable invoked in frozen selection order.

name

std::string_view holoscan::Input::name() const noexcept

Return the cold declaration name.

Returns: View valid until this port is destroyed.


Member variables

NameTypeDescription
binding_detail::InputBinding< T >