---
title: "ClikaRT::runtime::PhaseSpec"
sidebar_label: "PhaseSpec"
description: "One declared phase of a model. name is borrowed; it must point into storage the model keeps alive (e.g. a static string or a member), matching the internal \"model owns the name\" contract."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**Header:** `ClikaRT/runtime/schema.h`

One declared phase of a model. [`name`](./PhaseSpec.md#name) is borrowed; it must point into storage the model keeps alive (e.g. a static string or a member), matching the internal "model owns the name" contract.

A phase may carry its body as a callable instead of an override: a `RunOnce` phase set with [`run_once`](./PhaseSpec.md#run_once), an `Iterate` phase set with [`iterate`](./PhaseSpec.md#iterate). [`FunctionModel`](./FunctionModel.md) dispatches to these so a casual model needs no subclass at all (the callable runs caller-side, contained exactly like a [`Model`](./Model.md) override). A hand-written [`Model`](./Model.md) ignores them and overrides `Phase_RunOnce` / `Phase_Iterate` directly.

## Data members

### name {#name}

<div class="api-signature">

`std::string_view` **`name`**

</div>

phase name; unique within the model

<div class="api-declared">

Declared in `ClikaRT/runtime/schema.h`, line 40

</div>

### kind {#kind}

<div class="api-signature">

[`PhaseKind`](./index.md#PhaseKind) **`kind`** `=` [`PhaseKind::RunOnce`](./index.md#PhaseKind)

</div>

execution shape: run once vs iterate per step

<div class="api-declared">

Declared in `ClikaRT/runtime/schema.h`, line 41

</div>

### run\_once {#run_once}

<div class="api-signature">

`std::function<void(`[`PhaseContext`](./PhaseContext.md) `&)>` **`run_once`**

</div>

body for a RunOnce phase (optional)

<div class="api-declared">

Declared in `ClikaRT/runtime/schema.h`, line 42

</div>

### iterate {#iterate}

<div class="api-signature">

`std::function<`[`StepBatchOut`](./StepBatchOut.md)`(`[`StepContext`](./StepContext.md) `&)>` **`iterate`**

</div>

body for an Iterate phase (optional)

<div class="api-declared">

Declared in `ClikaRT/runtime/schema.h`, line 43

</div>
