import type { FloatVector as FloatVector2D, IntVector as IntVector2D, SCRTDoubleVector as SCRTDoubleVector2D, SCRTIntVector, SCRTUintVector as SCRTUintVector2D, TSciChart, UIntVector as UIntVector2D } from "../types/TSciChart"; import type { SCRTDoubleVector as SCRTDoubleVector3D, SCRTFloatVector as SCRTFloatVector3D, SCRTUintVector as SCRTUintVector3D, TSciChart3D } from "../types/TSciChart3D"; /** * Converts a WebAssembly vector to a JavaScript number array by creating a copy of the data. * * @remarks * This function creates a new JavaScript array containing a copy of all values from the WebAssembly vector. * The returned array is independent of the underlying WebAssembly memory, so it's safe to use even after * the original vector is deleted or modified. * * Use this function when you need to: * - Store vector data beyond the lifetime of the WebAssembly vector * - Pass data to JavaScript APIs that expect regular arrays * - Ensure data immutability * * @param vector - The WebAssembly vector to convert (SCRTDoubleVector2D, SCRTDoubleVector3D, FloatVector2D, UIntVector2D, IntVector2D or SCRTIntVector) * @param wasmContext - The WebAssembly context (TSciChart or TSciChart3D) that owns the vector * @returns A new number[] array containing a copy of all values from the vector */ export declare function vectorToArray(vector: SCRTDoubleVector2D | SCRTDoubleVector3D | FloatVector2D | SCRTFloatVector3D | UIntVector2D | SCRTUintVector2D | SCRTUintVector3D | IntVector2D | SCRTIntVector, wasmContext: TSciChart | TSciChart3D): number[]; /** * Creates a Float64Array view directly onto the WebAssembly memory backing the vector. * * @remarks * **IMPORTANT**: This function returns a view onto the underlying WebAssembly memory, NOT a copy. * * The returned Float64Array: * - Shares memory with the WebAssembly vector - changes to the underlying data will be reflected in the view * - May be written through only if you own the vector - see {@link copyToVectorF64} * - Becomes invalid if the vector is deleted or resized * - Has zero-copy performance characteristics, making it very efficient for reading large datasets * * Use this function when you need: * - High-performance read access to vector data * - To avoid memory allocation overhead * - Temporary access to data that won't outlive the vector * * If used with a FIFO vector (ie from a dataSeries with fifoCapacity set) you will get the raw buffer * and will need to use (index + fifoStartIndex) % fifoCapacity to access the data in the original order * * If you need to modify data or keep it beyond the vector's lifetime, use {@link vectorToArray} instead. * * @param vector - The WebAssembly vector to create a view for (SCRTDoubleVector2D or SCRTDoubleVector3D) * @param wasmContext - The WebAssembly context (TSciChart or TSciChart3D) that owns the vector * @returns A Float64Array view onto the WebAssembly memory */ export declare function vectorToArrayViewF64(vector: SCRTDoubleVector2D | SCRTDoubleVector3D, wasmContext: TSciChart | TSciChart3D): Float64Array; /** * Creates a Float32Array view directly onto the WebAssembly memory backing the vector. * * @remarks * **IMPORTANT**: This function returns a view onto the underlying WebAssembly memory, NOT a copy. * * The returned Float32Array: * - Shares memory with the WebAssembly vector - changes to the underlying data will be reflected in the view * - May be written through only if you own the vector - see {@link copyToVectorF64} * - Becomes invalid if the vector is deleted or resized * - Has zero-copy performance characteristics, making it very efficient for reading large datasets * * Use this function when you need: * - High-performance read access to vector data * - To avoid memory allocation overhead * - Temporary access to data that won't outlive the vector * * If you need to modify data or keep it beyond the vector's lifetime, use {@link vectorToArray} instead. * * @param vector - The WebAssembly vector to create a view for (FloatVector2D) * @param wasmContext - The WebAssembly context (TSciChart) that owns the vector * @returns A Float32Array view onto the WebAssembly memory */ export declare function vectorToArrayViewF32(vector: FloatVector2D | SCRTFloatVector3D, wasmContext: TSciChart | TSciChart3D): Float32Array; /** * Creates a Uint32Array view directly onto the WebAssembly memory backing the vector. * * @remarks * **IMPORTANT**: This function returns a view onto the underlying WebAssembly memory, NOT a copy. * * The returned Uint32Array: * - Shares memory with the WebAssembly vector - changes to the underlying data will be reflected in the view * - May be written through only if you own the vector - see {@link copyToVectorF64} * - Becomes invalid if the vector is deleted or resized * - Has zero-copy performance characteristics, making it very efficient for reading large datasets * * Use this function when you need: * - High-performance read access to vector data * - To avoid memory allocation overhead * - Temporary access to data that won't outlive the vector * * If you need to modify data or keep it beyond the vector's lifetime, use {@link vectorToArray} instead. * * @param vector - The WebAssembly vector to create a view for (UIntVector2D) * @param wasmContext - The WebAssembly context (TSciChart) that owns the vector * @returns A Uint32Array view onto the WebAssembly memory */ export declare function vectorToArrayViewUi32(vector: UIntVector2D | SCRTUintVector2D | SCRTUintVector3D, wasmContext: TSciChart | TSciChart3D): Uint32Array; /** * Creates a Int32Array view directly onto the WebAssembly memory backing the vector. * * @remarks * **IMPORTANT**: This function returns a view onto the underlying WebAssembly memory, NOT a copy. * * The returned Int32Array: * - Shares memory with the WebAssembly vector - changes to the underlying data will be reflected in the view * - May be written through only if you own the vector - see {@link copyToVectorF64} * - Becomes invalid if the vector is deleted or resized * - Has zero-copy performance characteristics, making it very efficient for reading large datasets * * Use this function when you need: * - High-performance read access to vector data * - To avoid memory allocation overhead * - Temporary access to data that won't outlive the vector * * If you need to modify data or keep it beyond the vector's lifetime, use {@link vectorToArray} instead. * * @param vector - The WebAssembly vector to create a view for (IntVector2D or SCRTIntVector) * @param wasmContext - The WebAssembly context (TSciChart) that owns the vector * @returns A Int32Array view onto the WebAssembly memory * @remarks Accepts BOTH Int32 vector types on purpose. They are unrelated classes with the same * two members this needs (`dataPtr`, `size`): `IntVector` is embind's std::vector, while * `SCRTIntVector` is the hand-written SCRT*Vector-family class that backs string-column codes. */ export declare function vectorToArrayViewI32(vector: IntVector2D | SCRTIntVector, wasmContext: TSciChart): Int32Array; /** * The same view as {@link vectorToArrayViewF64}, named for call sites that WRITE into it. * * @remarks * Identical at runtime. Own the vector, size it before taking the view, and let nothing allocate until the * last write - sizing another vector counts, so size every vector first, then take every view. * * @param vector The vector to write into, already sized * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector * @returns A Float64Array view onto the WebAssembly memory, to be written through */ export declare function vectorToWritableArrayViewF64(vector: SCRTDoubleVector2D | SCRTDoubleVector3D, wasmContext: TSciChart | TSciChart3D): Float64Array; /** * Returns the same Float32Array view as {@link vectorToArrayViewF32}, for code that WRITES into it. * @remarks See {@link vectorToWritableArrayViewF64} for what the caller owes. * @param vector The vector to write into, already sized * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector * @returns A Float32Array view onto the WebAssembly memory, to be written through */ export declare function vectorToWritableArrayViewF32(vector: FloatVector2D | SCRTFloatVector3D, wasmContext: TSciChart | TSciChart3D): Float32Array; /** * Returns the same Uint32Array view as {@link vectorToArrayViewUi32}, for code that WRITES into it. * @remarks See {@link vectorToWritableArrayViewF64} for what the caller owes. * @param vector The vector to write into, already sized * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector * @returns A Uint32Array view onto the WebAssembly memory, to be written through */ export declare function vectorToWritableArrayViewUi32(vector: UIntVector2D | SCRTUintVector2D | SCRTUintVector3D, wasmContext: TSciChart | TSciChart3D): Uint32Array; /** * Returns the same Int32Array view as {@link vectorToArrayViewI32}, for code that WRITES into it. * @remarks See {@link vectorToWritableArrayViewF64} for what the caller owes. * @param vector The vector to write into, already sized * @param wasmContext The WebAssembly context (TSciChart) that owns the vector * @returns A Int32Array view onto the WebAssembly memory, to be written through */ export declare function vectorToWritableArrayViewI32(vector: IntVector2D | SCRTIntVector, wasmContext: TSciChart): Int32Array; /** * Copies `values` into the WebAssembly memory backing a Float64 vector as a single memcpy. * * @remarks * Only for a vector you own. Writing to a {@link BaseDataSeries}' native vector bypasses its change count, * `dataChanged` event and distribution flags, leaving autorange, resampling and hit-testing on stale state * with no redraw - use the data series' own append/update methods instead. * * For values computed in a loop there is nothing to bulk copy: size the vector, then write through * {@link vectorToWritableArrayViewF64}. Take views only after the last allocation - growing the heap * detaches them. * * @param vector The vector to fill. Resized to `values.length` first, unless it is already that size * @param values The values to copy in * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector */ export declare function copyToVectorF64(vector: SCRTDoubleVector2D | SCRTDoubleVector3D, values: ArrayLike, wasmContext: TSciChart | TSciChart3D): void; /** * Copies `values` into the WebAssembly memory backing a Float32 vector as a single memcpy. * @remarks Only for a vector you own - see {@link copyToVectorF64} for the rule and why it matters. * @param vector The vector to fill. Resized to `values.length` first, unless it is already that size * @param values The values to copy in * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector */ export declare function copyToVectorF32(vector: FloatVector2D | SCRTFloatVector3D, values: ArrayLike, wasmContext: TSciChart | TSciChart3D): void; /** * Copies `values` into the WebAssembly memory backing a Uint32 vector as a single memcpy. * @remarks Only for a vector you own - see {@link copyToVectorF64} for the rule and why it matters. * @param vector The vector to fill. Resized to `values.length` first, unless it is already that size * @param values The values to copy in * @param wasmContext The WebAssembly context (TSciChart or TSciChart3D) that owns the vector */ export declare function copyToVectorUi32(vector: UIntVector2D | SCRTUintVector2D | SCRTUintVector3D, values: ArrayLike, wasmContext: TSciChart | TSciChart3D): void; /** * Copies `values` into the WebAssembly memory backing an Int32 vector as a single memcpy. * @remarks Only for a vector you own - see {@link copyToVectorF64} for the rule and why it matters. * @param vector The vector to fill. Resized to `values.length` first, unless it is already that size * @param values The values to copy in * @param wasmContext The WebAssembly context (TSciChart) that owns the vector */ export declare function copyToVectorI32(vector: IntVector2D | SCRTIntVector, values: ArrayLike, wasmContext: TSciChart): void;