UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

32 lines 1.53 kB
import { IEmscriptenWrapper } from "../emscripten/i-emscripten-wrapper.js"; import { type IManagedObject, type IManagedResourceNode } from "../../lifecycle/manged-resources.js"; import type { IInteropBindings } from "../emscripten/i-interop-bindings.js"; /** * @public * Provides a reference counted wrapper to a pointer `malloc`'d from JS and is `free`'d on reference count hitting 0. */ export interface ISharedMemoryBlock extends IManagedObject { readonly pointer: number; readonly byteSize: number; getDataView(): DataView; } /** * @public * {@inheritDoc ISharedMemoryBlock} */ export declare class SharedMemoryBlock implements ISharedMemoryBlock { private readonly wrapper; readonly resourceHandle: IManagedResourceNode; readonly pointer: number; readonly byteSize: number; /** * @throws exception if allocation cannot be performed. */ static createOne(wrapper: IEmscriptenWrapper<IInteropBindings>, bindToReference: IManagedResourceNode | null, byteSize: number): SharedMemoryBlock; static createOne(wrapper: IEmscriptenWrapper<IInteropBindings>, bindToReference: IManagedResourceNode | null, byteSize: number, allocationFailThrows: boolean): SharedMemoryBlock | null; getWrapper(): IEmscriptenWrapper<IInteropBindings>; getDataView(): DataView; protected constructor(wrapper: IEmscriptenWrapper<IInteropBindings>, owner: IManagedResourceNode | null, pointer: number, byteSize: number); private impl; } //# sourceMappingURL=shared-memory-block.d.ts.map