← All compilation units

Flyology.Data_Structures.Regions

Description

Attaches process-local views to caller-owned backing bytes. This package does not create, map, flush, resize, synchronize, or release storage. A view may describe an Ada arena, an anonymous mapping, a file-backed mapping, or any other contiguous region whose lifetime the caller owns. Region operations are not synchronized; attachment, detachment, and backing-store lifetime require application-level exclusion.

Attach

procedure Attach (Item : in out View; Base : System.Address; Length : Byte_Count)

Attach Item to Length caller-owned bytes beginning at Base. The native base remains only in Item. Length must be positive and the complete range must be representable without native address wraparound.

Parameters
Item

Local view to attach

Base

First backing byte in this process

Length

Number of accessible bytes

Raised exceptions
Region_Error

Base is null, Length is zero or too large, or the native address range overflows

Detach

procedure Detach (Item : in out View)

Detach Item without changing or releasing any backing bytes. Existing structure views captured from Item must be detached separately before their backing storage is unmapped or released.

Parameters
Item

Local view to detach

Is_Attached

function Is_Attached (Item : View) return Boolean

Report whether Item currently names a local backing range.

Parameters
Item

Local view to inspect

Return value

True only after successful attachment and before detachment

Length

function Length (Item : View) return Byte_Count

Return Item's attached byte length, or zero while detached.

Parameters
Item

Local view to inspect

Return value

Number of bytes in the local backing range

Validate

procedure Validate (Item : View; Offset : Region_Offset; Extent : Byte_Count; Alignment : Byte_Count := 1)

Validate a persisted relationship without exposing a native address. Offset zero is rejected as the null sentinel. Alignment must be a nonzero power of two, and the entire Extent must fit in Item.

Parameters
Item

Local view containing the relationship

Offset

Persisted byte offset from the region base

Extent

Complete object extent in bytes

Alignment

Required native alignment

Raised exceptions
Region_Error

Item is detached or the relationship is null, overflowing, misaligned, out of range, or not natively representable

View

subtype View is Region_View;

Backing-region view governed by this package.