Class MappingAnchorDependency
- Namespace
- Hi.NcParsers.Dependencys.SystemWired
- Assembly
- HiMech.dll
Narrow NC-pipeline dependency that lets a CSV semantic convert an absolute
controller instant to a run-relative timecode against the project mapping
anchor, without reaching the whole IMachiningService
surface (cf. MachiningServiceDependency). The host wires
ToTimecodeProvider to TimeMapping.ToTimecode, whose
set-once ??= seeds (lazily builds) the anchor on first use.
Runtime-only: the provider is wired per host and not persisted; serialization writes only the empty element so the dependency survives an XML round-trip.
public class MappingAnchorDependency : INcDependency, IMakeXmlSource
- Inheritance
-
MappingAnchorDependency
- Implements
- Inherited Members
- Extension Methods
Constructors
MappingAnchorDependency()
Initializes a new instance with no provider; the host wires one before queries.
public MappingAnchorDependency()
Properties
ToTimecodeProvider
Runtime provider for the anchor converter (TimeMapping.ToTimecode).
Null provider means the host is not wired; consumers must null-check and
fall back to the legacy time-of-day.
public Func<DateTime, TimeSpan> ToTimecodeProvider { 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.
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
ToTimecode(DateTime)
Converts instant to a run-relative timecode via the
wired anchor, or null when no provider is wired.
public TimeSpan? ToTimecode(DateTime instant)
Parameters
instantDateTime