Serializer implementation for buffer. More...
#include <buffer_serializer.hpp>
Public Member Functions | |
buffer_serializer (cbdc::buffer &pkt) | |
Constructor. | |
operator bool () const final | |
Indicates whether the last serialization operation succeeded. | |
void | advance_cursor (size_t len) final |
Moves the cursor forward by the given number of bytes. | |
void | reset () final |
Resets the cursor to the start of the buffer. | |
auto | end_of_buffer () const -> bool final |
Indicates whether the cursor is at or beyond the end of the buffer. | |
auto | write (const void *data, size_t len) -> bool final |
Write the given bytes into the buffer from the current cursor position. | |
auto | read (void *data, size_t len) -> bool final |
Read the given number of bytes from the buffer from the current cursor position into the given memory location. | |
![]() | |
virtual | ~serializer ()=default |
serializer (const serializer &)=delete | |
auto | operator= (const serializer &)=delete |
serializer (serializer &&)=delete | |
auto | operator= (serializer &&)=delete |
Additional Inherited Members | |
![]() | |
serializer ()=default | |
Serializer implementation for buffer.
Definition at line 14 of file buffer_serializer.hpp.
|
explicit |
Constructor.
pkt | buffer to serialize into or out of. |
Definition at line 11 of file buffer_serializer.cpp.
|
finalvirtual |
Moves the cursor forward by the given number of bytes.
len | number of bytes by which to move the cursor forward. |
Implements cbdc::serializer.
Definition at line 17 of file buffer_serializer.cpp.
|
nodiscardfinalvirtual |
Indicates whether the cursor is at or beyond the end of the buffer.
Implements cbdc::serializer.
Definition at line 26 of file buffer_serializer.cpp.
References cbdc::buffer::size().
|
explicitfinalvirtual |
Indicates whether the last serialization operation succeeded.
Implements cbdc::serializer.
Definition at line 13 of file buffer_serializer.cpp.
|
finalvirtual |
Read the given number of bytes from the buffer from the current cursor position into the given memory location.
data | pointer to the destination of the read data. |
len | number of bytes to read from the buffer. |
Implements cbdc::serializer.
Definition at line 39 of file buffer_serializer.cpp.
|
finalvirtual |
Resets the cursor to the start of the buffer.
Implements cbdc::serializer.
Definition at line 21 of file buffer_serializer.cpp.
|
finalvirtual |
Write the given bytes into the buffer from the current cursor position.
If the data extends beyond the end of the buffer, expands the buffer size to fit the new data.
data | pointer to the start of the bytes to write. |
len | number of bytes to write. |
Implements cbdc::serializer.
Definition at line 30 of file buffer_serializer.cpp.