CHROMA
|
Circular Buffer. More...
#include <circular_buffer.h>
Classes | |
struct | OutOfBoundsException |
Public Member Functions | |
CircularBuffer (int n_max) | |
Constructor. More... | |
~CircularBuffer () | |
Destructor is automatic. More... | |
CircularBuffer (const CircularBuffer< T > &c) | |
Copy constructor. More... | |
void | reset (void) |
Nuke it: More... | |
int | sizeMax (void) const |
Get the maximum number of data items one can store. More... | |
int | size (void) const |
Get the current number of items stored. More... | |
void | get (const unsigned int i, T &x) const |
get the ith most recent item More... | |
const T & | operator[] (int i) const |
T & | operator[] (int i) |
bool | isEmpty (void) const |
Is empty check. More... | |
void | push (const T &e) |
push in an item as most recent. More... | |
void | replaceHead (const T &x) |
Private Attributes | |
unsigned int | size_max |
unsigned int | size_internal |
multi1d< T > | q |
unsigned int | start |
unsigned int | end |
Circular Buffer.
Definitions for a templated circular buffer class to be used in Chronological Predictor.
Usage: construct with CircularBuffer(int n_max)
with n_max the maximum number of elements – this allocates storage
add elements with push(elem);
reset with reset()
Access elements using operator[unsigned int i]
i=0 most recent i=1 next most rcent ... i=size()-1 // least recent
Definition at line 38 of file circular_buffer.h.
|
inline |
|
inline |
Destructor is automatic.
Definition at line 58 of file circular_buffer.h.
|
inline |
Copy constructor.
Definition at line 61 of file circular_buffer.h.
|
inline |
get the ith most recent item
Definition at line 89 of file circular_buffer.h.
|
inline |
Is empty check.
Definition at line 124 of file circular_buffer.h.
|
inline |
Definition at line 114 of file circular_buffer.h.
|
inline |
Definition at line 105 of file circular_buffer.h.
|
inline |
push in an item as most recent.
Definition at line 130 of file circular_buffer.h.
References END_CODE, q, and START_CODE.
|
inline |
Definition at line 207 of file circular_buffer.h.
|
inline |
Nuke it:
Definition at line 68 of file circular_buffer.h.
|
inline |
Get the current number of items stored.
Definition at line 84 of file circular_buffer.h.
Referenced by Chroma::MinimalResidualExtrapolation4DChronoPredictor< T >::checkOrthoNormal(), Chroma::MinimalResidualExtrapolation4DChronoPredictor< T >::find_extrap_solutionM(), and Chroma::MinimalResidualExtrapolation4DChronoPredictor< T >::orthonormPrevious().
|
inline |
Get the maximum number of data items one can store.
Definition at line 79 of file circular_buffer.h.
|
private |
Definition at line 218 of file circular_buffer.h.
|
private |
Definition at line 216 of file circular_buffer.h.
|
private |
Definition at line 215 of file circular_buffer.h.
|
private |
Definition at line 214 of file circular_buffer.h.
|
private |
Definition at line 217 of file circular_buffer.h.