Class StepScopedProgress
- Namespace
- Hi.MachiningProcs
- Assembly
- HiMech.dll
A per-step IProgress<T> of IMessage that accumulates the messages emitted while one step is built and, when the batch is flushed, upgrades every plain message to a StepDiagnostic anchored to this step's StepIndex / SentenceCarrier. An already step-anchored StepDiagnostic is passed on unchanged. (NC diagnostics are not seen here — they live in their own NcDiagnosticProgress, not on this channel.)
The scope is opened on the thread that plays the acts, on the strip's count at the step's act, and anchored on the same thread to the index the step's strip position receives (Index) as the step is issued -- the two agree unless another thread issued steps in between. Anchoring at the flush, after that call, puts every message of the batch on the step's own index.
It does not forward to a downstream sink as messages arrive; instead it collects them into MessageList and is drained once via FlushTo(IProgress<StepDiagnostic>) at the step's sequential post-physics stage. Because that stage runs strictly in step order, the per-step batches land in execution order with no position-scanning insert. A step the step procedure does not build (it answers no bundle) is flushed on the thread that plays the acts right away, on the index it was opened on; a step refused with a cancelled bundle, or dropped or faulted in the pipeline, is never flushed.
No locking: a single step's scope has one writer at a time -- the thread that plays the acts until the step is issued (the anchor included), then the pipeline thread that runs the step's sequential stage; the issue orders the two, and the stages in between do not touch the scope. Parallelism across steps writes to different scopes, so each step holds its own instance — never a shared mutable "current step" on StepDiagnosticProgress, which would race.
public class StepScopedProgress : IProgress<IMessage>, IProgressMessage, IMessage, IMotionStepIndex
- Inheritance
-
StepScopedProgress
- Implements
- Inherited Members
- Extension Methods
Constructors
StepScopedProgress(int, ISentenceCarrier)
Initializes a new instance of the StepScopedProgress class.
public StepScopedProgress(int stepIndex, ISentenceCarrier sentenceCarrier)
Parameters
stepIndexintExecution-order index of the step: the strip's count when the step's act is processed, which the step procedure confirms or replaces with the index the step's strip position receives (AnchorTo(int)).
sentenceCarrierISentenceCarrierNC-source carrier for the step; may be null.
Properties
MessageList
Messages accumulated for this step, in emission order, as reported: a plain message is upgraded to a StepDiagnostic anchored to StepIndex when the batch is flushed, an already-anchored StepDiagnostic is passed on as it is. Written by the step's pipelined (one-at-a-time) construction tasks, then drained via FlushTo(IProgress<StepDiagnostic>).
public List<IMessage> MessageList { get; }
Property Value
SentenceCarrier
NC-source carrier for the step; may be null.
public ISentenceCarrier SentenceCarrier { get; }
Property Value
StepIndex
Execution-order index of the step this scope anchors to: the shell thread's strip count at the step's act until the step procedure assigns the index the step's strip position received (AnchorTo(int)). A plain message is anchored to the value standing at the flush.
public int StepIndex { get; }
Property Value
Methods
FlushTo(IProgress<StepDiagnostic>)
Drains the accumulated MessageList into sink in order, each
plain message upgraded to a StepDiagnostic anchored to StepIndex /
SentenceCarrier, each StepDiagnostic as it is. Called at the step's
sequential post-physics stage, so the session sink receives whole per-step batches already in
execution order — again from its catch when the flush itself threw — or, for a step the step
procedure did not build, on the thread that plays the acts right after the procedure returns.
public void FlushTo(IProgress<StepDiagnostic> sink)
Parameters
sinkIProgress<StepDiagnostic>The downstream sink (typically the session StepDiagnosticProgress); no-op if null.
Report(IMessage)
Reports a progress update.
public void Report(IMessage value)
Parameters
valueIMessageThe value of the updated progress.