|
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 45 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 65 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 91 of file CircularBuffer.h.
Default Destructor. Cleans up any memory assigned by the buffer.
Definition at line 100 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 358 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 323 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 295 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 316 of file CircularBuffer.h.
Returns the number of values in the buffer.
- Returns
- returns the number of values in the buffer
Definition at line 337 of file CircularBuffer.h.
Returns the current position of the read pointer.
- Returns
- returns the current position of the read pointer
Definition at line 344 of file CircularBuffer.h.
Returns the size of the buffer.
- Returns
- returns the size of the bufer
Definition at line 330 of file CircularBuffer.h.
Returns the current position of the write pointer.
- Returns
- returns the current position of the write pointer
Definition at line 351 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 157 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 167 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 112 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 137 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 147 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 214 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 262 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 177 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 188 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 246 of file CircularBuffer.h.
The documentation for this class was generated from the following file: