> This page is for version 5.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 5.0 (Latest) (default): https://docs.nvidia.com/holoscan/sdk-user-guide/5-0-latest/llms.txt
> - ltsb-2.0: https://docs.nvidia.com/holoscan/sdk-user-guide/ltsb-2-0/llms.txt
> - 4.6: https://docs.nvidia.com/holoscan/sdk-user-guide/4-6/llms.txt
> - 4.5: https://docs.nvidia.com/holoscan/sdk-user-guide/4-5/llms.txt
> - 4.4: https://docs.nvidia.com/holoscan/sdk-user-guide/4-4/llms.txt
> - 4.3: https://docs.nvidia.com/holoscan/sdk-user-guide/4-3/llms.txt
> - Archives: https://docs.nvidia.com/holoscan/sdk-user-guide/archives/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::ForeignOperatorCore

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

Host one language-neutral [Operator](operator) through a non-throwing callback table.

```cpp showLineNumbers={false}
#include <holoscan/foreign_operator.hpp>
```

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

---

## Constructors

### ForeignOperatorCore \[#foreignoperatorcore]

```cpp showLineNumbers={false}
holoscan::ForeignOperatorCore::ForeignOperatorCore(
    ForeignOperatorCallbacks callbacks,
    ForeignOperatorOptions options = {}
)
```

Construct one hosted [Operator](operator) from a copyable callback capture.

**Parameters**

**`callbacks`** `ForeignOperatorCallbacks`

Owned callback capture copied by the ordinary [Graph](graph) factory.

---

**`options`** `ForeignOperatorOptions` — default: \{}

Plan-visible hosting and serialization declarations.

---

### Destructor \[#destructor]

### \~ForeignOperatorCore

```cpp showLineNumbers={false}
holoscan::ForeignOperatorCore::~ForeignOperatorCore() override = default
```

---

## Methods

### setup \[#setup]

```cpp showLineNumbers={false}
void holoscan::ForeignOperatorCore::setup(
    OperatorSpec &spec
) override
```

Declare stable ports and other cold metadata by reference.

> **Note**
>
> 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]

```cpp showLineNumbers={false}
Contract holoscan::ForeignOperatorCore::contract() const override
```

Return this [Operator](operator) type's complete cold temporal contract.

> **Note**
>
> Runtime does not retain this authoring object's address. Compilation calls this operation while replaying an owning [Operator](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](../structs/onanyinput) default and is invalid for a zero-input [Operator](operator).

### start \[#start]

```cpp showLineNumbers={false}
void holoscan::ForeignOperatorCore::start() override
```

Enter steady-state execution after admitted startup barriers.

> **Note**
>
> An override must remain public and keep the exact `void `[`start()`](#start) signature. [Graph](graph) authoring lowers it into the single required LifecycleStage::kStart checkpoint; an [Operator](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](operator), `params()` exposes the exact parameter generation selected for this phase.

### stop \[#stop]

```cpp showLineNumbers={false}
void holoscan::ForeignOperatorCore::stop() override
```

Leave steady-state execution before resource release.

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

### compute \[#compute]

```cpp showLineNumbers={false}
expected<void, Error> holoscan::ForeignOperatorCore::compute(
    ExecutionContext &context
) override
```

Process one frozen activation candidate.

> **Note**
>
> 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](operator) work completes, or a typed failure for Runtime policy.

**Parameters**

**`context`** `ExecutionContext &`

Borrowed callback-lifetime runtime services and activation evidence.

---

### host_metadata \[#hostmetadata]

```cpp showLineNumbers={false}
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 \[#params]

```cpp showLineNumbers={false}
const Params & holoscan::Operator<NoParams>::params() const noexcept
```

Return this [Operator](operator) instance's currently stored parameter aggregate.

> **Note**
>
> Before session binding, the aggregate is the authoring default. During a legacy [`start()`](operatorbase#start) or [`stop()`](operatorbase#stop) callback on a session-owned instance, it is the exact generation selected for that lifecycle phase. Advanced lifecycle callbacks must use [`LifecycleContext`](lifecyclecontext) and compute callbacks must use [`ExecutionContext::params`](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`](../structs/noparams) value, or a stable reference to this instance's aggregate.

### has_foreign_lifecycle_callback \[#hasforeignlifecyclecallback]

```cpp showLineNumbers={false}
bool holoscan::ForeignOperatorCore::has_foreign_lifecycle_callback(
    LifecycleStage stage
) 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](../structs/exact) stage queried after the setup callback completed.

---

### foreign_lifecycle_callback_required \[#foreignlifecyclecallbackrequired]

```cpp showLineNumbers={false}
bool holoscan::ForeignOperatorCore::foreign_lifecycle_callback_required(
    LifecycleStage stage
) 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](../structs/exact) declared advanced lifecycle stage.

---

### invoke_foreign_lifecycle_callback \[#invokeforeignlifecyclecallback]

```cpp showLineNumbers={false}
LifecycleStatus holoscan::ForeignOperatorCore::invoke_foreign_lifecycle_callback(
    LifecycleStage stage,
    LifecycleContext &context
) 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](../structs/exact) stage registered by the concrete hosted [Operator](operator).

---

**`context`** `LifecycleContext &`

Borrowed callback-lifetime lifecycle services.

---

### callback_error \[#callbackerror]

```cpp showLineNumbers={false}
Error holoscan::ForeignOperatorCore::callback_error(
    ForeignOperatorResult result
) const
```

---

## Types

### Typedefs

| Name     | Definition | Description                                        |
| -------- | ---------- | -------------------------------------------------- |
| `Params` | `NoParams` | Name the exact immutable parameter aggregate type. |

---

## Member variables

| Name         | Type                                      | Description |
| ------------ | ----------------------------------------- | ----------- |
| `callbacks_` | `ForeignOperatorCallbacks`                |             |
| `options_`   | `ForeignOperatorOptions`                  |             |
| `ports_`     | `std::vector< authoring::OpaquePortRef >` |             |