daqrate::ConcurrentQueue< T, EnqPolicy > Class Template Reference

#include <ConcurrentQueue.hh>

List of all members.

Public Types

typedef EnqPolicy::ValueType ValueType
typedef EnqPolicy::SequenceType SequenceType
typedef SequenceType::size_type SizeType

Public Member Functions

 ConcurrentQueue (SizeType maxSize=std::numeric_limits< SizeType >::max(), detail::MemoryType maxMemory=std::numeric_limits< detail::MemoryType >::max())
 ~ConcurrentQueue ()
EnqPolicy::ReturnType enqNowait (T const &item)
void enqWait (T const &p)
bool enqTimedWait (T const &p, seconds const &)
bool deqNowait (ValueType &)
void deqWait (ValueType &)
bool deqTimedWait (ValueType &, seconds const &)
bool empty () const
bool full () const
SizeType size () const
SizeType capacity () const
bool setCapacity (SizeType n)
detail::MemoryType used () const
detail::MemoryType memory () const
bool setMemory (detail::MemoryType n)
SizeType clear ()
void addExternallyDroppedEvents (SizeType)

Detailed Description

template<class T, class EnqPolicy = FailIfFull<T>>
class daqrate::ConcurrentQueue< T, EnqPolicy >

ConcurrentQueue<T> class template declaration.

Definition at line 278 of file ConcurrentQueue.hh.


Constructor & Destructor Documentation

template<class T , class EnqPolicy >
daqrate::ConcurrentQueue< T, EnqPolicy >::ConcurrentQueue ( SizeType  maxSize = std::numeric_limits<SizeType>::max(),
detail::MemoryType  maxMemory = std::numeric_limits<detail::MemoryType>::max() 
) [inline, explicit]

ConcurrentQueue is always bounded. By default, the bound is absurdly large.

Definition at line 495 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
daqrate::ConcurrentQueue< T, EnqPolicy >::~ConcurrentQueue (  )  [inline]

Applications should arrange to make sure that the destructor of a ConcurrentQueue is not called while some other thread is using that queue. There is some protection against doing this, but it seems impossible to make sufficient protection.

Definition at line 509 of file ConcurrentQueue.hh.


Member Function Documentation

template<class T , class EnqPolicy >
void daqrate::ConcurrentQueue< T, EnqPolicy >::addExternallyDroppedEvents ( SizeType  n  )  [inline]

Adds the passed count to the counter of dropped events

Definition at line 668 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::capacity (  )  const [inline]

Return the capacity of the queue, that is, the maximum number of items it can contain.

Definition at line 611 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::clear (  )  [inline]

Remove all items from the queue. This changes the size to zero but does not change the capacity. Returns the number of cleared events.

Definition at line 655 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::deqNowait ( ValueType &  item  )  [inline]

Assign the value at the head of the queue to item and then remove the head of the queue. If successful, return true; on failure, return false. This function fill fail without waiting if the queue is empty. This function may throw any exception thrown by the assignment operator of type EnqPolicy::ValueType.

Definition at line 555 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::deqTimedWait ( ValueType &  item,
seconds const &  waitTime 
) [inline]

Assign the value at the head of the queue to item and then remove the head of the queue. If the queue is empty wait until is has become non-empty or until timeDuration has passed. Return true if an item has been removed from the queue or false if the timeout has expired. This may throw any exception thrown by the assignment operator of type EnqPolicy::ValueType.

Definition at line 573 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
void daqrate::ConcurrentQueue< T, EnqPolicy >::deqWait ( ValueType &  item  )  [inline]

Assign the value of the head of the queue to item and then remove the head of the queue. If the queue is empty wait until is has become non-empty. This may throw any exception thrown by the assignment operator of type EnqPolicy::ValueType.

Definition at line 563 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::empty (  )  const [inline]

Return true if the queue is empty, and false if it is not.

Definition at line 587 of file ConcurrentQueue.hh.

template<class T, class EnqPolicy >
EnqPolicy::ReturnType daqrate::ConcurrentQueue< T, EnqPolicy >::enqNowait ( T const &  item  )  [inline]

Copying a ConcurrentQueue is illegal, as is asigning to a ConcurrentQueue. The copy constructor and copy assignment operator are both private and unimplemented. Add a copy if item to the queue, according to the rules determined by the EnqPolicy; see documentation above the the provided EnqPolicy choices. This may throw any exception thrown by the assignment operator of type T, or badAlloc.

Definition at line 520 of file ConcurrentQueue.hh.

template<class T, class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::enqTimedWait ( T const &  p,
seconds const &  waitTime 
) [inline]

Add a copy of item to the queue. If the queue is full wait until it becomes non-full or until timeDuration has passed. Return true if the items has been put onto the queue or false if the timeout has expired. This may throw any exception thrown by the assignment operator of T, or badAlloc.

Definition at line 541 of file ConcurrentQueue.hh.

template<class T, class EnqPolicy >
void daqrate::ConcurrentQueue< T, EnqPolicy >::enqWait ( T const &  p  )  [inline]

Add a copy of item to the queue. If the queue is full wait until it becomes non-full. This may throw any exception thrown by the assignment operator of type T, or badAlloc.

Definition at line 530 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::full (  )  const [inline]

Return true if the queue is full, and false if it is not.

Definition at line 595 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
detail::MemoryType daqrate::ConcurrentQueue< T, EnqPolicy >::memory (  )  const [inline]

Return the memory of the queue in bytes, that is, the maximum memory the items in the queue may occupy

Definition at line 637 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::setCapacity ( SizeType  n  )  [inline]

Reset the capacity of the queue. This can only be done if the queue is empty. This function returns false if the queue was not modified, and true if it was modified.

Definition at line 619 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
bool daqrate::ConcurrentQueue< T, EnqPolicy >::setMemory ( detail::MemoryType  n  )  [inline]

Reset the memory usage in bytes of the queue. A value of 0 disabled the memory check. This can only be done if the queue is empty. This function returns false if the queue was not modified, and true if it was modified.

Definition at line 645 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::size (  )  const [inline]

Return the size of the queue, that is, the number of items it contains.

Definition at line 603 of file ConcurrentQueue.hh.

template<class T , class EnqPolicy >
detail::MemoryType daqrate::ConcurrentQueue< T, EnqPolicy >::used (  )  const [inline]

Return the memory in bytes used by items in the queue

Definition at line 629 of file ConcurrentQueue.hh.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions

Generated on 22 Sep 2016 for artdaq_core by  doxygen 1.6.1