OpenCBDC Transaction Processor
|
Implements serializer for nuraft::buffer. More...
#include <serialization.hpp>
Public Member Functions | |
nuraft_serializer (nuraft::buffer &buf) | |
Constructor. | |
operator bool () const final | |
Bool operator for checking whether the last serialization operation completed successfully. | |
void | advance_cursor (size_t len) final |
Moves the cursor inside the buffer 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 |
Returns whether the cursor is currently at the end of the buffer. | |
auto | write (const void *data, size_t len) -> bool final |
Writes the given raw bytes to the buffer from the current position of the cursor. | |
auto | read (void *data, size_t len) -> bool final |
Reads the given number of bytes from the current cursor in the buffer into the given destination. | |
![]() | |
virtual | ~serializer ()=default |
serializer (const serializer &)=delete | |
auto | operator= (const serializer &)=delete |
serializer (serializer &&)=delete | |
auto | operator= (serializer &&)=delete |
Additional Inherited Members | |
![]() | |
serializer ()=default | |
Implements serializer for nuraft::buffer.
NuRaft buffers contain a cursor which this class manipulates directly.
Definition at line 17 of file util/raft/serialization.hpp.
|
explicit |
Constructor.
Resets the buffer's internal cursor.
buf | nuraft::buffer to serialize into and out of. |
Definition at line 13 of file util/raft/serialization.cpp.
References reset().
|
finalvirtual |
Moves the cursor inside the buffer forward by the given number of bytes.
Does not change the size of the buffer.
len | number of bytes by which to advance the cursor. |
Implements cbdc::serializer.
Definition at line 21 of file util/raft/serialization.cpp.
|
nodiscardfinalvirtual |
Returns whether the cursor is currently at the end of the buffer.
Implements cbdc::serializer.
Definition at line 30 of file util/raft/serialization.cpp.
|
explicitfinalvirtual |
Bool operator for checking whether the last serialization operation completed successfully.
Implements cbdc::serializer.
Definition at line 17 of file util/raft/serialization.cpp.
|
finalvirtual |
Reads the given number of bytes from the current cursor in the buffer into the given destination.
data | pointer to the destination for the data. |
len | number of bytes to read from the buffer. |
Implements cbdc::serializer.
Definition at line 45 of file util/raft/serialization.cpp.
|
finalvirtual |
Resets the cursor to the start of the buffer.
Implements cbdc::serializer.
Definition at line 25 of file util/raft/serialization.cpp.
Referenced by nuraft_serializer().
|
finalvirtual |
Writes the given raw bytes to the buffer from the current position of the cursor.
Does not resize the buffer.
data | pointer to the start of the data to write. |
len | number of bytes to write. |
Implements cbdc::serializer.
Definition at line 34 of file util/raft/serialization.cpp.