Reads variable-length data buffers from a RingBufferData, delimited by Base128 varint-encoded length delimiters.
More...
#include "client/length_delimited_ring_buffer.h"
Public Member Functions | |
| constexpr | LengthDelimitedRingBufferReader (RingBufferDataType &ring_buffer) |
Constructs a reader which holds a reference to ring_buffer. | |
| LengthDelimitedRingBufferReader (const LengthDelimitedRingBufferReader &)=delete | |
| LengthDelimitedRingBufferReader & | operator= (const LengthDelimitedRingBufferReader &)=delete |
| bool | Pop (std::vector< uint8_t > &target_buffer) |
| Pops off the next buffer from the front of the ring buffer. | |
| void | ResetForTesting () |
| Resets the state of the reader (e.g., for testing). | |
Reads variable-length data buffers from a RingBufferData, delimited by Base128 varint-encoded length delimiters.
Holds a reference to a RingBufferData with the capacity to hold RingBufferDataType::size() bytes of variable-length buffers each preceded by its length (encoded as a Base128 length varint).
Provides reading capabilities via Pop().
|
inlineexplicitconstexpr |
Constructs a reader which holds a reference to ring_buffer.
| [in] | ring_buffer | The ring buffer from which data will be read. This object must outlive the lifetime of ring_buffer. |
|
inline |
Pops off the next buffer from the front of the ring buffer.
| [in] | target_buffer | On success, the buffer into which data will be read. |
true and advances ring_buffer.data_range past the end of the buffer read. Otherwise, returns false.