Discrete Dipole Approximation Project  1.0
Plugin based Discrete Dipole Approximation (DDA) software package.
Thread::Queue< T, mode > Class Template Reference

Detailed Description

template<typename T, int mode = QUEUE_ALLLOCK>
class Thread::Queue< T, mode >

Note use of locks will result in less efficent code.

#include "thread.h"

Public Member Functions

 Queue (size_t nSize)
 Constructor. More...
 
bool Pop (T &value)
 Pop a value off of the queue. More...
 
bool Push (T &value)
 Push a value on to the queue. More...
 

Constructor & Destructor Documentation

template<typename T , int mode = QUEUE_ALLLOCK>
Thread::Queue< T, mode >::Queue ( size_t  nSize)
inline

Constructs a new Queue object able to hold up to nSize values.

Parameters
nSizeSize of queue, number of items it can hold.

Member Function Documentation

template<typename T , int mode = QUEUE_ALLLOCK>
bool Thread::Queue< T, mode >::Pop ( T &  value)
inline

Can't be safely call from multiple threads if the Queue isn't QUEUE_READLOCK or QUEUE_ALLLOCK.

Returns
true on success, false if queue empty.
Parameters
[out]valuevalue poped off of the queue
template<typename T , int mode = QUEUE_ALLLOCK>
bool Thread::Queue< T, mode >::Push ( T &  value)
inline

Can't be safely call from multiple threads if the Queue isn't QUEUE_WRITELOCK or QUEUE_ALLLOCK.

Returns
true on success, false if queue full.
Parameters
[in]valuevalue to push on to the queue