@thi.ng/vector-pools
Version:
Data structures for managing & working with strided, memory mapped vectors
38 lines • 2.12 kB
TypeScript
import type { IObjectOf, IRelease, Maybe } from "@thi.ng/api";
import { type TypedArray } from "@thi.ng/api/typedarray";
import { MemPool } from "@thi.ng/malloc/pool";
import type { ReadonlyVec } from "@thi.ng/vectors";
import { type AttribPoolOpts, type AttribSpec } from "./api.js";
export declare class AttribPool implements IRelease {
attribs: IObjectOf<TypedArray>;
order: string[];
specs: IObjectOf<AttribSpec>;
pool: MemPool;
addr: number;
capacity: number;
byteStride: number;
maxAttribSize: number;
resizable: boolean;
constructor(opts?: AttribPoolOpts);
bytes(): Uint8Array<ArrayBufferLike>;
release(releasePool?: boolean): boolean;
addAttribs(specs: IObjectOf<AttribSpec>, alloc?: boolean): void;
attribValue<T extends number | TypedArray>(id: string, i: number): Maybe<T>;
attribValues<T extends number | TypedArray>(id: string): IterableIterator<T>;
attribArray(id: string): Uint8Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>;
setAttribValue(id: string, index: number, v: number | ReadonlyVec): this;
setAttribValues(id: string, vals: ReadonlyVec | ReadonlyVec[], index?: number): void;
setAttribs(specs: IObjectOf<Partial<{
data: ReadonlyVec | ReadonlyVec[];
index: number;
}>>): void;
removeAttrib(id: string): false | undefined;
ensure(newCapacity: number, fill?: boolean): void;
protected computeStride(specs: IObjectOf<AttribSpec>, inclExisting?: boolean): number[];
protected validateSpecs(specs: IObjectOf<AttribSpec>, stride?: number): void;
protected updateOrder(): void;
protected initDefaults(specs: IObjectOf<AttribSpec>, start?: number, end?: number): void;
protected setDefaults(specs: IObjectOf<AttribSpec>, start?: number, end?: number): void;
protected realign(newByteStride: number): void;
}
//# sourceMappingURL=attrib-pool.d.ts.map