Class SiemensGotoIterationDependency
- Namespace
- Hi.NcParsers.Dependencys.Siemens
- Assembly
- HiMech.dll
Watchdog for Siemens GOTOF/GOTOB jumps — the
label-keyed sibling of the Fanuc
FanucGotoIterationDependency, with the same
“soft-cap + runtime counter + session-init ISessionResettable”
shape. Kept per-brand (rather than widening the Fanuc dep's int-keyed
bucket) for diagnostic clarity and because Siemens targets are named
labels, not N-numbers.
The counter key is (FileName, Label) where FileName is
the source-level file path of the jump host (the relative form
carried on FilePath). Source-level keying
means multiple inline invocations of the same subprogram pool their
counts, while two files each jumping to their own LBL1 stay
isolated. Forward and backward jumps to the same label share one
bucket — only the backward direction can loop, but a shared bucket
keeps the accounting simple and the cap generous.
The consuming syntax
(SiemensGotoSyntax) counts
after the condition gate and before the label scan; above
MaxIterationsPerLabel the jump warns
SiemensGoto--IterationLimitExceeded and falls through. A
missing dependency disables the cap (Fanuc parity) — the brand preset
wires one by default.
public class SiemensGotoIterationDependency : INcDependency, IMakeXmlSource, ISessionResettable
- Inheritance
-
SiemensGotoIterationDependency
- Implements
- Inherited Members
- Extension Methods
Constructors
SiemensGotoIterationDependency()
Initializes a new instance with the default limit and an empty counter.
public SiemensGotoIterationDependency()
SiemensGotoIterationDependency(XElement)
Loads MaxIterationsPerLabel from XML produced by MakeXmlSource(string, string, bool); absent element falls back to DefaultMaxIterationsPerLabel.
public SiemensGotoIterationDependency(XElement src)
Parameters
Fields
DefaultMaxIterationsPerLabel
Default for MaxIterationsPerLabel — matches the Fanuc GOTO default: jumps are not the legitimate bulk-iteration primitive (the loop constructs are), so the cap stays tight.
public const int DefaultMaxIterationsPerLabel = 1000
Field Value
Properties
CountByLabel
Per-target hit counter keyed by (FileName, Label).
Runtime-only; not serialised. Cleared by OnSessionReset()
on the session-init edge.
public Dictionary<(string FileName, string Label), int> CountByLabel { get; }
Property Value
MaxIterationsPerLabel
Soft cap on fired jumps for any single (FileName, Label)
pair. Above this the host block emits
SiemensGoto–IterationLimitExceeded and falls through.
public int MaxIterationsPerLabel { get; set; }
Property Value
XName
XML element name used to register this dependency with XFactory.
public static string XName { get; }
Property Value
Methods
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
OnSessionReset()
Clears CountByLabel; leaves MaxIterationsPerLabel untouched.
public void OnSessionReset()
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory