Class MemoryPath
- Namespace
- CStructSharp.Memory
- Assembly
- CStructSharp.dll
An immutable schema-only selection plan, reusable across records and independent operation contexts.
public sealed class MemoryPath
- Inheritance
-
MemoryPath
- Inherited Members
Remarks
No source, bytes, pointer value, session, or context is retained. Offset is unknown after a pointer value step. Holding a plan retains its schema; applications choose their own bounded reader lifetime.
Properties
Field
Gets the selected field, including bit slice, or null at roots and array elements.
public MemoryField? Field { get; }
Property Value
Offset
Gets the byte offset from the root, or null when the path follows a stored pointer.
public long? Offset { get; }
Property Value
- long?
ParentTypeId
Gets the selected field's immediate containing type ID, or null.
public string? ParentTypeId { get; }
Property Value
Path
Gets the original relative path.
public string Path { get; }
Property Value
RootType
Gets the root record's type.
public MemoryTypeDefinition RootType { get; }
Property Value
Schema
Gets the schema instance owning this plan.
public MemorySchema Schema { get; }
Property Value
Type
Gets the selected type without accessing memory.
public MemoryTypeDefinition Type { get; }
Property Value
Methods
Resolve(MemorySession, MemoryRegion, MemoryAccessContext?)
Applies this plan to a record, reading only intermediate pointer storage.
public MemorySelection Resolve(MemorySession session, MemoryRegion region, MemoryAccessContext? context = null)
Parameters
sessionMemorySessionSession with the identical schema instance and the desired pointer resolver.
regionMemoryRegionFinite root record extent.
contextMemoryAccessContextOperation-local budget and cancellation.
Returns
- MemorySelection
The final storage and containing-record metadata.
Exceptions
- ArgumentException
The session owns a different schema.
- CStructException
Selection or memory access failed.
- OperationCanceledException
Cancellation was requested.
TryResolve(MemorySession, MemoryRegion, out MemorySelection?, out MemoryReadFailure?, MemoryAccessContext?)
Applies prepared decisions without throwing for null pointers, incomplete storage, or unavailable memory.
public bool TryResolve(MemorySession session, MemoryRegion region, out MemorySelection? selection, out MemoryReadFailure? failure, MemoryAccessContext? context = null)
Parameters
sessionMemorySessionSession owning the identical schema.
regionMemoryRegionCaller-owned root extent.
selectionMemorySelectionSelected storage on success; null on failure.
failureMemoryReadFailureStructured failure on false; null on success.
contextMemoryAccessContextShared operation context; null creates one.
Returns
- bool
Whether the complete path resolved.
Exceptions
- ArgumentException
The schema instances differ.
- MemoryAccessException
A budget or depth limit was exhausted.
- OperationCanceledException
Cancellation was requested.