|
| RingBuffer () |
| Default constructor; does not allocate memory.
|
|
| RingBuffer (unsigned size, const T &v=T()) |
|
size_t | size () const |
| Get number of elements.
|
|
int | pos () const |
| Get absolute index of most recently written element.
|
|
int | fill () const |
| Get fill amount of buffer.
|
|
T & | operator[] (int i) |
| Get element at absolute index.
|
|
const T & | operator[] (int i) const |
| Get element at absolute index (read-only)
|
|
T & | next () |
| Obtain next element in buffer. More...
|
|
void | write (const T &v) |
| Write new element.
|
|
T & | read (int i) |
| Get reference to element relative to newest element.
|
|
const T & | read (int i) const |
| Get reference to element relative to newest element (read-only)
|
|
const T & | readFrom (int from, int dist) const |
| Get reference to older element relative to some newer element (read-only) More...
|
|
T & | newest () |
|
const T & | newest () const |
|
void | reset () |
| Set write position to start of array and zero fill amount.
|
|
void | resize (int n, const T &v=T()) |
| Resize buffer. More...
|
|
template<class T, class Alloc = std::allocator<T>>
class al::RingBuffer< T, Alloc >
Ring buffer.
This buffer allows potentially large amounts of data to be buffered without moving memory. This is accomplished by use of a moving write tap.
Definition at line 195 of file al_Buffer.hpp.
template<class T , class Alloc = std::allocator<T>>
Obtain next element in buffer.
This method returns a reference to the next available element in the buffer. This is an alternative to calling write() that does not require constructing a new object, but instead returns the oldest element in the buffer. The returned reference should be assumed to be in an unknown state, thus should be initialized properly.
Definition at line 228 of file al_Buffer.hpp.