Equalizer 1.0

co::base::MTQueue< T > Class Template Reference

A thread-safe queue with a blocking read access. More...

#include <mtQueue.h>

Collaboration diagram for co::base::MTQueue< T >:

List of all members.

Public Member Functions

 MTQueue ()
 Construct a new queue.
 MTQueue (const MTQueue< T > &from)
 Construct a copy of a queue.
 ~MTQueue ()
 Destruct this Queue.
MTQueue< T > & operator= (const MTQueue< T > &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 tryPop (T &result)
 Retrieve and pop the front element from the queue if it is not empty.
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.

Detailed Description

template<typename T>
class co::base::MTQueue< T >

A thread-safe queue with a blocking read access.

Typically used to communicate between two execution threads.

Definition at line 36 of file mtQueue.h.


Constructor & Destructor Documentation

template<typename T>
co::base::MTQueue< T >::MTQueue ( ) [inline]

Construct a new queue.

Version:
1.0

Definition at line 40 of file mtQueue.h.

template<typename T>
co::base::MTQueue< T >::MTQueue ( const MTQueue< T > &  from) [inline]

Construct a copy of a queue.

Version:
1.0

Definition at line 43 of file mtQueue.h.

template<typename T>
co::base::MTQueue< T >::~MTQueue ( ) [inline]

Destruct this Queue.

Version:
1.0

Definition at line 46 of file mtQueue.h.


Member Function Documentation

template<typename T>
void co::base::MTQueue< T >::clear ( ) [inline]

Reset (empty) the queue.

Version:
1.0

Definition at line 81 of file mtQueue.h.

template<typename T>
bool co::base::MTQueue< T >::getBack ( T &  result) const [inline]
Parameters:
resultthe last value or unmodified.
Returns:
true if an element was placed in result, false if the queue is empty.
Version:
1.0

Definition at line 154 of file mtQueue.h.

template<typename T>
bool co::base::MTQueue< T >::getFront ( T &  result) const [inline]
Parameters:
resultthe front value or unmodified.
Returns:
true if an element was placed in result, false if the queue is empty.
Version:
1.0

Definition at line 134 of file mtQueue.h.

template<typename T>
size_t co::base::MTQueue< T >::getSize ( ) const [inline]
Returns:
the number of items currently in the queue.
Version:
1.0

Definition at line 62 of file mtQueue.h.

Referenced by co::CommandQueue::getSize().

Here is the caller graph for this function:

template<typename T>
bool co::base::MTQueue< T >::isEmpty ( ) const [inline]
Returns:
true if the queue is empty, false otherwise.
Version:
1.0

Definition at line 59 of file mtQueue.h.

Referenced by co::CommandQueue::isEmpty().

Here is the caller graph for this function:

template<typename T>
MTQueue< T >& co::base::MTQueue< T >::operator= ( const MTQueue< T > &  from) [inline]

Assign the values of another queue.

Version:
1.0

Definition at line 49 of file mtQueue.h.

template<typename T>
T co::base::MTQueue< T >::pop ( ) [inline]

Retrieve and pop the front element from the queue, may block.

Version:
1.0

Definition at line 92 of file mtQueue.h.

template<typename T>
void co::base::MTQueue< T >::push ( const std::vector< T > &  elements) [inline]

Push a vector of elements to the back of the queue.

Version:
1.0

Definition at line 178 of file mtQueue.h.

template<typename T>
void co::base::MTQueue< T >::push ( const T &  element) [inline]

Push a new element to the back of the queue.

Version:
1.0

Definition at line 169 of file mtQueue.h.

Referenced by co::CommandQueue::wakeup().

Here is the caller graph for this function:

template<typename T>
void co::base::MTQueue< T >::pushFront ( const std::vector< T > &  elements) [inline]

Push a vector of elements to the front of the queue.

Version:
1.0

Definition at line 196 of file mtQueue.h.

template<typename T>
void co::base::MTQueue< T >::pushFront ( const T &  element) [inline]

Push a new element to the front of the queue.

Version:
1.0

Definition at line 187 of file mtQueue.h.

template<typename T>
bool co::base::MTQueue< T >::tryPop ( T &  result) [inline]

Retrieve and pop the front element from the queue if it is not empty.

Parameters:
resultthe front value or unmodified.
Returns:
true if an element was placed in result, false if the queue is empty.
Version:
1.0

Definition at line 113 of file mtQueue.h.

template<typename T>
size_t co::base::MTQueue< T >::waitSize ( const size_t  minSize) const [inline]

Wait for the size to be at least the number of given elements.

Returns:
the current size when the condition was fulfilled.
Version:
1.0

Definition at line 70 of file mtQueue.h.


The documentation for this class was generated from the following file:
Generated on Sun May 8 2011 19:11:09 for Equalizer 1.0 by  doxygen 1.7.3