Equalizer
1.2.1
|
A thread-safe queue with a blocking read access. More...
#include <mtQueue.h>
Public Member Functions | |
MTQueue () | |
Construct a new queue. | |
MTQueue (const MTQueue< T, S > &from) | |
Construct a copy of a queue. | |
~MTQueue () | |
Destruct this Queue. | |
MTQueue< T, S > & | operator= (const MTQueue< T, S > &from) |
Assign the values of another queue. | |
bool | isEmpty () const |
size_t | getSize () const |
size_t | waitSize (const size_t minSize) const |
Wait for the size to be at least the number of given elements. | |
void | clear () |
Reset (empty) the queue. | |
T | pop () |
Retrieve and pop the front element from the queue, may block. | |
bool | timedPop (const unsigned timeout, T &element) |
Retrieve and pop the front element from the queue. | |
bool | tryPop (T &result) |
Retrieve and pop the front element from the queue if it is not empty. | |
void | tryPop (const size_t num, std::vector< T > &result) |
Try to retrieve a number of items for the front of the queue. | |
bool | getFront (T &result) const |
bool | getBack (T &result) const |
void | push (const T &element) |
Push a new element to the back of the queue. | |
void | push (const std::vector< T > &elements) |
Push a vector of elements to the back of the queue. | |
void | pushFront (const T &element) |
Push a new element to the front of the queue. | |
void | pushFront (const std::vector< T > &elements) |
Push a vector of elements to the front of the queue. |
A thread-safe queue with a blocking read access.
Typically used to communicate between two execution threads.
S defines the maximum capacity of the Queue<T>. When the capacity is reached, pushing new values blocks until items have been consumed.
co::base::MTQueue< T, S >::MTQueue | ( | ) | [inline] |
co::base::MTQueue< T, S >::MTQueue | ( | const MTQueue< T, S > & | from | ) | [inline] |
co::base::MTQueue< T, S >::~MTQueue | ( | ) | [inline] |
void co::base::MTQueue< T, S >::clear | ( | ) | [inline] |
bool co::base::MTQueue< T, S >::getBack | ( | T & | result | ) | const [inline] |
bool co::base::MTQueue< T, S >::getFront | ( | T & | result | ) | const [inline] |
size_t co::base::MTQueue< T, S >::getSize | ( | ) | const [inline] |
Definition at line 69 of file mtQueue.h.
Referenced by co::CommandQueue::getSize().
bool co::base::MTQueue< T, S >::isEmpty | ( | ) | const [inline] |
Definition at line 66 of file mtQueue.h.
Referenced by co::CommandQueue::isEmpty().
MTQueue< T, S >& co::base::MTQueue< T, S >::operator= | ( | const MTQueue< T, S > & | from | ) | [inline] |
T co::base::MTQueue< T, S >::pop | ( | ) | [inline] |
void co::base::MTQueue< T, S >::push | ( | const T & | element | ) | [inline] |
Push a new element to the back of the queue.
Definition at line 236 of file mtQueue.h.
Referenced by co::CommandQueue::wakeup().
void co::base::MTQueue< T, S >::push | ( | const std::vector< T > & | elements | ) | [inline] |
void co::base::MTQueue< T, S >::pushFront | ( | const T & | element | ) | [inline] |
void co::base::MTQueue< T, S >::pushFront | ( | const std::vector< T > & | elements | ) | [inline] |
bool co::base::MTQueue< T, S >::timedPop | ( | const unsigned | timeout, |
T & | element | ||
) | [inline] |
bool co::base::MTQueue< T, S >::tryPop | ( | T & | result | ) | [inline] |
void co::base::MTQueue< T, S >::tryPop | ( | const size_t | num, |
std::vector< T > & | result | ||
) | [inline] |
Try to retrieve a number of items for the front of the queue.
Between zero and the given number of items are appended to the vector.
num | the maximum number of items to retrieve |
result | the front value or unmodified. |
size_t co::base::MTQueue< T, S >::waitSize | ( | const size_t | minSize | ) | const [inline] |