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

serializeable byte buffer with efficient serialization. More...

#include <ByteBuffer.h>

Public Member Functions

AZStd::size_t GetSize () const
 
bool Resize (AZStd::size_t newSize)
 
const uint8_t * GetBuffer () const
 
uint8_t * GetBuffer ()
 
const uint8_t * GetBufferEnd () const
 
uint8_t * GetBufferEnd ()
 
bool CopyValues (const uint8_t *buffer, AZStd::size_t bufferSize)
 
bool IsSame (const uint8_t *buffer, AZStd::size_t bufferSize) const
 
bool operator== (const ByteBuffer &rhs) const
 
bool operator!= (const ByteBuffer &rhs) const
 
bool Serialize (ISerializer &serializer)
 

Static Public Member Functions

static constexpr AZStd::size_t GetCapacity ()
 

Detailed Description

template<AZStd::size_t SIZE>
class AzNetworking::ByteBuffer< SIZE >

serializeable byte buffer with efficient serialization.

Member Function Documentation

◆ CopyValues()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::CopyValues ( const uint8_t *  buffer,
AZStd::size_t  bufferSize 
)
inline

Overwrites the data in this ByteBuffer with the data in the provided buffer.

Parameters
bufferpointer to the buffer data to copy
bufferSizethe number of bytes in the buffer to copy
Returns
boolean true on success, false for failure

◆ GetBuffer() [1/2]

template<AZStd::size_t SIZE>
uint8_t * AzNetworking::ByteBuffer< SIZE >::GetBuffer
inline

Non-const raw buffer access.

Returns
non-const pointer to the array's internal memory buffer

◆ GetBuffer() [2/2]

template<AZStd::size_t SIZE>
const uint8_t * AzNetworking::ByteBuffer< SIZE >::GetBuffer
inline

Const raw buffer access.

Returns
const pointer to the array's internal memory buffer

◆ GetBufferEnd() [1/2]

template<AZStd::size_t SIZE>
uint8_t * AzNetworking::ByteBuffer< SIZE >::GetBufferEnd
inline

Raw end-of-buffer access.

Returns
non-const pointer to the first unused byte in the array's internal memory buffer

◆ GetBufferEnd() [2/2]

template<AZStd::size_t SIZE>
const uint8_t * AzNetworking::ByteBuffer< SIZE >::GetBufferEnd
inline

Const raw end-of-buffer access.

Returns
const pointer to the first unused byte in the array's internal memory buffer

◆ GetCapacity()

template<AZStd::size_t SIZE>
constexpr AZStd::size_t AzNetworking::ByteBuffer< SIZE >::GetCapacity
inlinestaticconstexpr

Returns the maximum number of elements this vector can reserve for use.

Returns
the maximum number of elements this vector can reserve for use

◆ GetSize()

template<AZStd::size_t SIZE>
AZStd::size_t AzNetworking::ByteBuffer< SIZE >::GetSize
inline

Returns the number of elements reserved for usage in this vector.

Returns
the number of elements reserved for usage in this vector

◆ IsSame()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::IsSame ( const uint8_t *  buffer,
AZStd::size_t  bufferSize 
) const

Tests for equality to a raw byte buffer.

Parameters
bufferpointer to the buffer data to copy
bufferSizethe number of bytes in the buffer to copy
Returns
boolean true if rhs and buffer are identical, false otherwise

◆ operator!=()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::operator!= ( const ByteBuffer< SIZE > &  rhs) const
inline

Inequality operator.

Parameters
rhsthe byte buffer to compare against
Returns
boolean true if rhs and lhs are not identical, false otherwise

◆ operator==()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::operator== ( const ByteBuffer< SIZE > &  rhs) const
inline

Equality operator.

Parameters
rhsthe byte buffer to compare against
Returns
boolean true if rhs and lhs are identical, false otherwise

◆ Resize()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::Resize ( AZStd::size_t  newSize)
inline

Resizes the vector to the requested number of elements, does not initialize new elements.

Parameters
newSizethe number of elements to size the vector to
Returns
boolean true on success

◆ Serialize()

template<AZStd::size_t SIZE>
bool AzNetworking::ByteBuffer< SIZE >::Serialize ( ISerializer serializer)
inline

Base serialize method for all serializable structures or classes to implement.

Parameters
serializerISerializer instance to use for serialization
Returns
boolean true for success, false for serialization failure

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