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

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

#include <mtQueue.h>

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
void clear ()
 Reset (empty) the queue.
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.

Detailed Description

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

A thread-safe queue with a blocking read access.

Typically used to communicate between two execution threads.

To instantiate the template code for this class, applications have to include pthread.h before this file. pthread.h is not automatically included to avoid hard to resolve type conflicts with other header files on Windows.

Definition at line 43 of file mtQueue.h.


Constructor & Destructor Documentation

template<typename T>
eq::base::MTQueue< T >::MTQueue (  ) 

Construct a new queue.

Version:
1.0
template<typename T>
eq::base::MTQueue< T >::MTQueue ( const MTQueue< T > &  from  ) 

Construct a copy of a queue.

Version:
1.0
template<typename T>
eq::base::MTQueue< T >::~MTQueue (  ) 

Destruct this Queue.

Version:
1.0

Member Function Documentation

template<typename T>
MTQueue< T >& eq::base::MTQueue< T >::operator= ( const MTQueue< T > &  from  ) 

Assign the values of another queue.

Version:
1.0
template<typename T>
bool eq::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 eq::net::VersionedSlaveCM::addInstanceDatas(), eq::net::CommandQueue::isEmpty(), eq::net::RSPConnection::readSync(), eq::Node::TransmitThread::run(), and eq::net::RSPConnection::write().

Here is the caller graph for this function:

template<typename T>
size_t eq::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 eq::net::CommandQueue::getSize().

Here is the caller graph for this function:

template<typename T>
void eq::base::MTQueue< T >::clear (  ) 

Reset (empty) the queue.

Version:
1.0

Referenced by eq::net::RSPConnection::close(), and eq::net::RSPConnection::listen().

Here is the caller graph for this function:

template<typename T>
T eq::base::MTQueue< T >::pop (  ) 

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

Version:
1.0

Referenced by eq::net::VersionedSlaveCM::applyMapData(), eq::net::CommandQueue::pop(), eq::net::RSPConnection::readSync(), eq::Node::TransmitThread::run(), eq::net::VersionedSlaveCM::sync(), and eq::net::RSPConnection::write().

Here is the caller graph for this function:

template<typename T>
bool eq::base::MTQueue< T >::tryPop ( T &  result  ) 

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

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

Referenced by eq::net::CommandQueue::flush(), and eq::net::CommandQueue::tryPop().

Here is the caller graph for this function:

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

Referenced by eq::net::VersionedSlaveCM::addInstanceDatas().

Here is the caller graph for this function:

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

Referenced by eq::net::VersionedSlaveCM::addInstanceDatas(), and eq::net::VersionedSlaveCM::getHeadVersion().

Here is the caller graph for this function:

template<typename T>
void eq::base::MTQueue< T >::push ( const T &  element  ) 

Push a new element to the back of the queue.

Version:
1.0

Referenced by eq::net::VersionedSlaveCM::addInstanceDatas(), eq::net::RSPConnection::close(), eq::net::RSPConnection::listen(), eq::net::CommandQueue::push(), and eq::net::CommandQueue::wakeup().

Here is the caller graph for this function:

template<typename T>
void eq::base::MTQueue< T >::push ( const std::vector< T > &  elements  ) 

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

Version:
1.0
template<typename T>
void eq::base::MTQueue< T >::pushFront ( const T &  element  ) 

Push a new element to the front of the queue.

Version:
1.0

Referenced by eq::net::VersionedSlaveCM::addInstanceDatas(), and eq::net::CommandQueue::pushFront().

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
Generated on Sat Feb 6 13:08:13 2010 for Equalizer 0.9.1 by  doxygen 1.6.1