Class FileIndexCounterDependency
- Namespace
- Hi.NcParsers.Dependencys.SystemWired
- Assembly
- HiMech.dll
Per-session monotonically-increasing file index allocator. Holds the counter as a private field; Allocate() returns the next unused value and increments. Reset() rewinds to 0 — the owning RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) calls Reset() on the same edge that initializes a fresh NcRunnerSessionState, so a controller power-reset clears both the syntax-piece pipeline and this counter in lock-step.
Two consumers share one allocator:
- RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) allocates one index per top-level NC file that streams through the runner.
- SubProgramCallSyntax allocates a
fresh index for each inlined subprogram invocation, including
each
Lrepetition — distinct indices ensure(FileIndex, LineIndex)pairs stay unique across overlapping subprogram line ranges.
public class FileIndexCounterDependency : INcDependency, IMakeXmlSource
- Inheritance
-
FileIndexCounterDependency
- Implements
- Inherited Members
- Extension Methods
Constructors
FileIndexCounterDependency()
Initializes a new instance with the counter at 0.
public FileIndexCounterDependency()
Properties
XName
XML element name used to register this dependency with XFactory.
public static string XName { get; }
Property Value
Methods
Allocate()
Returns the next unused file index and post-increments the counter. First call after construction or Reset() returns 0.
public int Allocate()
Returns
MakeXmlSource(string, string, bool)
Runtime-only dependency — the live counter value is per-session and not meaningful to persist; serialization writes only the empty element so the dependency survives an XML round-trip with the counter implicitly reset to 0.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
Returns
Reset()
Rewinds the counter to 0. Called by RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) on the same edge that initializes a fresh session pipeline so a single brand-preset runner can be reused across sessions without leaking file indices from the previous session.
public void Reset()