Open 3D Engine AzNetworking API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Member Functions | List of all members
AzNetworking::NetworkInputSerializer Class Referencefinal

Input serializer for writing an object model into a bytestream. More...

#include <NetworkInputSerializer.h>

Inherits AzNetworking::ISerializer.

Public Member Functions

 NetworkInputSerializer (uint8_t *buffer, uint32_t bufferCapacity)
 
bool CopyToBuffer (const uint8_t *data, uint32_t dataSize)
 
SerializerMode GetSerializerMode () const override
 
bool Serialize (bool &value, const char *name) override
 
bool Serialize (char &value, const char *name, char minValue, char maxValue) override
 
bool Serialize (int8_t &value, const char *name, int8_t minValue, int8_t maxValue) override
 
bool Serialize (int16_t &value, const char *name, int16_t minValue, int16_t maxValue) override
 
bool Serialize (int32_t &value, const char *name, int32_t minValue, int32_t maxValue) override
 
bool Serialize (int64_t &value, const char *name, int64_t minValue, int64_t maxValue) override
 
bool Serialize (uint8_t &value, const char *name, uint8_t minValue, uint8_t maxValue) override
 
bool Serialize (uint16_t &value, const char *name, uint16_t minValue, uint16_t maxValue) override
 
bool Serialize (uint32_t &value, const char *name, uint32_t minValue, uint32_t maxValue) override
 
bool Serialize (uint64_t &value, const char *name, uint64_t minValue, uint64_t maxValue) override
 
bool Serialize (float &value, const char *name, float minValue, float maxValue) override
 
bool Serialize (double &value, const char *name, double minValue, double maxValue) override
 
bool SerializeBytes (uint8_t *buffer, uint32_t bufferCapacity, bool isString, uint32_t &outSize, const char *name) override
 
bool BeginObject (const char *name, const char *typeName) override
 
bool EndObject (const char *name, const char *typeName) override
 
const uint8_t * GetBuffer () const override
 
uint32_t GetCapacity () const override
 
uint32_t GetSize () const override
 
void ClearTrackedChangesFlag () override
 
bool GetTrackedChangesFlag () const override
 
- Public Member Functions inherited from AzNetworking::ISerializer
virtual bool IsValid () const
 
void Invalidate ()
 Mark the serializer as invalid.
 
template<typename TYPE >
bool Serialize (TYPE &value, const char *name)
 

Additional Inherited Members

- Protected Attributes inherited from AzNetworking::ISerializer
bool m_serializerValid = true
 

Detailed Description

Input serializer for writing an object model into a bytestream.

Constructor & Destructor Documentation

◆ NetworkInputSerializer()

AzNetworking::NetworkInputSerializer::NetworkInputSerializer ( uint8_t *  buffer,
uint32_t  bufferCapacity 
)

Constructor.

Parameters
bufferinput buffer to write to
bufferCapacitycapacity of the buffer in bytes

Member Function Documentation

◆ BeginObject()

bool AzNetworking::NetworkInputSerializer::BeginObject ( const char *  name,
const char *  typeName 
)
overridevirtual

Begins serializing an object.

Parameters
namestring name of the object
typeInfobasic type information for the value being serialized
Returns
Result. In the case of Skip, Serialize is not called.

Implements AzNetworking::ISerializer.

◆ ClearTrackedChangesFlag()

void AzNetworking::NetworkInputSerializer::ClearTrackedChangesFlag ( )
inlineoverridevirtual

This is a helper for network serialization. It clears the track changes flag internal to some serializers

Implements AzNetworking::ISerializer.

◆ CopyToBuffer()

bool AzNetworking::NetworkInputSerializer::CopyToBuffer ( const uint8_t *  data,
uint32_t  dataSize 
)
inline

Copies the provided bytes into the serialization output buffer.

Parameters
datapointer to the data buffer to copy
dataSizesize of the data in bytes
Returns
boolean true on success, false if there was insufficient space to store all the data

◆ EndObject()

bool AzNetworking::NetworkInputSerializer::EndObject ( const char *  name,
const char *  typeName 
)
overridevirtual

Ends serializing an object.

Parameters
namestring name of the object
typeInfobasic type information for the value being serialized
Returns
boolean true for success, false for serialization failure

Implements AzNetworking::ISerializer.

◆ GetBuffer()

const uint8_t* AzNetworking::NetworkInputSerializer::GetBuffer ( ) const
overridevirtual

Returns a pointer to the internal serialization buffer.

Returns
pointer to the internal serialization buffer

Implements AzNetworking::ISerializer.

◆ GetCapacity()

