#include <ConcurrentQueue.hh>
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) |
ConcurrentQueue<T> class template declaration.
Definition at line 278 of file ConcurrentQueue.hh.
|
explicit |
ConcurrentQueue is always bounded. By default, the bound is absurdly large.
Definition at line 495 of file ConcurrentQueue.hh.
daqrate::ConcurrentQueue< T, EnqPolicy >::~ConcurrentQueue | ( | ) |
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.
void daqrate::ConcurrentQueue< T, EnqPolicy >::addExternallyDroppedEvents | ( | SizeType | n | ) |
Adds the passed count to the counter of dropped events
Definition at line 668 of file ConcurrentQueue.hh.
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::capacity | ( | ) | const |
Return the capacity of the queue, that is, the maximum number of items it can contain.
Definition at line 611 of file ConcurrentQueue.hh.
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::clear | ( | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::deqNowait | ( | ValueType & | item | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::deqTimedWait | ( | ValueType & | item, |
seconds const & | waitTime | ||
) |
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.
void daqrate::ConcurrentQueue< T, EnqPolicy >::deqWait | ( | ValueType & | item | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::empty | ( | ) | const |
Return true if the queue is empty, and false if it is not.
Definition at line 587 of file ConcurrentQueue.hh.
EnqPolicy::ReturnType daqrate::ConcurrentQueue< T, EnqPolicy >::enqNowait | ( | T const & | item | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::enqTimedWait | ( | T const & | p, |
seconds const & | waitTime | ||
) |
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.
void daqrate::ConcurrentQueue< T, EnqPolicy >::enqWait | ( | T const & | p | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::full | ( | ) | const |
Return true if the queue is full, and false if it is not.
Definition at line 595 of file ConcurrentQueue.hh.
detail::MemoryType daqrate::ConcurrentQueue< T, EnqPolicy >::memory | ( | ) | const |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::setCapacity | ( | SizeType | n | ) |
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.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::setMemory | ( | detail::MemoryType | n | ) |
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.
ConcurrentQueue< T, EnqPolicy >::SizeType daqrate::ConcurrentQueue< T, EnqPolicy >::size | ( | ) | const |
Return the size of the queue, that is, the number of items it contains.
Definition at line 603 of file ConcurrentQueue.hh.
detail::MemoryType daqrate::ConcurrentQueue< T, EnqPolicy >::used | ( | ) | const |
Return the memory in bytes used by items in the queue
Definition at line 629 of file ConcurrentQueue.hh.