RTempAlloc<T extends NativeType> class abstract

A slot-based temporary memory allocator for a single native type T.

Manages a named collection of Pointer<T> slots identified by string keys. Each slot owns its allocation; slots are freed either manually via Free or automatically when _dispose is called (e.g. at the end of a frame).

Subclasses specialise this for literal values, structs, strings, etc.

Implementers

Constructors

RTempAlloc(RaylibTemp temp, String name, {required Pointer<T> allocatorFunc([int count]), required String printerFunc(Pointer<T> ptr)})

Properties

allocatorFunc Pointer<T> Function([int count])
Low-level allocation function. Called with an element count and returns a freshly allocated Pointer<T>.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
name String
Human-readable name for this allocator, used in debug/log messages.
final
printerFunc String Function(Pointer<T> ptr)
Debug printer: converts a Pointer<T> to a human-readable string.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

At(String key, [int count = 1]) Pointer<T>
Returns the Pointer<T> stored in key, allocating (or reallocating) if necessary.
Free(String key) → void
Frees the native memory owned by slot key and removes it from the table.
Has(String key) bool
Returns true if a slot with the given key exists.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
signature() String
Returns a string that identifies the concrete type of this allocator, including its type parameters (e.g. "RTempAlloc<Float>").
Slot(String key) Pointer<T>?
Returns the pointer stored under key, or null if the slot does not exist. Does not allocate.
toString() String
A string representation of this object.
inherited
Unslot(String key) → void
Removes the slot entry for key from the table without freeing the underlying memory.

Operators

operator ==(Object other) bool
The equality operator.
inherited