HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_CircularBuffer< T > Class Template Reference

#include <NET_CircularBuffer.h>

Classes

class  base_iterator
 

Public Types

using index_t = exint
 
using range_t = std::pair< T *, int >
 
using const_range_t = std::pair< const T *, int >
 
using iterator = base_iterator< T >
 
using const_iterator = base_iterator< const T >
 

Public Member Functions

 NET_CircularBuffer ()
 
Tfront ()
 The first element in the buffer. Undefined behaviour if the buffer is empty. More...
 
Tback ()
 The last element in the buffer. Undefined behaviour if the buffer is empty. More...
 
const Tfront () const
 The first element in the buffer. Undefined behaviour if the buffer is empty. More...
 
const Tback () const
 The last element in the buffer. Undefined behaviour if the buffer is empty. More...
 
iterator begin ()
 The begin iterator for the buffer. More...
 
iterator end ()
 The end iterator for the buffer. More...
 
const_iterator begin () const
 The begin const iterator for the buffer. More...
 
const_iterator end () const
 The end const iterator for the buffer. More...
 
Toperator[] (int index)
 Retrieve element at provided index. More...
 
const Toperator[] (int index) const
 Retrieve element at provided index. More...
 
void push (const T &data)
 Place a single element onto the back of the buffer. More...
 
void push (const T *data, exint count)
 Place an array of elements onto the back of the buffer. More...
 
T pop ()
 Remove a single element from the front of the buffer. More...
 
void pop (int count)
 Remove multiple elements from the front of the buffer. More...
 
bool isFull () const
 Is the buffer currently full. More...
 
bool isEmpty () const
 Is the buffer currently empty. More...
 
exint size () const
 The number of elements currently stored in the buffer. More...
 
int entries () const
 The number of elements currently stored in the buffer. More...
 
exint capacity () const
 The current capacity of the buffer. More...
 
exint maxSize () const
 The absolute maximum size of the buffer. Use size() if you need to know the current size of the buffer. More...
 
range_t arrayOne ()
 A circular buffer can wrap around in memory. This is the first array of continious memory. If the buffer is not currently wrapped then the entire buffer will be present in this array and the second array will be empty. More...
 
range_t arrayTwo ()
 Holds information about the second array of contigous data. See arrayOne() for further details. More...
 
const_range_t arrayOne () const
 Const variant of the arrayOne(). More...
 
const_range_t arrayTwo () const
 Const variant of the arrayTwo(). More...
 
void clear ()
 Completely clear the buffer. This will free any currently allocated data. More...
 
void debug () const
 Printout debug information about this buffer. More...
 

Detailed Description

template<typename T>
class NET_CircularBuffer< T >

Definition at line 27 of file NET_CircularBuffer.h.

Member Typedef Documentation

template<typename T>
using NET_CircularBuffer< T >::const_iterator = base_iterator<const T>

Definition at line 155 of file NET_CircularBuffer.h.

template<typename T>
using NET_CircularBuffer< T >::const_range_t = std::pair<const T*, int>

Definition at line 32 of file NET_CircularBuffer.h.

template<typename T>
using NET_CircularBuffer< T >::index_t = exint

Definition at line 30 of file NET_CircularBuffer.h.

template<typename T>
using NET_CircularBuffer< T >::iterator = base_iterator<T>

Definition at line 154 of file NET_CircularBuffer.h.

template<typename T>
using NET_CircularBuffer< T >::range_t = std::pair<T*, int>

Definition at line 31 of file NET_CircularBuffer.h.

Constructor & Destructor Documentation

template<typename T>
NET_CircularBuffer< T >::NET_CircularBuffer ( )
inline

Definition at line 34 of file NET_CircularBuffer.h.

Member Function Documentation

template<typename T>
range_t NET_CircularBuffer< T >::arrayOne ( )
inline

A circular buffer can wrap around in memory. This is the first array of continious memory. If the buffer is not currently wrapped then the entire buffer will be present in this array and the second array will be empty.

Returns
A pair of the start of the array and the length of the first array.

Definition at line 331 of file NET_CircularBuffer.h.

template<typename T>
const_range_t NET_CircularBuffer< T >::arrayOne ( ) const
inline

Const variant of the arrayOne().

Returns
See arrayOne()

Definition at line 359 of file NET_CircularBuffer.h.

template<typename T>
range_t NET_CircularBuffer< T >::arrayTwo ( )
inline

Holds information about the second array of contigous data. See arrayOne() for further details.

Returns
A pair of that start of the array and the length of the second array.

Definition at line 346 of file NET_CircularBuffer.h.

template<typename T>
const_range_t NET_CircularBuffer< T >::arrayTwo ( ) const
inline

Const variant of the arrayTwo().

Returns
See arrayTwo()

Definition at line 366 of file NET_CircularBuffer.h.

template<typename T>
T& NET_CircularBuffer< T >::back ( void  )
inline

The last element in the buffer. Undefined behaviour if the buffer is empty.

