HLR  0.0.1
Public Member Functions | List of all members
HLR::Kinematics::ConcurrentQueue< T > Class Template Reference

A thread safe queue that supports both synchronous pop and asynchronous pop. It's not allowed to use pop and async_pop together. More...

#include <ConcurrentQueue.hpp>

Inheritance diagram for HLR::Kinematics::ConcurrentQueue< T >:
Collaboration diagram for HLR::Kinematics::ConcurrentQueue< T >:

Public Member Functions

void push (const T &element)
 Pushes element into the queue. More...
 
void push (T &&element)
 Pushes element into the queue. More...
 
pop ()
 Remove the oldest element from the queue. Blocks if no element is available. More...
 
void async_pop (const std::function< void(const T &)> &handler)
 Asynchronously pop an element from the queue. More...
 
bool empty () const
 Check whether the queue is empty. More...
 
std::size_t size () const
 Return how many elements are currently in the queue. More...
 

Detailed Description

template<class T>
class HLR::Kinematics::ConcurrentQueue< T >

A thread safe queue that supports both synchronous pop and asynchronous pop. It's not allowed to use pop and async_pop together.

Template Parameters
TThe type to be placed in the queue.

Member Function Documentation

template<class T>
void HLR::Kinematics::ConcurrentQueue< T >::async_pop ( const std::function< void(const T &)> &  handler)

Asynchronously pop an element from the queue.

Parameters
handlerhandler The function that will be called when the element is popped.
template<class T>
bool HLR::Kinematics::ConcurrentQueue< T >::empty ( ) const

Check whether the queue is empty.

Returns
true If empty.
false If not empty.
template<class T>
T HLR::Kinematics::ConcurrentQueue< T >::pop ( )

Remove the oldest element from the queue. Blocks if no element is available.

Returns
The removed element.
template<class T>
void HLR::Kinematics::ConcurrentQueue< T >::push ( const T &  element)

Pushes element into the queue.

Parameters
elementThe element to insert.
template<class T>
void HLR::Kinematics::ConcurrentQueue< T >::push ( T &&  element)

Pushes element into the queue.

Parameters
elementThe element to insert.
template<class T>
std::size_t HLR::Kinematics::ConcurrentQueue< T >::size ( ) const

Return how many elements are currently in the queue.

Returns
The amount of elements in the queue

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