RaylibTempAllocatorBase<TempType extends RaylibTempBase<RaylibBase> , P, S> class
abstract
Base class for Raylib temporary allocators, managing typed memory slots with a consistent allocation/free lifecycle.
Type parameters:
TempTypethe temp context this allocator belongs toPthe pointer type (WasmPointeron WASM,Pointer<C>on native)Sthe source type that pointers are created from (inton WASM,Pointer<C>on native)
Constructors
- RaylibTempAllocatorBase(TempType temp, String name, {required int byteSize, required S allocatorFunc([int count]), required void freeFunc(S ptr), required P pointerFactory(S ptr), required S pointerToSource(P ptr), required P nullptrFactory(), required String printerFunc(P ptr), required bool isPointerNull(P ptr)})
Properties
- allocatorFunc → S Function([int count])
-
Allocates
countelements and returns the raw source pointer.final - byteSize → int
-
Size in bytes of a single element this allocator manages.
final
- freeFunc → void Function(S ptr)
-
Frees the memory at
ptr.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isPointerNull → bool Function(P ptr)
-
Returns
trueifptris null or zero.final - name → String
-
Debug name for this allocator, used in logging and diagnostics.
final
- nullptrFactory → P Function()
-
Returns a null/zero pointer of type
P.final - pointerFactory → P Function(S ptr)
-
Wraps a source pointer
ptrinto the platform pointer typeP.final - pointerToSource → S Function(P ptr)
-
Unwraps a platform pointer
ptrback to its source typeS.final - printerFunc → String Function(P ptr)
-
Returns a human-readable string representation of
ptr.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
slots
→ Map<
String, (P, int)> -
Active allocation slots, keyed by slot name.
Each entry holds the pointer and its element count.
final
- temp → TempType
-
final
Methods
-
At(
String key, [int count = 1]) → P -
Returns the
Pstored inkey, allocating (or reallocating) if necessary. -
AtUnique(
String key, [int count = 1]) → P -
Allocates (or reuses) a slot identified by a unique
keysuffix. -
dispose(
) → void - Frees all currently tracked slots and clears the slot table.
-
Free(
String key) → void -
Frees the native memory owned by slot
keyand removes it from the table. -
Has(
String key) → bool -
Returns
trueif a slot with the givenkeyexists. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
Raw(
[int count = 1]) → P -
Allocates
countraw elements and returns the wrapped pointer. -
signature(
) → String - Returns a string that identifies the concrete type of this allocator, including its type parameters.
-
Size(
[int count = 1]) → int -
Returns the total byte size for
countelements. -
Slot(
String key) → P? -
Returns the pointer stored under
key, ornullif the slot does not exist. Does not allocate. -
slotKey(
[String? key]) → String -
Returns the canonical slot key for
key, falling back to'struct'whenkeyisnull. -
toString(
) → String -
A string representation of this object.
inherited
-
uniqueSlotKey(
String key) → String -
Returns a slot key guaranteed to be unique within this temp context,
by prefixing
keywith the next available ID. -
Unslot(
String key) → void -
Removes the slot entry for
keyfrom the table without freeing the underlying memory.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited