|
bool | bufferInit |
|
unsigned int | bufferSize |
|
unsigned int | numValuesInBuffer |
|
unsigned int | readPtr |
|
unsigned int | writePtr |
|
Vector< T > | buffer |
|
ErrorLog | errorLog |
|
template<class T>
class CircularBuffer< T >
Definition at line 44 of file CircularBuffer.h.
Copy Constructor. Deep copies the data from the rhs instance to this instance
- Parameters
-
const | CircularBuffer &rhs: ths instance the data and settings will be copied from |
Definition at line 64 of file CircularBuffer.h.
Init Constructor. Resizes the buffer to the size set by bufferSize.
- Parameters
-
unsigned | int bufferSize: sets the size of the buffer |
Definition at line 90 of file CircularBuffer.h.
Default Destructor. Cleans up any memory assigned by the buffer.
Definition at line 99 of file CircularBuffer.h.
Returns the most recent value added to the buffer.
- Returns
- returns the most recent value added to the buffer
Definition at line 357 of file CircularBuffer.h.
Returns true if the buffer has been filled. If the buffer has not been initialized then this function will always return false.
- Returns
- returns true if the buffer has been filled, false otherwise
Definition at line 322 of file CircularBuffer.h.
Gets the data in the CircularBuffer's internal buffer as a std::vector. The argument, rawBuffer, controls if the function returns (if rawBuffer = true ) the entire contents of the internal buffer (with unsorted values and a constant size regardless on whether it is filled), or the current contents of the Circular Buffer in order from oldest to newest (if rawBuffer = false).
- Returns
- returns a std::vector with the data in the buffer
Definition at line 294 of file CircularBuffer.h.
Returns true if the buffer has been initialized.
- Returns
- returns true if the buffer has been initialized, false otherwise
Definition at line 315 of file CircularBuffer.h.
Returns the number of values in the buffer.
- Returns
- returns the number of values in the buffer
Definition at line 336 of file CircularBuffer.h.
Returns the current position of the read pointer.
- Returns
- returns the current position of the read pointer
Definition at line 343 of file CircularBuffer.h.
Returns the size of the buffer.
- Returns
- returns the size of the bufer
Definition at line 329 of file CircularBuffer.h.
Returns the current position of the write pointer.
- Returns
- returns the current position of the write pointer
Definition at line 350 of file CircularBuffer.h.
template<class T>
CircularBuffer< T >::GRT_DEPRECATED_MSG |
( |
"Use getData() instead!" |
, |
|
|
std::vector< T > getDataAsVector() |
const |
|
) |
| |
- Deprecated:
- This function is now deprecated, you should use getData instead! Gets all the data in the buffer as a std::vector.
- Returns
- returns a vector will all the data in the buffer
This is a special access operator that will return the value at the specific index (regardless of the position of the read pointer).
- Parameters
-
const | unsigned int &index: the index of the element you want access to, should be in the range [0 bufferSize-1] |
- Returns
- returns a reference to the element at the index
Definition at line 156 of file CircularBuffer.h.
template<class T>
const T& CircularBuffer< T >::operator() |
( |
const unsigned int & |
index | ) |
const |
|
inline |
This is a special const access operator that will return the value at the specific index (regardless of the position of the read pointer).
- Parameters
-
const | unsigned int &index: the index of the element you want access to, should be in the range [0 bufferSize-1] |
- Returns
- returns a const reference to the element at the index
Definition at line 166 of file CircularBuffer.h.
Sets the equals operator. Defines how the data will be copied from the rhs instance to this instance.
- Parameters
-
- Returns
- returns a reference to this instance
Definition at line 111 of file CircularBuffer.h.
This is the main access operator and will return a value relative to the current read pointer.
- Parameters
-
const | unsigned int &index: the index of the element you want access to, should be in the range [0 bufferSize-1] |
- Returns
- returns a reference to the element at the index
Definition at line 136 of file CircularBuffer.h.
template<class T>
const T& CircularBuffer< T >::operator[] |
( |
const unsigned int & |
index | ) |
const |
|
inline |
This is the constant access operator and will return a value relative to the current read pointer.
- Parameters
-
const | unsigned int &index: the index of the element you want access to, should be in the range [0 bufferSize-1] |
- Returns
- returns a const reference to the element at the index
Definition at line 146 of file CircularBuffer.h.
Push the new value into the end of the buffer, this will move both the read and write pointers.
- Parameters
-
const | T &value: the value that should be added to the end of the buffer |
- Returns
- returns true if the value was pushed, false otherwise
Definition at line 213 of file CircularBuffer.h.
Resets the numValuesInBuffer, read and write pointers to 0.
- Returns
- returns true if the buffer was reset, false otherwise
Definition at line 261 of file CircularBuffer.h.
Resizes the buffer to the newBufferSize, which must be greater than zero.
- Parameters
-
const | unsigned int newBufferSize: the new size of the buffer |
- Returns
- returns true if the buffer was resized
Definition at line 176 of file CircularBuffer.h.
template<class T>
bool CircularBuffer< T >::resize |
( |
const unsigned int |
newBufferSize, |
|
|
const T & |
defaultValue |
|
) |
| |
|
inline |
Resizes the buffer to the newBufferSize, which must be greater than zero, and sets all the values to the default value.
- Parameters
-
const | unsigned int newBufferSize: the new size of the buffer |
const | T &defaultValue: the default value that will be copied to every element |
- Returns
- returns true if the buffer was resized
Definition at line 187 of file CircularBuffer.h.
Sets all the values in the buffer to the value.
- Parameters
-
const | T &value: the value that will be copied to all the elements in the buffer |
- Returns
- returns true if the buffer was updated, false otherwise
Definition at line 245 of file CircularBuffer.h.
The documentation for this class was generated from the following file: