Class NcPieceMap
- Namespace
- Hi.NcParsers.NcWriteback
- Assembly
- HiMech.dll
Bidirectional src↔dst piece mapping built by an INcPieceConverter: one source piece converts to n destination pieces (synthesis may spell several NC lines per source piece), while each destination piece derives from exactly one source piece. Keys are SentenceIndex values — the session-global execution-order identity already used for cross-process alignment — so a GUI can navigate src line ↔ dst line in both directions.
Register(SyntaxPiece, SyntaxPiece) also stamps a SourceRefSectionName
section ({SentenceIndex, FileIndex, LineIndex} of the source
piece) into the destination piece's JsonObject
— the durable half of the mapping that survives piece serialization.
The NC-optimization output path shares this exact mechanism for its own
dst streams.
public class NcPieceMap
- Inheritance
-
NcPieceMap
- Inherited Members
- Extension Methods
Fields
SourceRefSectionName
Name of the JSON section stamped on each destination piece,
recording the source piece's SentenceIndex (always) and its
FileIndex/LineIndex (when the source sentence carries
a char segment).
public const string SourceRefSectionName = "SourceRef"
Field Value
Properties
DstSentenceIndices
Destination-side keys with a registered source piece.
public IReadOnlyCollection<int> DstSentenceIndices { get; }
Property Value
SrcSentenceIndices
Source-side keys with at least one destination piece.
public IReadOnlyCollection<int> SrcSentenceIndices { get; }
Property Value
Methods
GetDstPieces(int)
Returns the destination pieces derived from the source piece with the given SentenceIndex; empty when the source produced no output (e.g. a comment-only or state-only piece under synthesis).
public IReadOnlyList<SyntaxPiece> GetDstPieces(int srcSentenceIndex)
Parameters
srcSentenceIndexint
Returns
GetSrcPiece(int)
Returns the source piece the destination piece with the given SentenceIndex derives from; null when unregistered.
public SyntaxPiece GetSrcPiece(int dstSentenceIndex)
Parameters
dstSentenceIndexint
Returns
Register(SyntaxPiece, SyntaxPiece)
Registers one derivation: dstPiece was produced
from srcPiece. Appends to the src → dst list,
sets the dst → src entry, and stamps the
SourceRefSectionName section on the destination
piece's JSON. Null arguments are ignored.
public void Register(SyntaxPiece srcPiece, SyntaxPiece dstPiece)
Parameters
srcPieceSyntaxPiecedstPieceSyntaxPiece