Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
Public Member Functions | List of all members
Pothos::Util::RingDeque< T > Class Template Reference

#include <RingDeque.hpp>

Public Member Functions

 RingDeque (void)
 Construct a new ring deque. More...
 
 RingDeque (const size_t capacity)
 Construct a new ring deque – with space reservation. More...
 
const T & operator[] (const size_t offset) const
 Get a const ref at, where front == 0, back == size() - 1. More...
 
T & operator[] (const size_t offset)
 Get a ref at, where front == 0, back == size() - 1. More...
 
template<typename U >
void push_front (U &&elem)
 Push an element onto the front of the queue. More...
 
template<typename... Args>
T & emplace_front (Args &&...args)
 Emplace an element onto the front of the queue. More...
 
void pop_front (void)
 Pop and element from the front of the queue. More...
 
const T & front (void) const
 Get a const reference to the front element. More...
 
T & front (void)
 Get a reference to the front element. More...
 
template<typename U >
void push_back (U &&elem)
 Push an element onto the back of the queue. More...
 
template<typename... Args>
T & emplace_back (Args &&...args)
 Emplace an element onto the back of the queue. More...
 
void pop_back (void)
 Pop and element from the back of the queue. More...
 
const T & back (void) const
 Get a const reference to the back element. More...
 
T & back (void)
 Get a reference to the back element. More...
 
bool empty (void) const
 Is the deque empty? – no elements. More...
 
bool full (void) const
 Is the deque full? – num elements == capacity. More...
 
size_t size (void) const
 How many elements are in the deque. More...
 
size_t capacity (void) const
 How many elements can be stored? More...
 
void set_capacity (const size_t capacity)
 Set the deque capacity if too small. More...
 
void clear (void)
 Empty the contents of this queue. More...
 

Detailed Description

template<typename T>
class Pothos::Util::RingDeque< T >

RingDeque is a templated deque using an underlying vector. The API of RingDeque is very similar to the std::deque<T>. RingDeque is here because I wanted the efficiency of boost::circular_buffer without the boost requirement. The ring deque does not have a specific capacity limit.

Constructor & Destructor Documentation

template<typename T >
Pothos::Util::RingDeque< T >::RingDeque ( void  )

Construct a new ring deque.

template<typename T >
Pothos::Util::RingDeque< T >::RingDeque ( const size_t  capacity)

Construct a new ring deque – with space reservation.

Member Function Documentation

template<typename T >
const T & Pothos::Util::RingDeque< T >::back ( void  ) const

Get a const reference to the back element.

template<typename T >
T & Pothos::Util::RingDeque< T >::back ( void  )

Get a reference to the back element.

template<typename T >
size_t Pothos::Util::RingDeque< T >::capacity ( void  ) const

How many elements can be stored?

template<typename T >
void Pothos::Util::RingDeque< T >::clear ( void  )

Empty the contents of this queue.

template<typename T >
template<typename... Args>
T & Pothos::Util::RingDeque< T >::emplace_back ( Args &&...  args)

Emplace an element onto the back of the queue.

template<typename T >
template<typename... Args>
T & Pothos::Util::RingDeque< T >::emplace_front ( Args &&...  args)

Emplace an element onto the front of the queue.

template<typename T >
bool Pothos::Util::RingDeque< T >::empty ( void  ) const

Is the deque empty? – no elements.

template<typename T >
const T & Pothos::Util::RingDeque< T >::front ( void  ) const

Get a const reference to the front element.

template<typename T >
T & Pothos::Util::RingDeque< T >::front ( void  )

Get a reference to the front element.

template<typename T >
bool Pothos::Util::RingDeque< T >::full ( void  ) const

Is the deque full? – num elements == capacity.

template<typename T >
const T & Pothos::Util::RingDeque< T >::operator[] ( const size_t  offset) const

Get a const ref at, where front == 0, back == size() - 1.

template<typename T >
T & Pothos::Util::RingDeque< T >::operator[] ( const size_t  offset)

Get a ref at, where front == 0, back == size() - 1.

template<typename T >
void Pothos::Util::RingDeque< T >::pop_back ( void  )

Pop and element from the back of the queue.

template<typename T >
void Pothos::Util::RingDeque< T >::pop_front ( void  )

Pop and element from the front of the queue.

template<typename T >
template<typename U >
void Pothos::Util::RingDeque< T >::push_back ( U &&  elem)

Push an element onto the back of the queue.

template<typename T >
template<typename U >
void Pothos::Util::RingDeque< T >::push_front ( U &&  elem)

Push an element onto the front of the queue.

template<typename T >
void Pothos::Util::RingDeque< T >::set_capacity ( const size_t  capacity)

Set the deque capacity if too small.

template<typename T >
size_t Pothos::Util::RingDeque< T >::size ( void  ) const

How many elements are in the deque.


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