@foxglove/rosmsg2-serialization
Version:
ROS 2 message serialization, for reading and writing bags and network messages
19 lines • 851 B
TypeScript
import { MessageDefinition } from "@foxglove/message-definition";
/**
* Takes a parsed message definition and returns a message writer which
* serializes JavaScript objects to CDR-encoded binary.
*/
export declare class MessageWriter {
#private;
constructor(definitions: MessageDefinition[]);
/** Calculates the byte size needed to write this message in bytes. */
calculateByteSize(message: unknown): number;
/**
* Serializes a JavaScript object to CDR-encoded binary according to this
* writer's message definition. If output is provided, it's byte length must
* be equal or greater to the result of `calculateByteSize(message)`. If not
* provided, a new Uint8Array will be allocated.
*/
writeMessage(message: unknown, output?: Uint8Array): Uint8Array;
}
//# sourceMappingURL=MessageWriter.d.ts.map