Interface IMessageSerializer
Serializes IMessage data to a transport-specific binary format.
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public interface IMessageSerializer
Remarks
Implementations are called by generated WriteTo(IMessageSerializer) methods. The UseRos2Schema flag selects between ROS 1 and ROS 2 wire formats where the message structure differs between the two versions.
Properties
UseRos2Schema
Gets a value indicating whether messages should be serialized using the ROS 2 wire schema rather than the ROS 1 schema.
Declaration
bool UseRos2Schema { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
BeginMessage(string[])
Begins serialization of a new message, providing the ordered field name list.
Declaration
void BeginMessage(string[] fieldNames)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | fieldNames | The ordered names of the message fields. |
EndMessage()
Finalizes serialization of the current message.
Declaration
void EndMessage()
Write(bool)
Writes a single bool value.
Declaration
void Write(bool data)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | data | The value to write. |
Write(bool[])
Writes a variable-length array of bool values.
Declaration
void Write(bool[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| bool[] | data | The array to write. |
Write(bool[], int)
Writes a fixed-length array of bool values.
Declaration
void Write(bool[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| bool[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(byte)
Writes a single byte value.
Declaration
void Write(byte data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | data | The value to write. |
Write(byte[])
Writes a variable-length array of byte values.
Declaration
void Write(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The array to write. |
Write(byte[], int)
Writes a fixed-length array of byte values.
Declaration
void Write(byte[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(double)
Writes a single double value.
Declaration
void Write(double data)
Parameters
| Type | Name | Description |
|---|---|---|
| double | data | The value to write. |
Write(double[])
Writes a variable-length array of double values.
Declaration
void Write(double[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| double[] | data | The array to write. |
Write(double[], int)
Writes a fixed-length array of double values.
Declaration
void Write(double[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| double[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(short)
Writes a single short value.
Declaration
void Write(short data)
Parameters
| Type | Name | Description |
|---|---|---|
| short | data | The value to write. |
Write(short[])
Writes a variable-length array of short values.
Declaration
void Write(short[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| short[] | data | The array to write. |
Write(short[], int)
Writes a fixed-length array of short values.
Declaration
void Write(short[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| short[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(int)
Writes a single int value.
Declaration
void Write(int data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | data | The value to write. |
Write(int[])
Writes a variable-length array of int values.
Declaration
void Write(int[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | data | The array to write. |
Write(int[], int)
Writes a fixed-length array of int values.
Declaration
void Write(int[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(long)
Writes a single long value.
Declaration
void Write(long data)
Parameters
| Type | Name | Description |
|---|---|---|
| long | data | The value to write. |
Write(long[])
Writes a variable-length array of long values.
Declaration
void Write(long[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| long[] | data | The array to write. |
Write(long[], int)
Writes a fixed-length array of long values.
Declaration
void Write(long[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| long[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(sbyte)
Writes a single sbyte value.
Declaration
void Write(sbyte data)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte | data | The value to write. |
Write(sbyte[])
Writes a variable-length array of sbyte values.
Declaration
void Write(sbyte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte[] | data | The array to write. |
Write(sbyte[], int)
Writes a fixed-length array of sbyte values.
Declaration
void Write(sbyte[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(float)
Writes a single float value.
Declaration
void Write(float data)
Parameters
| Type | Name | Description |
|---|---|---|
| float | data | The value to write. |
Write(float[])
Writes a variable-length array of float values.
Declaration
void Write(float[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | data | The array to write. |
Write(float[], int)
Writes a fixed-length array of float values.
Declaration
void Write(float[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(string)
Writes a single string value.
Declaration
void Write(string data)
Parameters
| Type | Name | Description |
|---|---|---|
| string | data | The value to write. |
Write(string[])
Writes a variable-length array of string values.
Declaration
void Write(string[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | data | The array to write. |
Write(string[], int)
Writes a fixed-length array of string values.
Declaration
void Write(string[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(ushort)
Writes a single ushort value.
Declaration
void Write(ushort data)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | data | The value to write. |
Write(ushort[])
Writes a variable-length array of ushort values.
Declaration
void Write(ushort[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort[] | data | The array to write. |
Write(ushort[], int)
Writes a fixed-length array of ushort values.
Declaration
void Write(ushort[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(uint)
Writes a single uint value.
Declaration
void Write(uint data)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | data | The value to write. |
Write(uint[])
Writes a variable-length array of uint values.
Declaration
void Write(uint[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| uint[] | data | The array to write. |
Write(uint[], int)
Writes a fixed-length array of uint values.
Declaration
void Write(uint[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| uint[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write(ulong)
Writes a single ulong value.
Declaration
void Write(ulong data)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | data | The value to write. |
Write(ulong[])
Writes a variable-length array of ulong values.
Declaration
void Write(ulong[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong[] | data | The array to write. |
Write(ulong[], int)
Writes a fixed-length array of ulong values.
Declaration
void Write(ulong[] data, int fixedLength)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong[] | data | The array to write. |
| int | fixedLength | The expected fixed length of the array. |
Write<T>(T)
Writes a nested IMessage field.
Declaration
void Write<T>(T data) where T : IMessage
Parameters
| Type | Name | Description |
|---|---|---|
| T | data | The message field value. |
Type Parameters
| Name | Description |
|---|---|
| T | The message field type. |
Write<T>(T[])
Writes a variable-length array of nested IMessage values.
Declaration
void Write<T>(T[] data) where T : IMessage
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | The array of message values. |
Type Parameters
| Name | Description |
|---|---|
| T | The message element type. |
Write<T>(T[], int)
Writes a fixed-length array of nested IMessage values.
Declaration
void Write<T>(T[] data, int fixedLength) where T : IMessage
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | data | The array of message values. |
| int | fixedLength | The expected fixed length of the array. |
Type Parameters
| Name | Description |
|---|---|
| T | The message element type. |