utility::binary namespace

contains various utilities in helping you to convert to, and from a byte stream.

functions

write_8b<…>
writes in sets of 8 bytes to the target location
public
write_4b<…>
writes in sets of 4 bytes to the target location
public
write_2b<…>
writes in sets of 2 bytes to the target location
public
write_1b<…>
writes in sets of 1 byte to the target location
public

Function documentation

template<typename T>
void utility::binary::write_8b(T* target, std::vector<uint8_t>& buffer, size_t offset, size_t size = 1)

Brief

writes in sets of 8 bytes to the target location

Parameters
target in/out the location to write to.
buffer in the source of the data.
offset in offset in the source data (offset is in bytes).
size in multiplier to the size of to write (1 size is equivalent to 8 bytes).

template<typename T>
void utility::binary::write_4b(T* target, std::vector<uint8_t>& buffer, size_t offset, size_t size = 1)

Brief

writes in sets of 4 bytes to the target location

Parameters
target in/out the location to write to.
buffer in the source of the data.
offset in offset in the source data (offset is in bytes).
size in multiplier to the size of to write (1 size is equivalent to 4 bytes).

template<typename T>
void utility::binary::write_2b(T* target, std::vector<uint8_t>& buffer, size_t offset, size_t size = 1)

Brief

writes in sets of 2 bytes to the target location

Parameters
target in/out the location to write to.
buffer in the source of the data.
offset in offset in the source data (offset is in bytes).
size in multiplier to the size of to write (1 size is equivalent to 2 bytes).

template<typename T>
void utility::binary::write_1b(T* target, std::vector<uint8_t>& buffer, size_t offset, size_t size = 1)

Brief

writes in sets of 1 byte to the target location

Parameters
target in/out the location to write to.
buffer in the source of the data.
offset in offset in the source data (offset is in bytes).
size in multiplier to the size of to write (1 size is equivalent to 1 byte).