20 bool init(
size_t total_length,
size_t max_buffer_size = SIZE_MAX);
28 void fill(uint8_t value)
const;
35 void write(
size_t index,
const uint8_t *data,
size_t length);
38 size_t size()
const {
return this->total_length_; }
44 bool is_valid()
const {
return this->buffers_ !=
nullptr && this->buffer_count_ > 0; }
47 uint8_t **buffers_{
nullptr};
48 size_t buffer_count_{0};
49 size_t buffer_size_{0};
50 size_t total_length_{0};
A SplitBuffer allocates a large memory buffer potentially as multiple smaller buffers to facilitate a...
bool init(size_t total_length, size_t max_buffer_size=SIZE_MAX)
void fill(uint8_t value) const
Fill the entire buffer with a single byte value.
size_t get_buffer_count() const
void write(size_t index, const uint8_t *data, size_t length)
const uint8_t * get_span(size_t index, size_t &length) const
uint8_t & operator[](size_t index)