Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes

threadsafe_queue< T > Class Template Reference
[Threadsafe Collection API]

#include <threadsafe_queue.h>

Collaboration diagram for threadsafe_queue< T >:
Collaboration graph
[legend]

List of all members.

Classes

struct  iterator_t
struct  real_iter_t

Public Member Functions

void push_back (T &t)
 push an element onto the back of the queue
bool pop_front (T &t)
 pop an element from the front of the queue.
int size (void) const throw ()
 returns the number of elements in the queue
void getIterator (iterator_t &i) const throw ()
 resets the given iterator to point to the beginning of the queue
bool getNextElement (iterator_t &i, T &t) const
 gets element pointed to by iterator, and increments iterator

Static Public Member Functions

static int getRealIteratorSize (void) throw ()
 for debugging/validation only

Private Types

typedef std::deque< T >::iterator iterator
typedef threadsafe_queue< T > queue_t

Private Member Functions

queue_tgetNonConst (void) const throw ()

Static Private Member Functions

static real_iter_tgetRealIter (iterator_t &i) throw ()

Private Attributes

smart_mutex m_mutex
std::deque< T > m_queue
dword_t m_rvn

Detailed Description

template<class T>
class threadsafe_queue< T >

A threadsafe FIFO queue. Supports basic push/pop operations, and iteration.

Definition at line 49 of file threadsafe_queue.h.


Member Typedef Documentation

template<class T>
typedef std::deque<T>::iterator threadsafe_queue< T >::iterator [private]

Definition at line 52 of file threadsafe_queue.h.

template<class T>
typedef threadsafe_queue<T> threadsafe_queue< T >::queue_t [private]

Definition at line 53 of file threadsafe_queue.h.


Member Function Documentation

template<class T>
void threadsafe_queue< T >::push_back ( T &  t  )  [inline]

push an element onto the back of the queue

Definition at line 67 of file threadsafe_queue.h.

template<class T>
bool threadsafe_queue< T >::pop_front ( T &  t  )  [inline]

pop an element from the front of the queue.

Returns false if the queue is empty

Definition at line 75 of file threadsafe_queue.h.

template<class T>
int threadsafe_queue< T >::size ( void   )  const throw () [inline]

returns the number of elements in the queue

Definition at line 88 of file threadsafe_queue.h.

template<class T>
void threadsafe_queue< T >::getIterator ( iterator_t i  )  const throw () [inline]

resets the given iterator to point to the beginning of the queue

Definition at line 95 of file threadsafe_queue.h.

template<class T>
bool threadsafe_queue< T >::getNextElement ( iterator_t i,
T &  t 
) const [inline]

gets element pointed to by iterator, and increments iterator

Definition at line 104 of file threadsafe_queue.h.

template<class T>
static int threadsafe_queue< T >::getRealIteratorSize ( void   )  throw () [inline, static]

for debugging/validation only

Definition at line 122 of file threadsafe_queue.h.

template<class T>
static real_iter_t* threadsafe_queue< T >::getRealIter ( iterator_t i  )  throw () [inline, static, private]

Definition at line 128 of file threadsafe_queue.h.

template<class T>
queue_t* threadsafe_queue< T >::getNonConst ( void   )  const throw () [inline, private]

Definition at line 135 of file threadsafe_queue.h.


Member Data Documentation

template<class T>
smart_mutex threadsafe_queue< T >::m_mutex [private]

Definition at line 140 of file threadsafe_queue.h.

template<class T>
std::deque<T> threadsafe_queue< T >::m_queue [private]

Definition at line 141 of file threadsafe_queue.h.

template<class T>
dword_t threadsafe_queue< T >::m_rvn [private]

Definition at line 142 of file threadsafe_queue.h.


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