#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) |
bool | queueReaderIsReady () |
void | setReaderIsReady (bool rdy=true) |
std::chrono::steady_clock::time_point | getReadyTime () |
ConcurrentQueue<T> class template declaration.
Definition at line 280 of file ConcurrentQueue.hh.
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 516 of file ConcurrentQueue.hh.
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 532 of file ConcurrentQueue.hh.
void daqrate::ConcurrentQueue< T, EnqPolicy >::addExternallyDroppedEvents | ( | SizeType | n | ) | [inline] |
Adds the passed count to the counter of dropped events
Definition at line 702 of file ConcurrentQueue.hh.
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 645 of file ConcurrentQueue.hh.
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 689 of file ConcurrentQueue.hh.
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 584 of file ConcurrentQueue.hh.
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 604 of file ConcurrentQueue.hh.
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 594 of file ConcurrentQueue.hh.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::empty | ( | ) | const [inline] |
Return true if the queue is empty, and false if it is not.
Definition at line 621 of file ConcurrentQueue.hh.
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 545 of file ConcurrentQueue.hh.
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 567 of file ConcurrentQueue.hh.
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 556 of file ConcurrentQueue.hh.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::full | ( | ) | const [inline] |
Return true if the queue is full, and false if it is not.
Definition at line 629 of file ConcurrentQueue.hh.
std::chrono::steady_clock::time_point daqrate::ConcurrentQueue< T, EnqPolicy >::getReadyTime | ( | ) | [inline] |
Gets the time at which the ready became ready
Definition at line 437 of file ConcurrentQueue.hh.
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 671 of file ConcurrentQueue.hh.
bool daqrate::ConcurrentQueue< T, EnqPolicy >::queueReaderIsReady | ( | ) | [inline] |
Indicate that the receiver is connected
Definition at line 424 of file ConcurrentQueue.hh.
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 653 of file ConcurrentQueue.hh.
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 679 of file ConcurrentQueue.hh.
void daqrate::ConcurrentQueue< T, EnqPolicy >::setReaderIsReady | ( | bool | rdy = true |
) | [inline] |
Set Reader Ready
Definition at line 429 of file ConcurrentQueue.hh.
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 637 of file ConcurrentQueue.hh.
detail::MemoryType daqrate::ConcurrentQueue< T, EnqPolicy >::used | ( | ) | const [inline] |
Return the memory in bytes used by items in the queue
Definition at line 663 of file ConcurrentQueue.hh.