Class IncomingMessage
Utility class for reading the data sent to the SideChannel.
Implements
Inherited Members
Namespace: Unity.MLAgents.SideChannels
Assembly: Unity.ML-Agents.dll
Syntax
public class IncomingMessage : IDisposable
Constructors
IncomingMessage(byte[])
Construct an IncomingMessage from the byte array.
Declaration
public IncomingMessage(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | Byte array |
Methods
Dispose()
Clean up the internal storage.
Declaration
public void Dispose()
GetRawBytes()
Gets the original data of the message. Note that this will return all of the data, even if part of it has already been read.
Declaration
public byte[] GetRawBytes()
Returns
Type | Description |
---|---|
byte[] | Original data of the message. |
ReadBoolean(bool)
Read a boolean value from the message.
Declaration
public bool ReadBoolean(bool defaultValue = false)
Parameters
Type | Name | Description |
---|---|---|
bool | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
bool | True if boolean was read by the reader, False if not. |
ReadFloat32(float)
Read a float value from the message.
Declaration
public float ReadFloat32(float defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
float | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
float | True if float32 was read by the reader, False if not. |
ReadFloatList(IList<float>)
Reads a list of floats from the message. The length of the list is stored in the message.
Declaration
public IList<float> ReadFloatList(IList<float> defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IList<float> | defaultValue | Default value to use if the end of the message is reached. |
Returns
ReadInt32(int)
Read an integer value from the message.
Declaration
public int ReadInt32(int defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
int | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
int | True if int32 was read by the reader, False if not. |
ReadString(string)
Read a string value from the message.
Declaration
public string ReadString(string defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
string | True if string was read by the reader, False if not. |