Returns
The last element in the buffer. Undefined behaviour if the buffer is empty.

Definition at line 167 of file NET_CircularBuffer.h.

template<typename T>
const T& NET_CircularBuffer< T >::back ( void  ) const
inline

The last element in the buffer. Undefined behaviour if the buffer is empty.

Returns
The last element in the buffer.

Definition at line 177 of file NET_CircularBuffer.h.

template<typename T>
iterator NET_CircularBuffer< T >::begin ( void  )
inline

The begin iterator for the buffer.

Returns
The begin iterator

Definition at line 182 of file NET_CircularBuffer.h.

template<typename T>
const_iterator NET_CircularBuffer< T >::begin ( void  ) const
inline

The begin const iterator for the buffer.

Returns
The begin const iterator.

Definition at line 190 of file NET_CircularBuffer.h.

template<typename T>
exint NET_CircularBuffer< T >::capacity ( ) const
inline

The current capacity of the buffer.

Returns
The total capacity of the buffer.

Definition at line 317 of file NET_CircularBuffer.h.

template<typename T>
void NET_CircularBuffer< T >::clear ( )
inline

Completely clear the buffer. This will free any currently allocated data.

Definition at line 372 of file NET_CircularBuffer.h.

template<typename T>
void NET_CircularBuffer< T >::debug ( ) const
inline

Printout debug information about this buffer.

Definition at line 380 of file NET_CircularBuffer.h.

template<typename T>
iterator NET_CircularBuffer< T >::end ( void  )
inline

The end iterator for the buffer.

Returns
The end iterator.

Definition at line 186 of file NET_CircularBuffer.h.

template<typename T>
const_iterator NET_CircularBuffer< T >::end ( void  ) const
inline

The end const iterator for the buffer.

Returns
The end const iterator.

Definition at line 197 of file NET_CircularBuffer.h.

template<typename T>
int NET_CircularBuffer< T >::entries ( ) const
inline

The number of elements currently stored in the buffer.

Returns
The current size of the buffer.

Definition at line 313 of file NET_CircularBuffer.h.

template<typename T>
T& NET_CircularBuffer< T >::front ( void  )
inline

The first element in the buffer. Undefined behaviour if the buffer is empty.

Returns
The first element in the buffer

Definition at line 161 of file NET_CircularBuffer.h.

template<typename T>
const T& NET_CircularBuffer< T >::front ( void  ) const
inline

The first element in the buffer. Undefined behaviour if the buffer is empty.

Returns
The first element in the buffer.

Definition at line 172 of file NET_CircularBuffer.h.

template<typename T>
bool NET_CircularBuffer< T >::isEmpty ( ) const
inline

Is the buffer currently empty.

Returns
True if the buffer currently does not store any elements.

Definition at line 300 of file NET_CircularBuffer.h.

template<typename T>
bool NET_CircularBuffer< T >::isFull ( ) const
inline

Is the buffer currently full.

Returns
True if the buffer is currently full. Any new push() calls will allocate more space.

Definition at line 296 of file NET_CircularBuffer.h.

template<typename T>
exint NET_CircularBuffer< T >::maxSize ( ) const
inline

The absolute maximum size of the buffer. Use size() if you need to know the current size of the buffer.

Returns
The maximum size of the buffer.

Definition at line 322 of file NET_CircularBuffer.h.

template<typename T>
T& NET_CircularBuffer< T >::operator[] ( int  index)
inline

Retrieve element at provided index.

Parameters
indexThe index to retrieve the element at.
Returns
The element at index.

Definition at line 206 of file NET_CircularBuffer.h.

template<typename T>
const T& NET_CircularBuffer< T >::operator[] ( int  index) const
inline

Retrieve element at provided index.

Parameters
indexThe index to retrieve the element at.
Returns
The element at index.

Definition at line 217 of file NET_CircularBuffer.h.

template<typename T>
T NET_CircularBuffer< T >::pop ( )
inline

Remove a single element from the front of the buffer.

Returns
The element removed.

Definition at line 277 of file NET_CircularBuffer.h.

template<typename T>
void NET_CircularBuffer< T >::pop ( int  count)
inline

Remove multiple elements from the front of the buffer.

Parameters
countThe number of elements to remove.

Definition at line 287 of file NET_CircularBuffer.h.

template<typename T>
void NET_CircularBuffer< T >::push ( const T data)
inline

Place a single element onto the back of the buffer.

Parameters
data

Definition at line 227 of file NET_CircularBuffer.h.

template<typename T>
void NET_CircularBuffer< T >::push ( const T data,
exint  count 
)
inline

Place an array of elements onto the back of the buffer.

Parameters
dataThe array of elements to add to the buffer.
countThe number of elements in the array to add.

Definition at line 235 of file NET_CircularBuffer.h.

template<typename T>
exint NET_CircularBuffer< T >::size ( void  ) const
inline

The number of elements currently stored in the buffer.

Returns
The current size of the buffer.

Definition at line 304 of file NET_CircularBuffer.h.


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