Class CacheSyntax
- Namespace
- Hi.NcParsers.PostSyntaxs
- Assembly
- HiMech.dll
Periodic modal-section snapshot. For each key in TrackedKeys, if the current block has no section for that key and no prior block within the last Pace-1 blocks does either, walk further back to the nearest defined value, deep-clone it into the current block, and set AddedByKey = AddedByValue inside the cloned section. Bounds every EnumerateBack()-based modal lookup in the LogicSyntaxs layer to O(Pace) instead of O(N).
public class CacheSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
CacheSyntax
- Implements
- Inherited Members
- Extension Methods
Constructors
CacheSyntax()
public CacheSyntax()
CacheSyntax(XElement)
public CacheSyntax(XElement src)
Parameters
srcXElement
Fields
AddedByValue
Value written under AddedByKey on each cached section this syntax deep-clones from an earlier block. Mirrors AddedByValue's role for its own synthesis — both let cache-file readers distinguish PostSyntaxs-stage injections from LogicSyntaxs-stage authored values (the latter have no AddedByKey).
public const string AddedByValue = "Cache"
Field Value
Properties
Default
public static CacheSyntax Default { get; }
Property Value
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
Pace
Interval, in block count, between cache snapshots.
public int Pace { get; set; }
Property Value
TrackedKeys
Section keys to cache. Order-insensitive; duplicates ignored.
public List<string> TrackedKeys { get; set; }
Property Value
XName
public static string XName { get; }
Property Value
Methods
Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)
Build syntax arrangement into the
syntaxPieceNode in-place.
public void Build(LazyLinkedListNode<SyntaxPiece> node, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)
Parameters
nodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
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.