Class IEntityDeserialiser

Class Documentation

class IEntityDeserialiser

The deserialiser is used to take recieved signalr message data and turn it into values you can use to populate a SpaceEntity.

This works similarly to the serialiser and you can refer to the serialiser for more details. It is expected that you will be using the data as you read it to populate either a newly created or currently existing SpaceEntity.

Public Functions

virtual void EnterEntity() = 0

Starts the deserialisation.

virtual void LeaveEntity() = 0

Ends the deserialisation.

virtual bool ReadBool() = 0

Reads a boolean from the deserialiser.

Returns

The deserialised boolean.

virtual uint8_t ReadByte() = 0

Reads a byte from the deserialiser.

Returns

The deserialised byte.

virtual double ReadDouble() = 0

Reads a double from the deserialiser.

Returns

The deserialised double.

virtual int64_t ReadInt64() = 0

Reads an int64_t from the deserialiser.

Returns

The deserialised boolean.

virtual uint64_t ReadUInt64() = 0

Reads a uint64_t from the deserialiser.

Returns

The deserialised uint64_t.

virtual csp::common::String ReadString() = 0

Reads a string from the deserialiser.

Returns

The deserialised string.

virtual csp::common::Vector2 ReadVector2() = 0

Reads a vector2 from the deserialiser.

Returns

The deserialised vector2.

virtual csp::common::Vector3 ReadVector3() = 0

Reads a vector3 from the deserialiser.

Returns

The deserialised vector3.

virtual csp::common::Vector4 ReadVector4() = 0

Reads a vector4 from the deserialiser.

Returns

The deserialised vector4.

virtual bool NextValueIsNull() = 0

Checks if the next value is null.

Returns

True if the next value is null, false otherwise.

virtual bool NextValueIsArray() = 0

Checks if the next value is an array.

Returns

True if the next value is null, false otherwise.

virtual void EnterArray(uint32_t &OutLength) = 0

Puts the deserialiser into array processing mode to begin reading from an array.

Parameters

OutLength – uint32_t : A reference to variable to store the length of the array.

virtual void LeaveArray() = 0

Completes reading from and array and leaves the array processing mode.

virtual void EnterComponents() = 0

Puts the deserialiser into component processing mode to begin reading from the components section of the serialised entity.

virtual void LeaveComponents() = 0

Completes reading the components and exits that mode.

virtual uint64_t GetNumComponents() = 0

Gets the total number of components, including view components.

If iterating components by this count, subtract number of view components.

Returns

The number of components.

virtual uint64_t GetNumRealComponents() = 0

Gets the number of components that are not view components.

Returns

The number of non-view components.

virtual void EnterComponent(uint16_t &OutId, uint64_t &OutType) = 0

Begins the processes of deserialising a single component that is not a view component.

virtual void LeaveComponent() = 0

Completes the deserialisation of a single component.

virtual uint64_t GetNumProperties() = 0

Gets the number of properties in the component that is currently being deserialised.

Returns

The number of properties in the component.

virtual ReplicatedValue ReadProperty(uint64_t &OutId) = 0

Reads a property from the deserialiser, returning it as a ReplicatedValue.

Parameters

OutId – uint64_t : A reference to a variable to store the ID of the property.

Returns

The property value.

virtual ReplicatedValue GetViewComponent(uint16_t Id) = 0

Reads a view component from the deserialiser, returning it as a ReplicatedValue.

Since view components are handled differently in the serialiser, they are similarly deserialised in their own way.

Returns

The view component value.

virtual bool HasViewComponent(uint16_t Id) = 0

Gets whether there is a view component with the given ID.

Parameters

Id – uint64_t : The ID of the component.

Returns

True if there is a view component, false otherwise.

virtual void Skip() = 0

Skips a field when deserialising the SpaceEntity fields.

Protected Functions

virtual ~IEntityDeserialiser() = default