Table of Contents

Interface ISessionStorage

Namespace
RDCore.SDK.Runtime.Abstract.Execution
Assembly
RDCore.SDK.dll

Holds the actual value bound at each address in a session's memory space, as either a typed IBindingHandle or, for the handful of MS-VBAL constructs that operate on raw storage (LSet between two UDT variables; MS-VBAL only ever allows this and the already-value-level fixed-length String form), a plain byte buffer. An address is one kind or the other, never both.

public interface ISessionStorage

Remarks

ISessionMemoryAllocator deliberately does not cover this: it only accounts for allocation size and fragmentation, never values. An ISessionStorage depends on one to reserve address space, then binds the caller's value at the resulting address.

Methods

TryAllocate(int, IBindingHandle, out MemoryAddress)

Reserves size bytes through the underlying ISessionMemoryAllocator and binds handle at the resulting address. A non-positive size (Nothing, Null, Empty, an uninitialized array, a UDT with no resolvable fields) never reaches the allocator at all — it gets an address of its own that can never collide with an allocated one, since nothing about it needs real memory.

bool TryAllocate(int size, IBindingHandle handle, out MemoryAddress address)

Parameters

size int
handle IBindingHandle
address MemoryAddress

Returns

bool

false if the underlying memory space is exhausted.

TryAllocateBytes(int, out MemoryAddress)

Reserves size bytes through the underlying ISessionMemoryAllocator as a raw byte buffer, zero-initialized, at the resulting address.

bool TryAllocateBytes(int size, out MemoryAddress address)

Parameters

size int
address MemoryAddress

Returns

bool

false if the underlying memory space is exhausted.

TryDeallocate(MemoryAddress)

Frees the binding and the underlying storage at address.

bool TryDeallocate(MemoryAddress address)

Parameters

address MemoryAddress

Returns

bool

true if a binding existed at address and was released.

TryPeek(MemoryAddress, out byte)

Reads the single byte at address, wherever it falls inside an allocation — a raw byte buffer, or the byte image of a bound value.

bool TryPeek(MemoryAddress address, out byte value)

Parameters

address MemoryAddress

Any address in the session's memory space.

value byte

The byte there.

Returns

bool

false if nothing is allocated at that address, or what is has no byte image.

Remarks

Direct, unchecked, byte-level access to the session's memory space: what a PEEK is. Nothing about the address needs to be the start of anything, or to mean anything.

TryPoke(MemoryAddress, byte)

Writes a single byte at address, wherever it falls inside an allocation.

bool TryPoke(MemoryAddress address, byte value)

Parameters

address MemoryAddress

Any address in the session's memory space.

value byte

The byte to write.

Returns

bool

false if nothing is allocated at that address, or what is has no byte image, or the mutated image is not a value of the same shape any more.

Remarks

The counterpart to TryPeek(MemoryAddress, out byte), and every bit as unchecked: writing one byte of a bound value's image changes that value to whatever the new image says, valid or not. That is what a POKE is for.

TryRead(MemoryAddress, out IBindingHandle?)

Gets the IBindingHandle bound at address.

bool TryRead(MemoryAddress address, out IBindingHandle? handle)

Parameters

address MemoryAddress
handle IBindingHandle

Returns

bool

TryReadBytes(MemoryAddress, out byte[]?)

Gets a copy of the byte buffer at address.

bool TryReadBytes(MemoryAddress address, out byte[]? bytes)

Parameters

address MemoryAddress
bytes byte[]

Returns

bool

false if address is not a byte-backed allocation.

TryRebind(MemoryAddress, IBindingHandle)

Replaces the IBindingHandle currently bound at address, e.g. to let a location-identified value (a UDT, an array) bind itself to the very address that was just reserved for it.

bool TryRebind(MemoryAddress address, IBindingHandle handle)

Parameters

address MemoryAddress
handle IBindingHandle

Returns

bool

true if address was already allocated and its binding was replaced.

TryWriteBytes(MemoryAddress, ReadOnlySpan<byte>)

Replaces the byte buffer at address with a copy of bytes. The new buffer's length need not match the original allocation's.

bool TryWriteBytes(MemoryAddress address, ReadOnlySpan<byte> bytes)

Parameters

address MemoryAddress
bytes ReadOnlySpan<byte>

Returns

bool

false if address is not a byte-backed allocation.