Skip to main content

ClikaRT::runtime::Model

class

Header: ClikaRT/runtime/model.h
Inherited by: ClikaRT::runtime::FunctionModel

The serving-model contract: subclass this to run under Executor / Pipeline.

A model declares its I/O (schema), its phase list (phases), and implements the phase bodies (Phase_RunOnce for one-shot phases, Phase_Iterate for continuous-batched stepping); stateful models allocate per-session state in make_state and reclaim it in evict. Overrides MAY raise ClikaRT::Error; the runtime catches caller-side and fails only that session.

Member functions

~Model()

virtual ~Model()

Virtual base destructor.

Declared in ClikaRT/runtime/model.h, line 46

schema()

virtual const ModelSchema& schema() const =0

The model's I/O contract. Return a reference to model-owned storage.

Declared in ClikaRT/runtime/model.h, line 49

phases()

virtual ClikaRT::Span<const PhaseSpec> phases() const =0

The model's phases, in order. Borrowed (model-owned storage).

Declared in ClikaRT/runtime/model.h, line 51

make_state()

virtual ModelState* make_state(Stream stream) const

Allocate per-session state (stateful models only). Return a heap-allocated ModelState subclass (the runtime takes ownership and frees it after evict); the default returns nullptr (stateless). MAY raise on failure.

Declared in ClikaRT/runtime/model.h, line 56

Phase_RunOnce()

virtual void Phase_RunOnce(const PhaseSpec& phase, PhaseContext& ctx) =0

Run a RunOnce phase: read ctx.inputs, write ctx.outputs. MAY raise.

Declared in ClikaRT/runtime/model.h, line 59

Phase_Iterate()

virtual StepBatchOut Phase_Iterate(const PhaseSpec&, StepContext&)

Step an Iterate phase over the batch in ctx.slots; return one SessionStepResult per slot (in order). The default raises Unsupported (a RunOnce-only model need not override it). MAY raise.

Declared in ClikaRT/runtime/model.h, line 64

evict()

virtual void evict(ModelState& state) noexcept

Reclaim a session's state before the runtime destroys it (free slots, caches). Default: no-op. Must not throw.

Declared in ClikaRT/runtime/model.h, line 74