UNPKG

@thi.ng/soa

Version:

SOA & AOS memory mapped structured views with optional & extensible serialization

31 lines 1.71 kB
import type { ILength } from "@thi.ng/api"; import { type TypedArray } from "@thi.ng/api/typedarray"; import type { ReadonlyVec, Vec } from "@thi.ng/vectors"; import type { SOAAttribSpec, SOASpecs, SOATuple } from "./api.js"; export declare class SOA<K extends string> implements ILength { length: number; buffers: Record<K, TypedArray>; specs: SOASpecs<K>; constructor(num: number, specs: SOASpecs<K>); keys(): K[]; values(from?: number, to?: number): IterableIterator<SOATuple<K, Vec>>; attribValues(id: K, from?: number, to?: number): Vec<number>[]; attribValue(id: K, i: number): Vec; attribValueUnsafe(id: K, i: number): Vec; setAttribValue(id: K, i: number, val: ReadonlyVec): void; setAttribValueUnsafe(id: K, i: number, val: ReadonlyVec): this; setAttribValues(id: K, vals: Iterable<ReadonlyVec>, from?: number): this; index(i: number): SOATuple<K, Vec>; index<ID extends K>(i: number, ids: ID[]): SOATuple<ID, Vec>; indexUnsafe(i: number): SOATuple<K, Vec>; indexUnsafe<ID extends K>(i: number, ids: ID[]): SOATuple<ID, Vec>; setIndex(i: number, vals: Partial<SOATuple<K, ReadonlyVec>>): this; setIndexUnsafe(i: number, vals: Partial<SOATuple<K, ReadonlyVec>>): this; setValues(vals: Partial<SOATuple<K, Iterable<ReadonlyVec>>>, from?: number): this; copyTo(dest: SOA<K>, ids?: K[], destFrom?: number, srcFrom?: number, srcTo?: number): SOA<K>; addSpecs(specs: SOASpecs<K>): void; protected validateSpec(id: K, spec: Partial<SOAAttribSpec>): void; protected ensureAttrib(id: K): void; } export declare const soa: <K extends string>(num: number, specs: SOASpecs<K>) => SOA<K>; //# sourceMappingURL=soa.d.ts.map