Class ChunkedCallbackSystem<TContext, TChunk>
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
TContextTChunk
- Inheritance
-
ChunkedCallbackSystem<TContext>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
ctxTickContext
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
tickTickContextchunkTChunk
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
ctxTContext
Returns
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
ctxTContextplanChunkTable<TChunk>