#include <ConcurrentQueue.h>
Public Types | |
typedef EnqPolicy::SequenceType | SequenceType |
typedef SequenceType::size_type | SizeType |
typedef EnqPolicy::ValueType | ValueType |
Public Member Functions | |
void | addExternallyDroppedEvents (SizeType) |
SizeType | capacity () const |
SizeType | clear () |
ConcurrentQueue (SizeType maxSize=std::numeric_limits< SizeType >::max(), detail::MemoryType maxMemory=std::numeric_limits< detail::MemoryType >::max()) | |
bool | deqNowait (ValueType &) |
bool | deqTimedWait (ValueType &, boost::posix_time::time_duration const &) |
void | deqWait (ValueType &) |
bool | empty () const |
EnqPolicy::ReturnType | enqNowait (T const &item) |
bool | enqTimedWait (T const &p, boost::posix_time::time_duration const &) |
void | enqWait (T const &p) |
bool | full () const |
detail::MemoryType | memory () const |
bool | setCapacity (SizeType n) |
bool | setMemory (detail::MemoryType n) |
SizeType | size () const |
detail::MemoryType | used () const |
~ConcurrentQueue () | |
Private Types | |
typedef boost::mutex::scoped_lock | LockType |
Private Member Functions | |
void | assignItem (T &item, const T &element) |
void | assignItem (std::pair< T, size_t > &item, const T &element) |
ConcurrentQueue (ConcurrentQueue< T, EnqPolicy > const &) | |
bool | insertIfPossible (T const &item) |
bool | isFull () const |
ConcurrentQueue & | operator= (ConcurrentQueue< T, EnqPolicy > const &) |
void | removeHead (ValueType &item) |
bool | removeHeadIfPossible (ValueType &item) |
Private Attributes | |
SizeType | capacity_ |
SequenceType | elements_ |
size_t | elementsDropped_ |
detail::MemoryType | memory_ |
boost::mutex | protectElements_ |
boost::condition | queueNotEmpty_ |
boost::condition | queueNotFull_ |
SizeType | size_ |
detail::MemoryType | used_ |
ConcurrentQueue<T> class template declaration.
Definition at line 288 of file ConcurrentQueue.h.
|
private |
Definition at line 432 of file ConcurrentQueue.h.
typedef EnqPolicy::SequenceType stor::ConcurrentQueue< T, EnqPolicy >::SequenceType |
Definition at line 292 of file ConcurrentQueue.h.
typedef SequenceType::size_type stor::ConcurrentQueue< T, EnqPolicy >::SizeType |
Definition at line 293 of file ConcurrentQueue.h.
typedef EnqPolicy::ValueType stor::ConcurrentQueue< T, EnqPolicy >::ValueType |
Definition at line 291 of file ConcurrentQueue.h.
|
explicit |
ConcurrentQueue is always bounded. By default, the bound is absurdly large.
Definition at line 505 of file ConcurrentQueue.h.
stor::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 519 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
|
private |
void stor::ConcurrentQueue< T, EnqPolicy >::addExternallyDroppedEvents | ( | SizeType | n | ) |
Adds the passed count to the counter of dropped events
Definition at line 680 of file ConcurrentQueue.h.
References CommonMethods::lock(), and n.
|
private |
Definition at line 734 of file ConcurrentQueue.h.
|
private |
Definition at line 741 of file ConcurrentQueue.h.
ConcurrentQueue< T, EnqPolicy >::SizeType stor::ConcurrentQueue< T, EnqPolicy >::capacity | ( | ) | const |
Return the capacity of the queue, that is, the maximum number of items it can contain.
Definition at line 623 of file ConcurrentQueue.h.
ConcurrentQueue< T, EnqPolicy >::SizeType stor::ConcurrentQueue< T, EnqPolicy >::clear | ( | void | ) |
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 667 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().
bool stor::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 566 of file ConcurrentQueue.h.
References CommonMethods::lock().
bool stor::ConcurrentQueue< T, EnqPolicy >::deqTimedWait | ( | ValueType & | item, |
boost::posix_time::time_duration 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 584 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
void stor::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 574 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
bool stor::ConcurrentQueue< T, EnqPolicy >::empty | ( | void | ) | const |
Return true if the queue is empty, and false if it is not.
Definition at line 599 of file ConcurrentQueue.h.
References edm::size_().
Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().
EnqPolicy::ReturnType stor::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 530 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
bool stor::ConcurrentQueue< T, EnqPolicy >::enqTimedWait | ( | T const & | p, |
boost::posix_time::time_duration 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 551 of file ConcurrentQueue.h.
References CommonMethods::lock().
void stor::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 540 of file ConcurrentQueue.h.
References CommonMethods::lock(), stor::detail::memoryUsage(), and edm::size_().
bool stor::ConcurrentQueue< T, EnqPolicy >::full | ( | ) | const |
Return true if the queue is full, and false if it is not.
Definition at line 607 of file ConcurrentQueue.h.
References CommonMethods::lock().
|
private |
Definition at line 692 of file ConcurrentQueue.h.
References stor::detail::memoryUsage(), and edm::size_().
|
private |
detail::MemoryType stor::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 649 of file ConcurrentQueue.h.
|
private |
|
private |
Definition at line 719 of file ConcurrentQueue.h.
References stor::detail::memoryUsage(), and edm::size_().
|
private |
bool stor::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 631 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
bool stor::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 657 of file ConcurrentQueue.h.
References CommonMethods::lock(), and edm::size_().
ConcurrentQueue< T, EnqPolicy >::SizeType stor::ConcurrentQueue< T, EnqPolicy >::size | ( | void | ) | const |
Return the size of the queue, that is, the number of items it contains.
Definition at line 615 of file ConcurrentQueue.h.
References edm::size_().
detail::MemoryType stor::ConcurrentQueue< T, EnqPolicy >::used | ( | ) | const |
Return the memory in bytes used by items in the queue
Definition at line 641 of file ConcurrentQueue.h.
|
private |
Definition at line 439 of file ConcurrentQueue.h.
|
private |
Definition at line 438 of file ConcurrentQueue.h.
|
private |
Definition at line 450 of file ConcurrentQueue.h.
|
private |
Definition at line 448 of file ConcurrentQueue.h.
|
mutableprivate |
Definition at line 434 of file ConcurrentQueue.h.
|
mutableprivate |
Definition at line 435 of file ConcurrentQueue.h.
|
mutableprivate |
Definition at line 436 of file ConcurrentQueue.h.
|
private |
Definition at line 440 of file ConcurrentQueue.h.
|
private |
Definition at line 449 of file ConcurrentQueue.h.