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

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 count and returns a freshly allocated Pointer<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 T struct at index i of the array at ptr.
getter/setter pair
indexSetterFunc ↔ void Function(Pointer<T> ptr, int i, T value)
Overwrites the i-th element of the array at ptr with value.
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 value into the i-th element of the array at ptr.
getter/setter pair
sizeOfFunc int Function()
Returns the size in bytes of a single T struct.
getter/setter pair
writeIntoFunc ↔ void Function(Pointer<T> ptr, X value)
Writes the Dart value value into the struct at ptr.
getter/setter pair
writeIntoIndexedFunc ↔ void Function(Pointer<T> ptr, int i, X value)
Writes the Dart value value into the i-th element of the array at ptr.
getter/setter pair

Methods

Array(List<X> array, {String? key}) Pointer<T>
Writes array into a tracked slot of sufficient capacity.
At(String key, [int count = 1]) Pointer<T>
Returns the Pointer<T> stored in key, allocating (or reallocating) if necessary.
inherited
Copy(Pointer<T> src, int length, {String? key}) Pointer<T>
Copies length structs from src into a tracked slot using setCFunc.
Fill(int count, X init(int), {String? key}) Pointer<T>
Fills a tracked slot of count structs, producing each element via init(i) and writing it through writeIntoIndexedFunc.
FillInto(int count, void init(int, T), {String? key}) Pointer<T>
Fills a tracked slot of count structs by calling init(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 count structs by setting each element to the T returned by init(ptr, i).
Free(String key) → void
Frees the native memory owned by slot key and removes it from the table.
inherited
Has(String key) bool
Returns true if a slot with the given key exists.
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 count structs.
RawArray(List<X> array) Pointer<T>
Allocates an unslotted array and writes each X value from array into it.
RawFillInto(int count, void init(int, T)) Pointer<T>
Allocates an unslotted array of count structs, populating each via init(i, struct) which writes directly into the native memory.
RawFillWith(int count, T init(Pointer<T>, int)) Pointer<T>
Allocates an unslotted array of count structs, setting each element to the T returned by init(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 count structs.
Slot(String key) Pointer<T>?
Returns the pointer stored under key, or null if the slot does not exist. Does not allocate.
inherited
ToC([X? value, String? key]) Pointer<T>
Converts value to its C representation into a tracked slot, or returns an existing slot if value is null.
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.
inherited
Value([X? value, String? key]) Pointer<T>
Returns the pointer for slot key, optionally writing value into it.

Operators

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