RTempStructAlloc<T extends Struct, X extends StructD<X, T> > class
A slot-based allocator for native structs of type T, accepting Dart-side
StructD wrappers of type X.
Bridges between the ergonomic Dart StructD layer and raw Pointer<T>
memory, supporting both single-value and array slots.
- Inheritance
-
- Object
- RTempAlloc<
T> - RTempStructAlloc
Constructors
-
RTempStructAlloc(RaylibTemp temp, String name, {required Pointer<
T> allocatorFunc([int count]), required String printerFunc(Pointer<T> ptr), required Pointer<T> castFunc(Pointer<NativeType> ptr), required int sizeOfFunc(), required void writeIntoIndexedFunc(Pointer<T> ptr, int i, X value), required void writeIntoFunc(Pointer<T> ptr, X value), required void setCFunc(Pointer<T> ptr, int i, T value), required T indexerFunc(Pointer<T> ptr, int i), required void indexSetterFunc(Pointer<T> ptr, int i, T value)})
Properties
-
allocatorFunc
↔ Pointer<
T> Function([int count]) -
Low-level allocation function. Called with an element
countand returns a freshly allocatedPointer<T>.getter/setter pairinherited -
castFunc
↔ Pointer<
T> Function(Pointer<NativeType> ptr) -
Casts an untyped Pointer to
Pointer<T>.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
-
indexerFunc
↔ T Function(Pointer<
T> ptr, int i) -
Returns the
Tstruct at indexiof the array atptr.getter/setter pair -
indexSetterFunc
↔ void Function(Pointer<
T> ptr, int i, T value) -
Overwrites the
i-th element of the array atptrwithvalue.getter/setter pair - name → String
-
Human-readable name for this allocator, used in debug/log messages.
finalinherited
-
printerFunc
↔ String Function(Pointer<
T> ptr) -
Debug printer: converts a
Pointer<T>to a human-readable string.getter/setter pairinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setCFunc
↔ void Function(Pointer<
T> ptr, int i, T value) -
Copies the raw C struct
valueinto thei-th element of the array atptr.getter/setter pair - sizeOfFunc ↔ int Function()
-
Returns the size in bytes of a single
Tstruct.getter/setter pair -
writeIntoFunc
↔ void Function(Pointer<
T> ptr, X value) -
Writes the Dart value
valueinto the struct atptr.getter/setter pair -
writeIntoIndexedFunc
↔ void Function(Pointer<
T> ptr, int i, X value) -
Writes the Dart value
valueinto thei-th element of the array atptr.getter/setter pair
Methods
-
Array(
List< X> array, {String? key}) → Pointer<T> -
Writes
arrayinto a tracked slot of sufficient capacity. -
At(
String key, [int count = 1]) → Pointer< T> -
Returns the
Pointer<T>stored inkey, allocating (or reallocating) if necessary.inherited -
Copy(
Pointer< T> src, int length, {String? key}) → Pointer<T> -
Copies
lengthstructs fromsrcinto a tracked slot using setCFunc. -
Fill(
int count, X init(int), {String? key}) → Pointer< T> -
Fills a tracked slot of
countstructs, producing each element viainit(i)and writing it through writeIntoIndexedFunc. -
FillInto(
int count, void init(int, T), {String? key}) → Pointer< T> -
Fills a tracked slot of
countstructs by callinginit(i, struct)which writes directly into the native struct fields. -
FillWith(
int count, T init(Pointer< T> , int), {String? key}) → Pointer<T> -
Fills a tracked slot of
countstructs by setting each element to theTreturned byinit(ptr, i). -
Free(
String key) → void -
Frees the native memory owned by slot
keyand removes it from the table.inherited -
Has(
String key) → bool -
Returns
trueif a slot with the givenkeyexists.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
Raw(
[int count = 1]) → Pointer< T> -
Allocates an unslotted block of
countstructs. -
RawArray(
List< X> array) → Pointer<T> -
Allocates an unslotted array and writes each
Xvalue fromarrayinto it. -
RawFillInto(
int count, void init(int, T)) → Pointer< T> -
Allocates an unslotted array of
countstructs, populating each viainit(i, struct)which writes directly into the native memory. -
RawFillWith(
int count, T init(Pointer< T> , int)) → Pointer<T> -
Allocates an unslotted array of
countstructs, setting each element to theTreturned byinit(ptr, i). -
signature(
) → String -
Returns a string that identifies the concrete type of this allocator,
including its type parameters (e.g.
"RTempAlloc<Float>").override -
Size(
[int count = 1]) → int -
Returns the total byte size for
countstructs. -
Slot(
String key) → Pointer< T> ? -
Returns the pointer stored under
key, ornullif the slot does not exist. Does not allocate.inherited -
ToC(
[X? value, String? key]) → Pointer< T> -
Converts
valueto its C representation into a tracked slot, or returns an existing slot ifvalueisnull. -
toString(
) → String -
A string representation of this object.
inherited
-
Unslot(
String key) → void -
Removes the slot entry for
keyfrom the table without freeing the underlying memory.inherited -
Value(
[X? value, String? key]) → Pointer< T> -
Returns the pointer for slot
key, optionally writingvalueinto it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited