Table of Contents

Class ChunkedCallbackSystem<TContext, TChunk>

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

A ChunkedCallbackSystem<TContext> whose chunks each receive a typed record, TChunk, written for them by the system's prepare step: the chunk claiming index i runs with record i, instead of re-deriving what i means from the index.

public abstract class ChunkedCallbackSystem<TContext, TChunk> : ChunkedCallbackSystem<TContext>, ISystem where TContext : class where TChunk : unmanaged

Type Parameters

TContext
TChunk
Inheritance
ChunkedCallbackSystem<TContext, TChunk>
Implements
Inherited Members

Remarks

Prepare(TContext, ChunkTable<TChunk>) sizes the table with Reset(int), fills it, and returns the chunk count (0 skips, -1 keeps the static ChunkedParallel(int) count — the table must still hold that many records). It replaces Prepare(TContext) and the typed builder's Prepare lambda, which this class does not call.

Configure must still declare b.ChunkedParallel(N): that is what makes the system chunked.

Constructors

ChunkedCallbackSystem()

protected ChunkedCallbackSystem()

Methods

Execute(TickContext)

Execute the system's logic for this tick.

protected override sealed void Execute(TickContext ctx)

Parameters

ctx TickContext

Execute(TickContext, ref TChunk)

Runs one chunk with the record prepare wrote for it — by ref, so no member call on it copies it (see ChunkTable<T>).

protected abstract void Execute(TickContext tick, ref TChunk chunk)

Parameters

tick TickContext
chunk TChunk

Prepare(TContext)

Override to build a per-tick plan from the typed context and return the chunk count. Default invokes the fluent lambda set via Prepare(Func<TContext, int>), falling back to -1.

protected override sealed int Prepare(TContext ctx)

Parameters

ctx TContext

Returns

int

Prepare(TContext, ChunkTable<TChunk>)

Builds this dispatch's plan: one record per chunk in plan, and the chunk count.

protected abstract int Prepare(TContext ctx, ChunkTable<TChunk> plan)

Parameters

ctx TContext
plan ChunkTable<TChunk>

Returns

int