|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Circular buffer which wraps with a pre-populated indices array [generally fastest].
Definition at line 471 of file circularBuffer.hpp.
#include <sigproc/circularBuffer.hpp>
Inheritance diagram for mx::sigproc::circularBufferIndex< _storedT, _indexT >:Public Types | |
| typedef _storedT | storedT |
| The maximum number of entries to allow in the buffer before wrapping. | |
| typedef _indexT | indexT |
| The index type, also used for sizes. | |
Public Types inherited from mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT > | |
| typedef circularBufferIndex< _storedT, _indexT > | derivedT |
| The child class. | |
| typedef _storedT | storedT |
| The type stored in the circular buffer. | |
| typedef _indexT | indexT |
| The index type, also used for sizes. | |
Public Member Functions | |
| circularBufferIndex () | |
| Default c'tor. | |
| circularBufferIndex (indexT maxEnt) | |
| Sizing constructor. | |
| void | setMaxEntries (indexT maxEnt) |
| Interface implementation for maxEntries. | |
| storedT & | at (indexT refEntry, indexT idx) |
| Interface implementation for entry access. | |
| const storedT & | at (indexT refEntry, indexT idx) const |
| Interface implementation for entry access, const version. | |
Public Member Functions inherited from mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT > | |
| circularBufferBase () | |
| Default c'tor. | |
| circularBufferBase (indexT maxEnt) | |
| Sizing constructor. | |
| void | maxEntries (indexT maxEnt) |
| Set the maximum size of the buffer. | |
| indexT | maxEntries () |
| Get the maximum size of the buffer. | |
| indexT | size () const |
| Get the number of entries. | |
| void | nextEntry (const storedT &newEnt) |
| Add the next entry to the circular buffer. | |
| void | nextEntry () |
| Move to the next entry in the circular buffer. | |
| indexT | earliest () |
| Returns the index of the earliest entry. | |
| indexT | latest () |
| Returns the index of the latest entry. | |
| storedT & | operator[] (indexT idx) |
| Get the entry at a given index. | |
| const storedT & | operator[] (indexT idx) const |
| storedT & | at (indexT refEntry, indexT idx) |
| Get the entry at a given index relative a fixed reference entry. | |
| const storedT & | at (indexT refEntry, indexT idx) const |
| Get the entry at a given index relative a fixed start entry, const version. | |
Protected Attributes | |
| std::vector< size_t > | m_indices |
| Vector of indices for fast indexing into parent's m_buffer. | |
Protected Attributes inherited from mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT > | |
| std::vector< storedT > | m_buffer |
| The circular buffer storage. | |
| indexT | m_maxEntries |
| The maximum number of entries to allow in the buffer before wrapping. | |
| indexT | m_nextEntry |
| Index into m_buffer of the next entry. This is the oldest entry in the buffer. | |
| indexT | m_latest |
| Index into m_buff of the latest entry. This is the newest entry in the buffer. | |
| uint64_t | m_mono |
| typedef _indexT mx::sigproc::circularBufferIndex< _storedT, _indexT >::indexT |
The index type, also used for sizes.
Definition at line 475 of file circularBuffer.hpp.
| typedef _storedT mx::sigproc::circularBufferIndex< _storedT, _indexT >::storedT |
The maximum number of entries to allow in the buffer before wrapping.
Definition at line 474 of file circularBuffer.hpp.
|
inline |
Default c'tor.
Definition at line 482 of file circularBuffer.hpp.
|
inlineexplicit |
Sizing constructor.
Sets the maximum size of the buffer. Note that this will not be the size until a full set of entries have been added to the buffer.
| [in] | maxEnt | the maximum number of entries this buffer will hold |
Definition at line 490 of file circularBuffer.hpp.
|
inline |
Interface implementation for entry access.
Accesses the idx-th element relative to refEntry, using the pre-populated indices to wrap
| [in] | refEntry | the entry to start counting from |
| [in] | idx | the index of the entry to access |
Definition at line 514 of file circularBuffer.hpp.
References mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT >::m_buffer, and mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT >::m_maxEntries.
|
inline |
Interface implementation for entry access, const version.
Accesses the idx-th element relative to refEntry, using the pre-populated indices to wrap
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| [in] | refEntry | the entry to start counting from |
| [in] | idx | the index of the entry to access |
Definition at line 528 of file circularBuffer.hpp.
References mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT >::m_buffer, and mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT >::m_maxEntries.
|
inline |
Interface implementation for maxEntries.
Resizes and populates the indices array.
| [in] | maxEnt | the maximum number of entries this buffer will hold |
Definition at line 498 of file circularBuffer.hpp.
References mx::sigproc::circularBufferIndex< _storedT, _indexT >::m_indices, and mx::sigproc::circularBufferBase< circularBufferIndex< _storedT, _indexT >, _storedT, _indexT >::m_maxEntries.
|
protected |
Vector of indices for fast indexing into parent's m_buffer.
Definition at line 478 of file circularBuffer.hpp.
Referenced by mx::sigproc::circularBufferIndex< _storedT, _indexT >::setMaxEntries().