Kanzi  3.9.5
Kanzi Engine 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)
 Wrtie 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

◆ MemoryWriter()

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

Constructor.

Parameters
memorySpan representing the location of the writable memory buffer.

Member Function Documentation

◆ write() [1/9]

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.

◆ write() [2/9]

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.

◆ write() [3/9]

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.

◆ write() [4/9]

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.

◆ write() [5/9]

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.

◆ write() [6/9]

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.

◆ write() [7/9]

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.

◆ write() [8/9]

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.

◆ write() [9/9]

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.

◆ copy()

void kanzi::MemoryWriter::copy ( ConstByteSpan  source)
inline

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

Parameters
sourceA memory buffer

◆ alignToOffset()

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.

◆ skip()

void kanzi::MemoryWriter::skip ( size_t  sizeBytes)
inline

Skip bytes from current location in the memory buffer.

Parameters
sizeBytesBytes to skip.

◆ getSize()

size_t kanzi::MemoryWriter::getSize ( ) const
inline

Gets the current size of the written memory.

Returns
Size in bytes

◆ getCapacity()

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: