Skip to navigation

holoscan::ForeignOperatorCore

Beta
View as Markdown

Host one language-neutral Operator through a non-throwing callback table.

#include <holoscan/foreign_operator.hpp>

Inherits from: holoscan::Operator< NoParams > (public)


Constructors

ForeignOperatorCore

Construct one hosted Operator from a copyable callback capture.

Parameters

callbacks
ForeignOperatorCallbacks

Owned callback capture copied by the ordinary Graph factory.

options
ForeignOperatorOptionsDefaults to {}

Plan-visible hosting and serialization declarations.

Destructor

~ForeignOperatorCore

holoscan::ForeignOperatorCore::~ForeignOperatorCore() override = default

Methods

setup

void holoscan::ForeignOperatorCore::setup(
) override

Declare stable ports and other cold metadata by reference.

Repeated calls receive fresh specs and must describe the same deterministic contract.

Parameters

spec
OperatorSpec &

Fresh declaration pass owned by the compiler or private conformance fixture.

contract

Contract holoscan::ForeignOperatorCore::contract() const override

Return this Operator type’s complete cold temporal contract.

Runtime does not retain this authoring object’s address. Compilation calls this operation while replaying an owning Operator factory and freezes the validated descriptor into pointer-free plan records.

Returns: Fresh deep-owning descriptor; an empty value requests the inputful compile-time OnAnyInput default and is invalid for a zero-input Operator.

start

void holoscan::ForeignOperatorCore::start() override

Enter steady-state execution after admitted startup barriers.

An override must remain public and keep the exact void start() signature. Graph authoring lowers it into the single required LifecycleStage::kStart checkpoint; an Operator cannot also register an advanced callback for that stage. Cold preparation belongs to explicit lifecycle stages added by their owning component. For a typed session-owned Operator, params() exposes the exact parameter generation selected for this phase.

stop

void holoscan::ForeignOperatorCore::stop() override

Leave steady-state execution before resource release.

An override must remain public and keep the exact void stop() signature. Graph authoring lowers it into the single required LifecycleStage::kStop checkpoint; an Operator cannot also register an advanced callback for that stage. For a typed session-owned Operator, params() exposes the exact parameter generation selected for this phase, including the restored old-published view during rollback.

compute

expected<void, Error> holoscan::ForeignOperatorCore::compute(
) override

Process one frozen activation candidate.

The callback is invoked at most once for one activation tag. It must not wait for or recursively trigger another activation.

Returns: Success after Operator work completes, or a typed failure for Runtime policy.

Parameters

context
ExecutionContext &

Borrowed callback-lifetime runtime services and activation evidence.

host_metadata

OperatorHostMetadata holoscan::ForeignOperatorCore::host_metadata() const noexcept override

Return cold compiler-visible callback-host metadata.

Returns: Native hosting without a serialization constraint by default.

params

const Params & holoscan::Operator<NoParams>::params() const noexcept

Return this Operator instance’s currently stored parameter aggregate.

Before session binding, the aggregate is the authoring default. During a legacy start() or stop() callback on a session-owned instance, it is the exact generation selected for that lifecycle phase. Advanced lifecycle callbacks must use LifecycleContext and compute callbacks must use ExecutionContext::params<ParamsT>() for their pinned views. Runtime may replace the stored aggregate between quiesced lifecycle callbacks, so callers must not retain the returned reference across callback boundaries. This operation does not allocate or synchronize.

Returns: Process-static shared NoParams value, or a stable reference to this instance’s aggregate.

has_foreign_lifecycle_callback

bool holoscan::ForeignOperatorCore::has_foreign_lifecycle_callback(
) const noexcept

Return whether the foreign adapter declared one advanced lifecycle callback.

Returns: true only when the adapter declared stage and supplied a dispatcher.

Parameters

stage
LifecycleStage

Exact stage queried after the setup callback completed.

foreign_lifecycle_callback_required

bool holoscan::ForeignOperatorCore::foreign_lifecycle_callback_required(
) const noexcept

Return whether one declared foreign lifecycle callback is required.

Returns: true for a required callback and false for an optional or absent callback.

Parameters

stage
LifecycleStage

Exact declared advanced lifecycle stage.

invoke_foreign_lifecycle_callback

LifecycleStatus holoscan::ForeignOperatorCore::invoke_foreign_lifecycle_callback(
) noexcept

Invoke one foreign advanced lifecycle callback without crossing the ABI with an exception.

Returns: The adapter-provided status, or fatal failure for an invalid callback result.

Parameters

stage
LifecycleStage

Exact stage registered by the concrete hosted Operator.

context
LifecycleContext &

Borrowed callback-lifetime lifecycle services.

callback_error

Error holoscan::ForeignOperatorCore::callback_error(
) const

Types

Typedefs

NameDefinitionDescription
ParamsNoParamsName the exact immutable parameter aggregate type.

Member variables

NameTypeDescription
callbacks_ForeignOperatorCallbacks
options_ForeignOperatorOptions
ports_std::vector< authoring::OpaquePortRef >