mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx::sigproc::circularBufferBranch< _storedT, _indexT > Class Template Reference

template<typename _storedT, typename _indexT>
class mx::sigproc::circularBufferBranch< _storedT, _indexT >

Circular buffer which wraps with an if statement (branching) [faster than mod, less memory than index].

Definition at line 329 of file circularBuffer.hpp.

#include <sigproc/circularBuffer.hpp>

Inheritance diagram for mx::sigproc::circularBufferBranch< _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< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >
typedef circularBufferBranch< _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

 circularBufferBranch ()
 Default c'tor.
 circularBufferBranch (indexT maxEnt)
 Sizing constructor.
void setMaxEntries (indexT maxEnt)
 Interface implementation for maxEntries.
storedTat (indexT refEntry, indexT idx)
 Interface implementation for entry access.
const storedTat (indexT refEntry, indexT idx) const
 Interface implementation for entry access, const version.
Public Member Functions inherited from mx::sigproc::circularBufferBase< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >
 circularBufferBase ()
 Default c'tor.
void maxEntries (indexT maxEnt)
 Set 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.
indexT earliest ()
 Returns the index of the earliest entry.
indexT latest ()
 Returns the index of the latest entry.
storedToperator[] (indexT idx)
 Get the entry at a given index.
storedTat (indexT refEntry, indexT idx)
 Get the entry at a given index relative a fixed reference entry.

Additional Inherited Members

Protected Attributes inherited from mx::sigproc::circularBufferBase< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >
std::vector< storedTm_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

Member Typedef Documentation

◆ indexT

template<typename _storedT, typename _indexT>
typedef _indexT mx::sigproc::circularBufferBranch< _storedT, _indexT >::indexT

The index type, also used for sizes.

Definition at line 333 of file circularBuffer.hpp.

◆ storedT

template<typename _storedT, typename _indexT>
typedef _storedT mx::sigproc::circularBufferBranch< _storedT, _indexT >::storedT

The maximum number of entries to allow in the buffer before wrapping.

Definition at line 332 of file circularBuffer.hpp.

Constructor & Destructor Documentation

◆ circularBufferBranch() [1/2]

template<typename _storedT, typename _indexT>
mx::sigproc::circularBufferBranch< _storedT, _indexT >::circularBufferBranch ( )
inline

◆ circularBufferBranch() [2/2]

template<typename _storedT, typename _indexT>
mx::sigproc::circularBufferBranch< _storedT, _indexT >::circularBufferBranch ( indexT maxEnt)
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.

Parameters
[in]maxEntthe maximum number of entries this buffer will hold

Definition at line 345 of file circularBuffer.hpp.

References mx::sigproc::circularBufferBase< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >::circularBufferBase(), and circularBufferBranch().

Member Function Documentation

◆ at() [1/2]

template<typename _storedT, typename _indexT>
storedT & mx::sigproc::circularBufferBranch< _storedT, _indexT >::at ( indexT refEntry,
indexT idx )
inline

Interface implementation for entry access.

Accesses the idx-th element relative to refEntry, using a branch (if-statement) to wrap

Returns
a reference to the idx-th element
Parameters
[in]refEntrythe entry to start counting from
[in]idxthe index of the entry to access

Definition at line 362 of file circularBuffer.hpp.

References mx::sigproc::circularBufferBase< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >::m_buffer.

Referenced by TEST_CASE().

◆ at() [2/2]

template<typename _storedT, typename _indexT>
const storedT & mx::sigproc::circularBufferBranch< _storedT, _indexT >::at ( indexT refEntry,
indexT idx ) const
inline

Interface implementation for entry access, const version.

Accesses the idx-th element relative to refEntry, using a branch (if-statement) to wrap

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns
a const reference to the idx-th element
Parameters
[in]refEntrythe entry to start counting from
[in]idxthe index of the entry to access

Definition at line 388 of file circularBuffer.hpp.

References mx::sigproc::circularBufferBase< circularBufferBranch< _storedT, _indexT >, _storedT, _indexT >::m_buffer.

◆ setMaxEntries()

template<typename _storedT, typename _indexT>
void mx::sigproc::circularBufferBranch< _storedT, _indexT >::setMaxEntries ( indexT maxEnt)
inline

Interface implementation for maxEntries.

Resets the wrap entry to 0.

Parameters
[in]maxEntthe maximum number of entries this buffer will hold

Definition at line 353 of file circularBuffer.hpp.


The documentation for this class was generated from the following file: