Table of Contents

Class Message

Namespace
NominalSystems.Messages
Assembly
NominalSystems.Messages.dll

[Nominal] Represents the base class for all simulation messages. These are groups of data that can be sent between components in the simulation.


public abstract class Message : Object
Inheritance
Message
Derived

Constructors

Message()

Default constructor

protected Message()

Methods

Deserialize(Message, JObject?)

Deserializes a JSON object into the message, which will set the properties of the message to the values of the JSON object.

public static void Deserialize(Message message, JObject? obj)

Parameters

message Message

The message to update the values of

obj JObject

The JSON object containing the message data

GetFieldNames(bool)

Gets all the fields from the string along with their units, formatted like 'Property [unit]'.

public List<string> GetFieldNames(bool units = true)

Parameters

units bool

A flag whether to use units

Returns

List<string>

An array of all properties with the format

GetFieldValues()

Gets all the fields values from the message as a string.

public List<string> GetFieldValues()

Returns

List<string>

An array of all fields with the format

GetObject(Message)

This will return the object from the message, which is in the raw form of the JSON object.

public static object? GetObject(Message message)

Parameters

message Message

The message to get the object from

Returns

object

The object reference

Serialize(Message?)

Serializes this message to a JSON object and returns the JObject from the message, if possible. This will not serialize the ID of the message.

public static JObject? Serialize(Message? message)

Parameters

message Message

The message to serialize

Returns

JObject

The JSON object from the message

SetObject(Message, object?)

This will set the object of the message to the object that is passed in. This will attempt to deserialize the object if it is a JObject.

public static void SetObject(Message message, object? obj)

Parameters

message Message

The message reference to update the data of

obj object

The object that contains the data that should be copied

ToJson()

Converts the current message to a JSON string complete with the data.

public string ToJson()

Returns

string

The JSON string

ToString()

public override string ToString()

Returns

string