Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Public Types | Public Member Functions | List of all members
Pothos::Util::RingDeque< T, Allocator > Class Template Reference

#include <RingDeque.hpp>

Public Types

typedef T value_type
 The element type. More...
 
typedef Allocator allocator_type
 The allocator type. More...
 

Public Member Functions

 RingDeque (const size_t capacity=1, const Allocator &allocator=Allocator())
 
 RingDeque (const RingDeque< T, Allocator > &other)
 Copy constructor. More...
 
 RingDeque (RingDeque< T, Allocator > &&other)
 Move constructor. More...
 
RingDequeoperator= (const RingDeque< T, Allocator > &other)
 Copy assignment. More...
 
RingDequeoperator= (RingDeque< T, Allocator > &&other)
 Move assignment. More...
 
 ~RingDeque (void)
 Destruct the ring queue and any elements held. 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, typename Allocator = std::allocator<T>>
class Pothos::Util::RingDeque< T, Allocator >

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.

Member Typedef Documentation

◆ allocator_type

template<typename T, typename Allocator = std::allocator<T>>
typedef Allocator Pothos::Util::RingDeque< T, Allocator >::allocator_type

The allocator type.

◆ value_type

template<typename T, typename Allocator = std::allocator<T>>
typedef T Pothos::Util::RingDeque< T, Allocator >::value_type

The element type.

Constructor & Destructor Documentation

◆ RingDeque() [1/3]

template<typename T , typename A>
Pothos::Util::RingDeque< T, A >::RingDeque ( const size_t  capacity = 1,
const A &  allocator = Allocator() 
)

Construct a new ring deque

Parameters
capacitythe maximum space available
allocatoran optional custom allocator

◆ RingDeque() [2/3]

template<typename T, typename A>
Pothos::Util::RingDeque< T, A >::RingDeque ( const RingDeque< T, A > &  other)

Copy constructor.

◆ RingDeque() [3/3]

template<typename T, typename A>
Pothos::Util::RingDeque< T, A >::RingDeque ( RingDeque< T, A > &&  other)

Move constructor.

◆ ~RingDeque()

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

Destruct the ring queue and any elements held.

Member Function Documentation

◆ back() [1/2]

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

Get a const reference to the back element.

◆ back() [2/2]

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

Get a reference to the back element.

◆ capacity()

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

How many elements can be stored?

◆ clear()

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

Empty the contents of this queue.

◆ emplace_back()

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

Emplace an element onto the back of the queue.

◆ emplace_front()

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

Emplace an element onto the front of the queue.

◆ empty()

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

Is the deque empty? – no elements.

◆ front() [1/2]

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

Get a const reference to the front element.

◆ front() [2/2]

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

Get a reference to the front element.

◆ full()

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

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

◆ operator=() [1/2]

template<typename T, typename A>
RingDeque< T, A > & Pothos::Util::RingDeque< T, A >::operator= ( const RingDeque< T, A > &  other)

Copy assignment.

◆ operator=() [2/2]

template<typename T, typename A>
RingDeque< T, A > & Pothos::Util::RingDeque< T, A >::operator= ( RingDeque< T, A > &&  other)

Move assignment.

◆ operator[]() [1/2]

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

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

◆ operator[]() [2/2]

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

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

◆ pop_back()

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

Pop and element from the back of the queue.

◆ pop_front()

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

Pop and element from the front of the queue.

◆ push_back()

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

Push an element onto the back of the queue.

◆ push_front()

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

Push an element onto the front of the queue.

◆ set_capacity()

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

Set the deque capacity if too small.

◆ size()

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

How many elements are in the deque.


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