// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.ClearScript.JavaScript
{
///
/// Defines properties and methods common to all JavaScript
/// typed arrays.
///
public interface ITypedArray : IArrayBufferView
{
///
/// Gets the typed array's length.
///
ulong Length { get; }
}
///
/// Represents a JavaScript typed array.
///
/// The typed array's element type.
///
///
/// The following table lists the specific interfaces implemented by JavaScript typed arrays:
///
///
///
///
/// Typed Array
/// Interface(s) (C#)
///
/// -
/// Uint8Array
/// ITypedArray<byte>
///
/// -
/// Uint8ClampedArray
/// ITypedArray<byte>
///
/// -
/// Int8Array
/// ITypedArray<sbyte>
///
/// -
/// Uint16Array
/// ITypedArray<ushort> and ITypedArray<char>
///
/// -
/// Int16Array
/// ITypedArray<short>
///
/// -
/// Uint32Array
/// ITypedArray<uint>
///
/// -
/// Int32Array
/// ITypedArray<int>
///
/// -
/// Float32Array
/// ITypedArray<float>
///
/// -
/// Float64Array
/// ITypedArray<double>
///
///
///
///
public interface ITypedArray : ITypedArray
{
///
/// Creates an array containing a copy of the typed array's contents.
///
/// A new array containing a copy of the typed array's contents.
T[] ToArray();
///
/// Copies elements from the typed array into the specified array.
///
/// The index within the typed array of the first element to copy.
/// The maximum number of elements to copy.
/// The array into which to copy the elements.
/// The index within at which to store the first copied element.
/// The number of elements copied.
ulong Read(ulong index, ulong length, T[] destination, ulong destinationIndex);
///
/// Copies elements from the specified array into the typed array.
///
/// The array from which to copy the elements.
/// The index within of the first element to copy.
/// The maximum number of elements to copy.
/// The index within the typed array at which to store the first copied element.
/// The number of elements copied.
ulong Write(T[] source, ulong sourceIndex, ulong length, ulong index);
}
}