import { Message } from "../process/Types"; import { BitStream } from "../serialization/BitStream"; import { MessageBitConfig } from "../serialization/MessageSerialization"; /** * Acts just like an array, but it serializes the messages to a BitStream to improve memory usage and performance. * * It needs a `MessageBitConfig` to know the bit configuration of the messages. */ export declare class MessagesArray implements Iterable { readonly bitConfig: MessageBitConfig; /** The stream where messages are written of read from */ stream: BitStream; /** * The number of messages in the array. * We have to store this value separately, since otherwise we would have to iterate over all the messages to get the length. */ length: number; /** * The offset where the messages start in the stream. * This is the offset that was initially in the stream when the array was created. */ private readonly startOffset; /** * Creates an array. You can provide an existing stream. * * @param count the number of messages in the stream */ constructor(bitConfig: MessageBitConfig, stream?: BitStream, count?: number); /** Adds a message at the end */ push(item: Message): void; /** * Iterates over all messages in the array. * * ⚠️ You can't call this method and push messages at the same time, since we are changing the stream offset. */ [Symbol.iterator](): Generator; /** @returns the number of bytes occupied by the messages */ get byteLength(): number; }