Table of Contents

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

MemoryField

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

string

Path

Gets the original relative path.

public string Path { get; }

Property Value

string

RootType

Gets the root record's type.

public MemoryTypeDefinition RootType { get; }

Property Value

MemoryTypeDefinition

Schema

Gets the schema instance owning this plan.

public MemorySchema Schema { get; }

Property Value

MemorySchema

Type

Gets the selected type without accessing memory.

public MemoryTypeDefinition Type { get; }

Property Value

MemoryTypeDefinition

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

session MemorySession

Session with the identical schema instance and the desired pointer resolver.

region MemoryRegion

Finite root record extent.

context MemoryAccessContext

Operation-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

session MemorySession

Session owning the identical schema.

region MemoryRegion

Caller-owned root extent.

selection MemorySelection

Selected storage on success; null on failure.

failure MemoryReadFailure

Structured failure on false; null on success.

context MemoryAccessContext

Shared 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.