44 template <
typename data_type>
82 for (uint8_t index = 0; index <
_size; index++) {
99 uint8_t head_new =
_head;
129 for (uint8_t i = 0; i <
_size; i++) {
130 int index = (
_head - i);
131 index = index < 0 ? _size + index : index;
133 if (timestamp >=
_buffer[index].time_us && timestamp -
_buffer[index].time_us < (uint64_t)1e5) {
139 if (index ==
_head) {
144 _tail = (index + 1) % _size;
152 if (index ==
_tail) {
bool pop_first_older_than(const uint64_t ×tamp, data_type *sample)
const data_type & get_newest()
bool allocate(uint8_t size)
const data_type & get_oldest()
uint8_t get_oldest_index() const
data_type & operator[](const uint8_t index)
RingBuffer & operator=(const RingBuffer &)=delete
uint8_t get_length() const
void push(const data_type &sample)