|
ESPHome 2025.12.0-dev
|
A SplitBuffer allocates a large memory buffer potentially as multiple smaller buffers to facilitate allocation of large buffers on devices with fragmented memory spaces. More...
#include <split_buffer.h>
Public Member Functions | |
| SplitBuffer ()=default | |
| ~SplitBuffer () | |
| bool | init (size_t total_length) |
| void | free () |
| uint8_t & | operator[] (size_t index) |
| const uint8_t & | operator[] (size_t index) const |
| void | fill (uint8_t value) const |
| Fill the entire buffer with a single byte value. | |
| size_t | size () const |
| size_t | get_buffer_count () const |
| bool | is_valid () const |
A SplitBuffer allocates a large memory buffer potentially as multiple smaller buffers to facilitate allocation of large buffers on devices with fragmented memory spaces.
Each sub-buffer is the same size, except for the last one which may be smaller. Standard array indexing using [] is possible on the buffer, but, since the buffer may not be contiguous in memory, there is no easy way to access the buffer as a single array, i.e. no .data() access like a vector.
Definition at line 14 of file split_buffer.h.
|
default |
| esphome::split_buffer::SplitBuffer::~SplitBuffer | ( | ) |
Definition at line 9 of file split_buffer.cpp.
| void esphome::split_buffer::SplitBuffer::fill | ( | uint8_t | value | ) | const |
Fill the entire buffer with a single byte value.
| value | Fill value |
Definition at line 129 of file split_buffer.cpp.
| void esphome::split_buffer::SplitBuffer::free | ( | ) |
Definition at line 87 of file split_buffer.cpp.
|
inline |
Definition at line 34 of file split_buffer.h.
| bool esphome::split_buffer::SplitBuffer::init | ( | size_t | total_length | ) |
Definition at line 11 of file split_buffer.cpp.
|
inline |
Definition at line 37 of file split_buffer.h.
| uint8_t & esphome::split_buffer::SplitBuffer::operator[] | ( | size_t | index | ) |
Definition at line 120 of file split_buffer.cpp.
| const uint8_t & esphome::split_buffer::SplitBuffer::operator[] | ( | size_t | index | ) | const |
Definition at line 104 of file split_buffer.cpp.
|
inline |
Definition at line 31 of file split_buffer.h.