fesa-core  4.3.1
fesa::ConcurrentQueue< T > Class Template Reference

#include <ConcurrentQueue.h>

Inherits noncopyable.

Public Member Functions

 ConcurrentQueue (const std::string &name, std::size_t maxSize)
 
void push (const T &item)
 
pop ()
 blocking call to retrieve the first item of the queue. This method will block if the queue is empty. More...
 
void clear ()
 Removes every element in the queue.
 
std::size_t size () const
 

Detailed Description

template<typename T>
class fesa::ConcurrentQueue< T >

This class offers a thread-safe queue. Several consumers can be waiting at the same time on an item; the one with the highest priority will be woken up first.

Template Parameters
Tthe type of items to store in the queue

Constructor & Destructor Documentation

template<typename T >
fesa::ConcurrentQueue< T >::ConcurrentQueue ( const std::string &  name,
std::size_t  maxSize 
)

Instantiates a ConcurrentQueue object.

Parameters
namea name to identify this queue
maxSizemaximum size of the queue. Memory is pre-allocated.

Member Function Documentation

template<typename T >
T fesa::ConcurrentQueue< T >::pop ( )

blocking call to retrieve the first item of the queue. This method will block if the queue is empty.

Returns
the first item of the queue.
template<typename T>
void fesa::ConcurrentQueue< T >::push ( const T &  item)

Adds an item to the end of the queue.

Parameters
itemthe item to add to the queue
Exceptions
FesaExceptionwith error code FesaErrorQueueFull if the queue is full when trying to add the item
template<typename T >
std::size_t fesa::ConcurrentQueue< T >::size ( ) const
Returns
the current size of the queue.

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