![]() |
0.4.1
|
A buffer which is overwriting itself from the start when full. More...
Data Structures | |
class | ConstIterator |
Const iterator. More... | |
class | ConstReverseIterator |
Const reverse iterator. More... | |
class | Iterator |
Iterator. More... | |
class | ReverseIterator |
Reverse Iterator. More... | |
Public Member Functions | |
T & | at (size_t pos) |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown. | |
const T & | at (size_t pos) const |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown. | |
T & | back () |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior. | |
const T & | back () const |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior.Reference to the last element. | |
Iterator | begin () |
Returns an iterator to the first element of the vector. | |
ConstIterator | begin () const |
Returns an iterator to the first element of the vector. | |
size_t | capacity () const |
Returns the number of elements that can be held in currently allocated storage. | |
ConstIterator | cbegin () const |
Returns an iterator to the first element of the vector. | |
ConstIterator | cend () const |
Returns an iterator to the element following the last element of the vector. | |
void | clear () |
Erases all elements from the container. After this call, size() returns zero. | |
ConstReverseIterator | crbegin () const |
Returns a reverse iterator to the first element of the reversed vector. | |
ConstReverseIterator | crend () const |
Returns a reverse iterator to the element following the last element of the reversed vector. | |
T * | data () |
Returns a pointer to the raw data array (not in scrolled order) | |
const T * | data () const |
Returns a pointer to the raw data array (not in scrolled order) | |
bool | empty () const |
Checks if the container has no elements. | |
Iterator | end () |
Returns an iterator to the element following the last element of the vector. | |
ConstIterator | end () const |
Returns an iterator to the element following the last element of the vector. | |
T & | front () |
Returns a reference to the first element in the container. Calling front on an empty container is undefined. | |
const T & | front () const |
Returns a reference to the first element in the container. Calling front on an empty container is undefined. | |
bool | full () const |
Checks if the container is full (never full when infinite buffer) | |
std::string | getRawString () const |
Converts the raw buffer to a string. | |
bool | isInfiniteBuffer () const |
Returns whether the buffer is infinite and growing. | |
T | max () const |
Returns the largest value in the buffer. | |
T | min () const |
Returns the smallest value in the buffer. | |
int | offset () const |
Returns the data index of the first element in the buffer. | |
void | pop_back () |
Removes the last element of the container. | |
void | pop_front () |
Removes the first element of the container. | |
void | push_back (const T &value) |
Appends the given element value to the end of the container. | |
ReverseIterator | rbegin () |
Returns a reverse iterator to the first element of the reversed vector. | |
ConstReverseIterator | rbegin () const |
Returns a reverse iterator to the first element of the reversed vector. | |
ReverseIterator | rend () |
Returns a reverse iterator to the element following the last element of the reversed vector. | |
ConstReverseIterator | rend () const |
Returns a reverse iterator to the element following the last element of the reversed vector. | |
void | reserve (size_t new_cap) |
Increase the capacity of the vector to a value that's greater or equal to new_cap. | |
void | resize (size_t targetSize) |
Resizes the buffer to the specified size. | |
ScrollingBuffer (size_t maxSize=0) | |
Reserves space for the buffer but does not fill the buffer with values. | |
ScrollingBuffer (std::initializer_list< T > init) | |
Constructs a new container with the contents of the initializer list init. | |
size_t | size () const |
Returns the number of elements in the container. | |
Private Member Functions | |
bool | isScrolled () const |
Checks if the buffer is scrolled. | |
Private Attributes | |
std::vector< T > | _data |
The data storage object. | |
size_t | _dataEnd |
The index one after the last element (0 if the buffer is empty) | |
size_t | _dataStart |
The index of the first element in the scrolling buffer (0 if the buffer is empty) | |
bool | _infiniteBuffer |
A Flag whether the buffer is currently growing every time when values are inserted or if it is overwriting itself from the start when full. | |
size_t | _maxSize |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ScrollingBuffer< T, _Padding > &buffer) |
Prints the buffer to the output stream. | |
A buffer which is overwriting itself from the start when full.
T | Type of data stored in the buffer |
_Padding | The padding are empty values at the start of the buffer to prevent overriding the start value in multithreaded applications |
Definition at line 29 of file ScrollingBuffer.hpp.
|
inlineexplicit |
Reserves space for the buffer but does not fill the buffer with values.
[in] | maxSize | The maximum size of the scrolling buffer |
Definition at line 38 of file ScrollingBuffer.hpp.
|
inline |
Constructs a new container with the contents of the initializer list init.
[in] | init | initializer list to initialize the elements of the container with |
Definition at line 47 of file ScrollingBuffer.hpp.
|
inline |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
[in] | pos | position of the element to return |
Definition at line 66 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
[in] | pos | position of the element to return |
Definition at line 76 of file ScrollingBuffer.hpp.
|
inline |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior.
Definition at line 116 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior.Reference to the last element.
Definition at line 124 of file ScrollingBuffer.hpp.
|
inline |
Returns an iterator to the first element of the vector.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 193 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns an iterator to the first element of the vector.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 254 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns the number of elements that can be held in currently allocated storage.
Definition at line 444 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns an iterator to the first element of the vector.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 262 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns an iterator to the element following the last element of the vector.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 266 of file ScrollingBuffer.hpp.
|
inline |
Erases all elements from the container. After this call, size() returns zero.
Definition at line 454 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reverse iterator to the first element of the reversed vector.
It corresponds to the last element of the non-reversed vector. If the vector is empty, the returned iterator is equal to rend().
Definition at line 397 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reverse iterator to the element following the last element of the reversed vector.
It corresponds to the element preceding the first element of the non-reversed vector. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 402 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a pointer to the raw data array (not in scrolled order)
Definition at line 784 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a pointer to the raw data array (not in scrolled order)
Definition at line 778 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Checks if the container has no elements.
Definition at line 409 of file ScrollingBuffer.hpp.
|
inline |
Returns an iterator to the element following the last element of the vector.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 197 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns an iterator to the element following the last element of the vector.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 258 of file ScrollingBuffer.hpp.
|
inline |
Returns a reference to the first element in the container. Calling front on an empty container is undefined.
Definition at line 99 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reference to the first element in the container. Calling front on an empty container is undefined.
Definition at line 108 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Checks if the container is full (never full when infinite buffer)
Definition at line 415 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Converts the raw buffer to a string.
Definition at line 796 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns whether the buffer is infinite and growing.
Definition at line 790 of file ScrollingBuffer.hpp.
|
inlinenodiscardprivate |
Checks if the buffer is scrolled.
Definition at line 877 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns the largest value in the buffer.
Definition at line 744 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns the smallest value in the buffer.
Definition at line 758 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns the data index of the first element in the buffer.
Definition at line 772 of file ScrollingBuffer.hpp.
|
inline |
Removes the last element of the container.
Definition at line 524 of file ScrollingBuffer.hpp.
|
inline |
Removes the first element of the container.
Definition at line 494 of file ScrollingBuffer.hpp.
|
inline |
Appends the given element value to the end of the container.
[in] | value | the value of the element to append |
Definition at line 468 of file ScrollingBuffer.hpp.
|
inline |
Returns a reverse iterator to the first element of the reversed vector.
It corresponds to the last element of the non-reversed vector. If the vector is empty, the returned iterator is equal to rend().
Definition at line 324 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reverse iterator to the first element of the reversed vector.
It corresponds to the last element of the non-reversed vector. If the vector is empty, the returned iterator is equal to rend().
Definition at line 387 of file ScrollingBuffer.hpp.
|
inline |
Returns a reverse iterator to the element following the last element of the reversed vector.
It corresponds to the element preceding the first element of the non-reversed vector. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 329 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns a reverse iterator to the element following the last element of the reversed vector.
It corresponds to the element preceding the first element of the non-reversed vector. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 392 of file ScrollingBuffer.hpp.
|
inline |
Increase the capacity of the vector to a value that's greater or equal to new_cap.
new_cap | New capacity of the vector, in number of elements |
Definition at line 438 of file ScrollingBuffer.hpp.
|
inline |
Resizes the buffer to the specified size.
[in] | targetSize | The new buffer size (0 for infinite buffer) |
Definition at line 550 of file ScrollingBuffer.hpp.
|
inlinenodiscard |
Returns the number of elements in the container.
Definition at line 421 of file ScrollingBuffer.hpp.
|
friend |
Prints the buffer to the output stream.
[in,out] | os | The output stream to print to |
[in] | buffer | The buffer to print |
Definition at line 857 of file ScrollingBuffer.hpp.
|
private |
The data storage object.
Definition at line 874 of file ScrollingBuffer.hpp.
|
private |
The index one after the last element (0 if the buffer is empty)
Definition at line 872 of file ScrollingBuffer.hpp.
|
private |
The index of the first element in the scrolling buffer (0 if the buffer is empty)
Definition at line 870 of file ScrollingBuffer.hpp.
|
private |
A Flag whether the buffer is currently growing every time when values are inserted or if it is overwriting itself from the start when full.
Definition at line 865 of file ScrollingBuffer.hpp.
|
private |
The maximum amount of objects to store in the buffer before overwriting itself when full When _infiniteBuffer == true, then this corresponds to m_data.size()
Definition at line 868 of file ScrollingBuffer.hpp.