Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ser::detail::ser_buffer_binary_impl< DataContainer > Class Template Reference

Public Member Functions

void reset ()
 
GAIA_NODISCARD uint32_t bytes () const
 Returns the number of bytes written in the buffer.
 
GAIA_NODISCARD bool empty () const
 Returns true if there is no data written in the buffer.
 
GAIA_NODISCARD const auto * data () const
 Returns the pointer to the data in the buffer.
 
void reserve (uint32_t size)
 Makes sure there is enough capacity in our data container to hold another size bytes of data.
 
void resize (uint32_t size)
 Resizes the internal buffer to size bytes.
 
void seek (uint32_t pos)
 Changes the current position in the buffer.
 
void skip (uint32_t size)
 Advances size bytes from the current buffer position.
 
GAIA_NODISCARD uint32_t tell () const
 Returns the current position in the buffer.
 
template<typename T >
void save (T &&value)
 Writes value to the buffer.
 
void save_raw (const void *pSrc, uint32_t size, ser::serialization_type_id id)
 Writes size bytes of data starting at the address pSrc to the buffer.
 
template<typename T >
void load (T &value)
 Loads value from the buffer.
 
void load_raw (void *pDst, uint32_t size, ser::serialization_type_id id)
 Loads size bytes of data from the buffer and writes it to the address pDst.
 

Protected Attributes

DataContainer m_data
 Buffer holding raw data.
 
uint32_t m_dataPos = 0
 Current position in the buffer.
 

Static Protected Attributes

static constexpr uint32_t CapacityIncreaseSize = SerializationBufferCapacityIncreaseSize
 

Member Function Documentation

◆ load()

template<typename DataContainer >
template<typename T >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::load ( T &  value)
inline

Loads value from the buffer.

Parameters
[out]valueValue to load

◆ load_raw()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::load_raw ( void *  pDst,
uint32_t  size,
ser::serialization_type_id  id 
)
inline

Loads size bytes of data from the buffer and writes it to the address pDst.

Parameters
[out]pDstPointer to where deserialized data is written
sizeSize of serialized data in bytes
idType of serialized data

◆ reserve()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::reserve ( uint32_t  size)
inline

Makes sure there is enough capacity in our data container to hold another size bytes of data.

Parameters
sizeMinimum number of free bytes at the end of the buffer.

◆ resize()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::resize ( uint32_t  size)
inline

Resizes the internal buffer to size bytes.

Parameters
sizePosition in the buffer to move to.

◆ save()

template<typename DataContainer >
template<typename T >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::save ( T &&  value)
inline

Writes value to the buffer.

Parameters
valueValue to store

◆ save_raw()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::save_raw ( const void *  pSrc,
uint32_t  size,
ser::serialization_type_id  id 
)
inline

Writes size bytes of data starting at the address pSrc to the buffer.

Parameters
pSrcPointer to serialized data
sizeSize of serialized data in bytes
idType of serialized data

◆ seek()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::seek ( uint32_t  pos)
inline

Changes the current position in the buffer.

Parameters
posPosition in the buffer to move to.

◆ skip()

template<typename DataContainer >
void gaia::ser::detail::ser_buffer_binary_impl< DataContainer >::skip ( uint32_t  size)
inline

Advances size bytes from the current buffer position.

Parameters
sizeNumber of bytes to skip

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