|
Arduino PulseWire Transceiver Library
|
Efficient lock-free ring buffer for storing data. More...
#include <RingBuffer.h>
Public Member Functions | |
| RingBuffer (size_t size=128) | |
| void | resize (size_t new_size) |
| bool | write (const T &value) |
| int | writeArray (const T *data, size_t len) |
| size_t | available () const |
| void | clear () |
| bool | isFull () const |
| bool | isEmpty () const |
| size_t | size () const |
| bool | read (T &out) |
| Read and remove the next element. Returns true if successful. | |
| int | read () |
| int | readArray (T *dest, size_t len) |
| Read up to len elements into dest, returns number of elements read. | |
| bool | peek (T &out) const |
| Peek at the next element without removing it. Returns true if successful. | |
| int | peek () const |
| Peek (uint8_t specialization compatibility). Returns -1 if empty. | |
| size_t | availableForWrite () const |
| Returns available space for writing. | |
Protected Attributes | |
| T * | _buffer = nullptr |
| size_t | _capacity = 0 |
| size_t | _head = 0 |
| size_t | _tail = 0 |
| size_t | _count = 0 |
Efficient lock-free ring buffer for storing data.
Implements a FIFO circular buffer for storage and retrieval. Used internally for TX and RX buffering. Supports push, read, peek, and bulk operations with minimal memory movement.
| T | The type of elements stored in the ring buffer. |
Definition at line 24 of file RingBuffer.h.
|
inline |
Definition at line 26 of file RingBuffer.h.
|
inline |
Definition at line 28 of file RingBuffer.h.
|
inline |
Definition at line 60 of file RingBuffer.h.
|
inline |
Returns available space for writing.
Definition at line 119 of file RingBuffer.h.
|
inline |
Definition at line 62 of file RingBuffer.h.
|
inline |
Definition at line 70 of file RingBuffer.h.
|
inline |
Definition at line 68 of file RingBuffer.h.
|
inline |
Peek (uint8_t specialization compatibility). Returns -1 if empty.
Definition at line 113 of file RingBuffer.h.
Peek at the next element without removing it. Returns true if successful.
Definition at line 106 of file RingBuffer.h.
|
inline |
Read and remove the next byte (uint8_t specialization compatibility). Returns -1 if empty.
Definition at line 85 of file RingBuffer.h.
Read and remove the next element. Returns true if successful.
Definition at line 75 of file RingBuffer.h.
Read up to len elements into dest, returns number of elements read.
Definition at line 94 of file RingBuffer.h.
Definition at line 33 of file RingBuffer.h.
|
inline |
Definition at line 72 of file RingBuffer.h.
Definition at line 40 of file RingBuffer.h.
Definition at line 48 of file RingBuffer.h.
Definition at line 122 of file RingBuffer.h.
|
protected |
Definition at line 123 of file RingBuffer.h.
|
protected |
Definition at line 126 of file RingBuffer.h.
|
protected |
Definition at line 124 of file RingBuffer.h.
|
protected |
Definition at line 125 of file RingBuffer.h.