Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::MemoryWriter Class Reference

#include <kanzi/core/util/memory_writer.hpp>

Public Member Functions

void alignToOffset (ptrdiff_t alignBytes)
 Skip to next alignment of given bytes, relative to the beginning of the parsed data. More...
 
void copy (ConstByteSpan source)
 Write the data to the current position in the memory buffer. More...
 
size_t getCapacity () const
 Gets the current capacity of the memory buffer. More...
 
size_t getSize () const
 Gets the current size of the written memory. More...
 
 MemoryWriter (ByteSpan memory)
 Constructor. More...
 
void skip (size_t sizeBytes)
 Skip bytes from current location in the memory buffer. More...
 
void write (uint64_t value)
 Write a 64-bit unsigned integer value to the current position in the memory buffer. More...
 
void write (int64_t value)
 Write a 8-bit integer value to the current position in the memory buffer. More...
 
void write (uint32_t value)
 Write a 32-bit unsigned integer value to the current position in the memory buffer. More...
 
void write (int32_t value)
 Write a 32-bit integer value to the current position in the memory buffer. More...
 
void write (uint16_t value)
 Write a 16-bit unsigned integer value to the current position in the memory buffer. More...
 
void write (int16_t value)
 Write a 16-bit integer value to the current position in the memory buffer. More...
 
void write (uint8_t value)
 Write a 8-bit unsigned integer value to the current position in the memory buffer. More...
 
void write (int8_t value)
 Write a 8-bit integer value to the current position in the memory buffer. More...
 
void write (float value)
 Write a 32-bit floating point value to the current position in the memory buffer. More...
 

Constructor & Destructor Documentation

kanzi::MemoryWriter::MemoryWriter ( ByteSpan  memory)
inlineexplicit

Constructor.

Parameters
memorySpan representing the location of the writable memory buffer.

Member Function Documentation

void kanzi::MemoryWriter::write ( uint64_t  value)
inline

Write a 64-bit unsigned integer value to the current position in the memory buffer.

Parameters
valueA 64-bit unsigned integer value.
void kanzi::MemoryWriter::write ( int64_t  value)
inline

Write a 8-bit integer value to the current position in the memory buffer.

Parameters
valueA 8-bit integer value.
void kanzi::MemoryWriter::write ( uint32_t  value)
inline

Write a 32-bit unsigned integer value to the current position in the memory buffer.

Parameters
valueA 32-bit unsigned integer value.
void kanzi::MemoryWriter::write ( int32_t  value)
inline

Write a 32-bit integer value to the current position in the memory buffer.

Parameters
valueA 32-bit integer value.
void kanzi::MemoryWriter::write ( uint16_t  value)
inline

Write a 16-bit unsigned integer value to the current position in the memory buffer.

Parameters
valueA 16-bit unsigned integer value.
void kanzi::MemoryWriter::write ( int16_t  value)
inline

Write a 16-bit integer value to the current position in the memory buffer.

Parameters
valueA 16-bit integer value.
void kanzi::MemoryWriter::write ( uint8_t  value)
inline

Write a 8-bit unsigned integer value to the current position in the memory buffer.

Parameters
valueA 8-bit unsigned integer value.
void kanzi::MemoryWriter::write ( int8_t  value)
inline

Write a 8-bit integer value to the current position in the memory buffer.

Parameters
valueA 8-bit integer value.
void kanzi::MemoryWriter::write ( float  value)
inline

Write a 32-bit floating point value to the current position in the memory buffer.

Parameters
valueA 32-bit floating point value.
void kanzi::MemoryWriter::copy ( ConstByteSpan  source)
inline

Write the data to the current position in the memory buffer.

Parameters
sourceA memory buffer
void kanzi::MemoryWriter::alignToOffset ( ptrdiff_t  alignBytes)
inline

Skip to next alignment of given bytes, relative to the beginning of the parsed data.

If alignment is already correct, the position is not moved.

Parameters
alignBytesAlignment to skip to.
void kanzi::MemoryWriter::skip ( size_t  sizeBytes)
inline

Skip bytes from current location in the memory buffer.

Parameters
sizeBytesBytes to skip.
size_t kanzi::MemoryWriter::getSize ( ) const
inline

Gets the current size of the written memory.

Returns
Size in bytes
size_t kanzi::MemoryWriter::getCapacity ( ) const
inline

Gets the current capacity of the memory buffer.

Returns
Capacity in bytes

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