uint32_t AzNetworking::NetworkInputSerializer::GetCapacity ( ) const
overridevirtual

Returns the total capacity serialization buffer in bytes.

Returns
total capacity serialization buffer in bytes

Implements AzNetworking::ISerializer.

◆ GetSerializerMode()

SerializerMode AzNetworking::NetworkInputSerializer::GetSerializerMode ( ) const
overridevirtual

Returns an enum the represents the serializer mode. returns WriteToObject if the serializer is writing values to the objects it visits, otherwise returns ReadFromObject

Returns
boolean true if the serializer is writing to objects that it visits

Implements AzNetworking::ISerializer.

◆ GetSize()

uint32_t AzNetworking::NetworkInputSerializer::GetSize ( ) const
overridevirtual

Returns the size of the data contained in the serialization buffer in bytes.

Returns
size of the data contained in the serialization buffer in bytes

Implements AzNetworking::ISerializer.

◆ GetTrackedChangesFlag()

bool AzNetworking::NetworkInputSerializer::GetTrackedChangesFlag ( ) const
inlineoverridevirtual

This is a helper for network serialization. It allows the owner of the serializer to query whether or not the serializer modified the state of an object during serialization

Returns
boolean true if the track changes flag is raised

Implements AzNetworking::ISerializer.

◆ Serialize() [1/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( bool &  value,
const char *  name 
)
overridevirtual

Serialize a boolean.

Parameters
valueboolean input value to serialize
namestring name of the value being serialized
Returns
boolean true for success, false for serialization failure

Implements AzNetworking::ISerializer.

◆ Serialize() [2/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( char &  value,
const char *  name,
char  minValue,
char  maxValue 
)
overridevirtual

Serialize a character.

Parameters
valuecharacter input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [3/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( double &  value,
const char *  name,
double  minValue,
double  maxValue 
)
overridevirtual

Serialize a 64-bit floating point number.

Parameters
value64-bit floating point input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [4/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( float &  value,
const char *  name,
float  minValue,
float  maxValue 
)
overridevirtual

Serialize a 32-bit floating point number.

Parameters
value32-bit floating point input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [5/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( int16_t &  value,
const char *  name,
int16_t  minValue,
int16_t  maxValue 
)
overridevirtual

Serialize a signed short.

Parameters
valuesigned short input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [6/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( int32_t &  value,
const char *  name,
int32_t  minValue,
int32_t  maxValue 
)
overridevirtual

Serialize a signed integer.

Parameters
valuesigned integer input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [7/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( int64_t &  value,
const char *  name,
int64_t  minValue,
int64_t  maxValue 
)
overridevirtual

Serialize a signed 64-bit integer.

Parameters
valuesigned 64-bit integer input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [8/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( int8_t &  value,
const char *  name,
int8_t  minValue,
int8_t  maxValue 
)
overridevirtual

Serialize a signed byte.

Parameters
valuesigned byte input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [9/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( uint16_t &  value,
const char *  name,
uint16_t  minValue,
uint16_t  maxValue 
)
overridevirtual

Serialize an unsigned short.

Parameters
valuesigned integer short value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [10/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( uint32_t &  value,
const char *  name,
uint32_t  minValue,
uint32_t  maxValue 
)
overridevirtual

Serialize an unsigned integer.

Parameters
valuesigned integer input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [11/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( uint64_t &  value,
const char *  name,
uint64_t  minValue,
uint64_t  maxValue 
)
overridevirtual

Serialize an unsigned 64-bit integer.

Parameters
valuesigned 64-bit integer input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ Serialize() [12/12]

bool AzNetworking::NetworkInputSerializer::Serialize ( uint8_t &  value,
const char *  name,
uint8_t  minValue,
uint8_t  maxValue 
)
overridevirtual

Serialize an unsigned byte.

Parameters
valueunsigned byte input value to serialize
namestring name of the value being serialized
minValuethe minimum value expected during serialization
maxValuethe maximum value expected during serialization
Returns
boolean true for success, false for failure

Implements AzNetworking::ISerializer.

◆ SerializeBytes()

bool AzNetworking::NetworkInputSerializer::SerializeBytes ( uint8_t *  buffer,
uint32_t  bufferCapacity,
bool  isString,
uint32_t &  outSize,
const char *  name 
)
overridevirtual

Serialize a raw set of bytes.

Parameters
bufferbuffer to serialize
bufferCapacitysize of the buffer
isStringtrue if the data being serialized is a string
outSizebytes serialized
namestring name of the object
Returns
boolean true for success, false for serialization failure

Implements AzNetworking::ISerializer.


The documentation for this class was generated from the following files: