Skip to navigation

holoscan::SelectedSampleView

Beta
View as Markdown
template <PublishedPayload T>

Borrow one immutable scalar sample during its Operator activation.

Copying this view neither copies the payload nor acquires a read claim. The view and all references extracted from it expire when the callback’s selection retires. Each accessor terminates on an expired view in every build, provided the Runtime owner still exists; accessing a view after that owner’s destruction is unsupported. Extracted references cannot check expiry. Use Input::receive() when ownership must outlive the activation.

#include <holoscan/port.hpp>

Do not modify any reachable selected state, including mutable pointees exposed by generated shared-pointer fields. Const access does not enforce deep immutability. For generated prepared schema inputs, do not retain copied nested metadata shared_ptr owners past selection retirement. Reuse of that slot fails with ErrorCode::kPreparedStorageInvalid rather than mutating aliased metadata. Temporary owners destroyed before retirement are permitted; use owning receive() when metadata must outlive the activation. Releasing an escaped alias does not automatically restart a run that has already failed.

Template parameters

T
PublishedPayload

Published payload type of the selected sample.


Constructors

SelectedSampleView

const Sample<T> *sample,
const std::uint64_t *epoch,
std::uint64_t expected_epoch
) noexcept

Methods

sample

const Sample<T> & holoscan::SelectedSampleView<T>::sample() const noexcept

Return the selected sample without an owning copy.

Bind with const auto&; auto sample = view.sample() makes an owning copy.

Returns: Immutable activation-scoped sample reference.

data

const T & holoscan::SelectedSampleView<T>::data() const noexcept

Return the selected payload without copying it.

Returns: Immutable activation-scoped payload reference.

metadata

const SampleMetadata & holoscan::SelectedSampleView<T>::metadata() const noexcept

Return the Core sample metadata, not payload-specific metadata.

Returns: Immutable activation-scoped metadata reference.

operator*

const Sample<T> & holoscan::SelectedSampleView<T>::operator*() const noexcept

Dereference the selected sample.

Returns: Immutable activation-scoped sample reference.

operator->

const Sample<T> * holoscan::SelectedSampleView<T>::operator->() const noexcept

Return pointer access to the selected sample.

Returns: Immutable activation-scoped sample pointer.


Member variables

NameTypeDescription
sample_const Sample< T > *
epoch_const std::uint64_t *
expected_epoch_std::uint64_t