13 buffer_serializer::operator bool()
const {
27 return m_cursor >= m_pkt.
size();
31 if(m_cursor + len > m_pkt.size()) {
32 m_pkt.extend(m_cursor + len - m_pkt.size());
34 std::memcpy(m_pkt.data_at(m_cursor), data, len);
40 if(m_cursor + len > m_pkt.size()) {
44 std::memcpy(data, m_pkt.data_at(m_cursor), len);
void advance_cursor(size_t len) final
Moves the cursor forward by the given number of bytes.
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...
auto write(const void *data, size_t len) -> bool final
Write the given bytes into the buffer from the current cursor position.
auto end_of_buffer() const -> bool final
Indicates whether the cursor is at or beyond the end of the buffer.
void reset() final
Resets the cursor to the start of the buffer.
buffer_serializer(cbdc::buffer &pkt)
Constructor.
Buffer to store and retrieve byte data.
auto size() const -> size_t
Returns the number of bytes contained in the buffer.