Open 3D Engine AzNetworking API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::HashSerializer Class Reference

Generate a 32bit integer hash for a serializable object. NOTE: This hash is not designed to be cryptographically secure. More...

#include <HashSerializer.h>

Inherits AzNetworking::ISerializer.

Public Member Functions

AZ::HashValue32 GetHash () const
 
SerializerMode GetSerializerMode () const override
 
bool Serialize (bool &value, const char *name) 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 (long &value, const char *name, long minValue, long maxValue) override
 
bool Serialize (AZ::s64 &value, const char *name, AZ::s64 minValue, AZ::s64 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 (unsigned long &value, const char *name, unsigned long minValue, unsigned long maxValue) override
 
bool Serialize (AZ::u64 &value, const char *name, AZ::u64 minValue, AZ::u64 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) override
 
bool EndObject (const char *name) 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.
 
bool Serialize (char &value, const char *name, uint8_t minValue=AZStd::numeric_limits< uint8_t >::min(), uint8_t maxValue=AZStd::numeric_limits< uint8_t >::max())
 
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

Generate a 32bit integer hash for a serializable object. NOTE: This hash is not designed to be cryptographically secure.

Member Function Documentation

◆ BeginObject()

bool AzNetworking::HashSerializer::BeginObject ( const char *  name)
overridevirtual

Begins serializing an object.

Parameters
namestring name of the object
Returns
boolean true on success, false for failure

Implements AzNetworking::ISerializer.

◆ ClearTrackedChangesFlag()

void AzNetworking::HashSerializer::ClearTrackedChangesFlag ( )
inlineoverridevirtual

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

Implements AzNetworking::ISerializer.

◆ EndObject()

bool AzNetworking::HashSerializer::EndObject ( const char *  name)
overridevirtual

Ends serializing an object.

Parameters
namestring name of the object
Returns
boolean true on success, false for failure

Implements AzNetworking::ISerializer.

◆ GetBuffer()

const uint8_t* AzNetworking::HashSerializer::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::HashSerializer::GetCapacity ( ) const
overridevirtual

Returns the total capacity serialization buffer in bytes.

Returns
total capacity serialization buffer in bytes

Implements AzNetworking::ISerializer.

◆ GetSerializerMode()

SerializerMode AzNetworking::HashSerializer::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::HashSerializer::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::HashSerializer::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/13]

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

Serialize a signed 64-bit integer (long long).

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() [2/13]

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

Serialize an unsigned 64-bit integer (unsigned long long).

Parameters
valueunsigned 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() [3/13]

bool AzNetworking::HashSerializer::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() [4/13]

bool AzNetworking::HashSerializer::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() [5/13]

bool AzNetworking::HashSerializer::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() [6/13]

bool AzNetworking::HashSerializer::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() [7/13]

bool AzNetworking::HashSerializer::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() [8/13]

bool AzNetworking::HashSerializer::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/13]

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

Serialize a signed long integer.

Parameters
valuesigned long 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() [10/13]

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

Serialize an unsigned short.

Parameters
valueunsigned 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() [11/13]

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

Serialize an unsigned integer.

Parameters
valueunsigned 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/13]

bool AzNetworking::HashSerializer::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.

◆ Serialize() [13/13]

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

Serialize an unsigned long integer.

Parameters
valueunsigned long 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.

◆ SerializeBytes()

bool AzNetworking::HashSerializer::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 file: