Skip to navigation

holoscan::OperatorBase

Beta
View as Markdown

Define the non-templated lifecycle and compute extension points for an Operator.

An Operator is a stable noncopyable, nonmovable authoring object. setup() records cold metadata only. When all required runtime bindings are admitted, Runtime invokes an overridden start() whenever its kStart checkpoint is eligible during initial startup or a restart, invokes compute() for frozen activations, and invokes an overridden stop() whenever its kStop checkpoint is eligible during startup rollback, restart processing, or final teardown. Missing bindings fail before callbacks rather than selecting weaker lifecycle or scheduling semantics.

#include <holoscan/operator.hpp>

Constructors

OperatorBase

Construct an unbound Operator authoring object.

Destructor

~OperatorBase

virtual holoscan::OperatorBase::~OperatorBase()

Destroy an Operator after its owning graph and run bindings have retired.


Assignment operators

operator=

The following overloads are deleted to prevent misuse:

OperatorBase & holoscan::OperatorBase::operator=(const OperatorBase &other) = delete;
OperatorBase & holoscan::OperatorBase::operator=(OperatorBase &&other) = delete;

Methods

setup

virtual void holoscan::OperatorBase::setup(
)

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

virtual Contract holoscan::OperatorBase::contract() const

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

virtual void holoscan::OperatorBase::start()

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

virtual void holoscan::OperatorBase::stop()

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

virtual expected<void, Error> holoscan::OperatorBase::compute(
)

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

virtual OperatorHostMetadata holoscan::OperatorBase::host_metadata() const noexcept

Return cold compiler-visible callback-host metadata.

Returns: Native hosting without a serialization constraint by default.

invoke_compute

expected<void, Error> holoscan::OperatorBase::invoke_compute(
)

defining_param_type

const ParamTypeDescriptor & holoscan::OperatorBase::defining_param_type() const noexcept

defining_param_schema

const ParamSchemaDescriptor * holoscan::OperatorBase::defining_param_schema() const noexcept

defining_param_type_impl

virtual const ParamTypeDescriptor & holoscan::OperatorBase::defining_param_type_impl() const noexcept

defining_param_schema_impl

virtual const ParamSchemaDescriptor * holoscan::OperatorBase::defining_param_schema_impl() const noexcept

parameter_address_impl

virtual const void * holoscan::OperatorBase::parameter_address_impl() const noexcept

replace_runtime_parameter_value_impl

virtual void holoscan::OperatorBase::replace_runtime_parameter_value_impl(
const void *value
) noexcept

has_no_params_impl

virtual bool holoscan::OperatorBase::has_no_params_impl() const noexcept