#include <ExpirableQueue.h>
Public Types | |
typedef Policy | PolicyType |
typedef ConcurrentQueue< T, Policy >::SizeType | SizeType |
typedef Policy::ValueType | ValueType |
Public Member Functions | |
SizeType | clear () |
bool | clearIfStale (const utils::TimePoint_t &, SizeType &clearedEvents) |
bool | deqNowait (ValueType &) |
bool | empty () const |
SizeType | enqNowait (T const &, const utils::TimePoint_t &now=utils::getCurrentTime()) |
ExpirableQueue (SizeType maxsize=std::numeric_limits< SizeType >::max(), utils::Duration_t stalenessInterval=boost::posix_time::seconds(120), utils::TimePoint_t now=utils::getCurrentTime()) | |
bool | full () const |
void | setStalenessInterval (const utils::Duration_t &) |
SizeType | size () const |
bool | stale (const utils::TimePoint_t &) const |
utils::Duration_t | stalenessInterval () const |
Private Types | |
typedef ConcurrentQueue< T, Policy > | queue_t |
Private Member Functions | |
ExpirableQueue (ExpirableQueue &) | |
ExpirableQueue & | operator= (ExpirableQueue &) |
Private Attributes | |
queue_t | events_ |
utils::Duration_t | stalenessInterval_ |
utils::TimePoint_t | stalenessTime_ |
Class template ExpirableQueue encapsulates a Queue (held through a shared_ptr, for inexpensive copying) and timing information. It keeps track of when the most recent called to deq was made.
Definition at line 27 of file ExpirableQueue.h.
typedef Policy stor::ExpirableQueue< T, Policy >::PolicyType |
Definition at line 30 of file ExpirableQueue.h.
|
private |
Definition at line 111 of file ExpirableQueue.h.
typedef ConcurrentQueue<T, Policy>::SizeType stor::ExpirableQueue< T, Policy >::SizeType |
Definition at line 31 of file ExpirableQueue.h.
typedef Policy::ValueType stor::ExpirableQueue< T, Policy >::ValueType |
Definition at line 32 of file ExpirableQueue.h.
|
explicit |
Create an ExpirableQueue with the given maximum size and given "time to stale", specified in seconds.
Definition at line 130 of file ExpirableQueue.h.
|
private |
|
inline |
Clear the queue. Return the number of elements removed.
Definition at line 180 of file ExpirableQueue.h.
Referenced by python.Vispa.Views.WidgetView.WidgetView::closeEvent(), python.Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), python.Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), python.Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), python.Vispa.Views.WidgetView.WidgetView::setDataObjects(), python.Vispa.Views.TreeView.TreeView::updateContent(), python.Vispa.Views.TableView.TableView::updateContent(), python.Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and python.Vispa.Views.PropertyView.PropertyView::updateContent().
|
inline |
Return true if the queue is stale, and false if it is not. The queue is stale if its stalenessTime is before the given time. If the queue is stale, we also clear it and return the number of cleared events.
Definition at line 221 of file ExpirableQueue.h.
bool stor::ExpirableQueue< T, Policy >::deqNowait | ( | ValueType & | event | ) |
Try to remove an event from the queue, without blocking. If an event is available, return 'true' and set the output argument 'event'. If no event is available, return 'false'. In either case, update the staleness time to reflect this attempt to get an event.
Definition at line 143 of file ExpirableQueue.h.
References stor::utils::getCurrentTime().
|
inline |
Return true if the queue is empty, and false otherwise.
Definition at line 188 of file ExpirableQueue.h.
Referenced by python.Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and python.Vispa.Gui.VispaWidget.TextField::setAutotruncate().
ExpirableQueue< T, Policy >::SizeType stor::ExpirableQueue< T, Policy >::enqNowait | ( | T const & | event, |
const utils::TimePoint_t & | now = utils::getCurrentTime() |
||
) |
Put an event onto the queue, if the queue is not stale at the given time. It respects the Policy of this queue that controls what is done in the case of a full queue. This does not affect the staleness time of this queue. Returns the number of dropped events.
Definition at line 151 of file ExpirableQueue.h.
|
inline |
Return true if the queue is full, and false otherwise.
Definition at line 204 of file ExpirableQueue.h.
|
private |
|
inline |
Set the staleness interval.
Definition at line 164 of file ExpirableQueue.h.
References matplotRender::t.
|
inline |
|
inline |
Return true if the queue is stale at the given time, and false otherwise.
Definition at line 212 of file ExpirableQueue.h.
|
inline |
Get the staleness interval.
Definition at line 172 of file ExpirableQueue.h.
|
private |
Definition at line 113 of file ExpirableQueue.h.
|
private |
Time in seconds it takes for this queue to become stale.
Definition at line 115 of file ExpirableQueue.h.
|
private |
Point in time at which this queue will become stale.
Definition at line 117 of file ExpirableQueue.h.