DataArrayPointer<T> class
abstract
A fixed-length array of length values stored inline in every entity's
row - data.hasFloat32Array(4) reserves four floats per entity, not a
pointer to a shared list.
Why two-argument get/set instead of pointer[entity][index].
The chained form needs an intermediate handle that knows both the row
and the array's layout (base offset, element width, length). This engine
forbids allocating one per access (the no-allocation rule: zero heap allocation
on the per-entity-per-tick hot path), and the obvious allocation-free
carrier - an extension type - can hold exactly one representation value.
An extension type over Entity alone therefore cannot know which array
field produced it, and widening it to a record (Entity, field) bets the
hot path on records being reliably unboxed in this AOT/VM combination,
which this project is not willing to assume.
Plain parameters have no such question mark: get(entity, index) passes
two integers to a method on the one long-lived pointer object that
already holds the layout. So the two-step subscript is dropped
deliberately - this is not an unfinished API.
Constructors
Properties
Methods
-
get(
Entity instance, int index) → T -
Element
indexofinstance's array. Throws RangeError ifindexis outside0 ..< length. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
Entity instance, int index, T newValue) → void -
Writes element
indexofinstance's array. Throws RangeError ifindexis outside0 ..< length. Elements are independent: writing one never disturbs its neighbours, including for sub-byte element widths that share a byte. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited