|  | Elementa v8.0.0
    Minimalistic library for any C++ application (C++11 and up) | 
A circular buffer with generic content.

| Classes | |
| class | elementa::adts::CircularBuffer< ElemType > | 
| A circular buffer with fixed size, contiguous storage and generic elements.  More... | |
| Functions | |
| elementa::adts::CircularBuffer< ElemType >::CircularBuffer (size_t s) | |
| Constructor.  More... | |
| ElemType & | elementa::adts::CircularBuffer< ElemType >::back (void) | 
| Get a ref to the newest element in the buffer.  More... | |
| void | elementa::adts::CircularBuffer< ElemType >::push_back (const ElemType &e) | 
| Copy E into the buffer, as the last element.  More... | |
| ElemType & | elementa::adts::CircularBuffer< ElemType >::front (void) | 
| Get a ref to the oldest element in the buffer.  More... | |
| void | elementa::adts::CircularBuffer< ElemType >::pop_front (void) | 
| Erases the oldest element in the buffer.  More... | |
| ElemType & | elementa::adts::CircularBuffer< ElemType >::operator[] (size_t index) | 
| Access the n-th element in the buffer or throw if not such element.  More... | |
| class elementa::adts::CircularBuffer | 
A circular buffer with fixed size, contiguous storage and generic elements.
This buffer works as a FIFO container (first-in, first-out). Elements must be assignable and default constructible.
Definition at line 48 of file circularbuffers.h.
| Public Member Functions | |
| CircularBuffer (size_t s) | |
| Constructor.  More... | |
| void | clear (void) | 
| Clear all content.  More... | |
| size_t | capacity (void) const noexcept | 
| Return the fixed room for elements in the buffer.  More... | |
| size_t | size (void) const noexcept | 
| Return the number of elements currently in the buffer.  More... | |
| bool | empty (void) const noexcept | 
| Return true if the buffer is empty.  More... | |
| ElemType & | back (void) | 
| Get a ref to the newest element in the buffer.  More... | |
| void | push_back (const ElemType &e) | 
| Copy E into the buffer, as the last element.  More... | |
| ElemType & | front (void) | 
| Get a ref to the oldest element in the buffer.  More... | |
| void | pop_front (void) | 
| Erases the oldest element in the buffer.  More... | |
| ElemType & | operator[] (size_t index) | 
| Access the n-th element in the buffer or throw if not such element.  More... | |
| 
 | inline | 
Clear all content.
No existing element is destroyed; they are just prepared to be overwriting (assigned to) in further pushes.
Definition at line 61 of file circularbuffers.h.
| 
 | inlinenoexcept | 
Return the fixed room for elements in the buffer.
Definition at line 64 of file circularbuffers.h.
| 
 | inlinenoexcept | 
Return the number of elements currently in the buffer.
Definition at line 67 of file circularbuffers.h.
| 
 | inlinenoexcept | 
Return true if the buffer is empty.
Definition at line 70 of file circularbuffers.h.
| elementa::adts::CircularBuffer< ElemType >::CircularBuffer | ( | size_t | s | ) | 
#include <elementa/adts/circularbuffers.h>
Constructor.
Throw if s == 0. Initially, the buffer is empty.
Definition at line 121 of file circularbuffers.h.
References ELE_CODE_INVARG.
| ElemType & elementa::adts::CircularBuffer< ElemType >::back | ( | void | ) | 
#include <elementa/adts/circularbuffers.h>
Get a ref to the newest element in the buffer.
Throw if the buffer is empty.
Definition at line 130 of file circularbuffers.h.
References ELE_CODE_INVSTATE.
| void elementa::adts::CircularBuffer< ElemType >::push_back | ( | const ElemType & | e | ) | 
#include <elementa/adts/circularbuffers.h>
Copy E into the buffer, as the last element.
If the buffer had a previously popped element there, it is destroyed at this moment.
Definition at line 137 of file circularbuffers.h.
| ElemType & elementa::adts::CircularBuffer< ElemType >::front | ( | void | ) | 
#include <elementa/adts/circularbuffers.h>
Get a ref to the oldest element in the buffer.
Throw if the buffer is empty.
Definition at line 145 of file circularbuffers.h.
References ELE_CODE_INVSTATE.
| void elementa::adts::CircularBuffer< ElemType >::pop_front | ( | void | ) | 
#include <elementa/adts/circularbuffers.h>
Erases the oldest element in the buffer.
Throw if the buffer is empty. No existing element is destroyed; they are just prepared to be overwriting (assigned to) in further pushes.
Definition at line 152 of file circularbuffers.h.
References ELE_CODE_INVSTATE.
| ElemType & elementa::adts::CircularBuffer< ElemType >::operator[] | ( | size_t | index | ) | 
#include <elementa/adts/circularbuffers.h>
Access the n-th element in the buffer or throw if not such element.
Definition at line 161 of file circularbuffers.h.
References ELE_CODE_OUTOFRANGE.