This parameterized class provides a public interface which is similar in structure and intent to Queue<DATA>, with the exception that each item stored in the TimeQueue has an associated time value. Items are retrieved or exchanged by proxy of a TimeQueueItem<DATA>, and are referred to by an opaque data type TimeQueue::Handle which serves to identify an individual element on the Time Queue. Idiomatic usage of TimeQueue includes the member function popLE, which finds all items on the queue whose bsls::TimeInterval are less than a specified value and transfers those items to a provided vector of items, and the member function update, which can update the time value for a specific TimeQueueItem without removing it from the queue.

Synopsis

Declared in <bdlcc_timequeue.h>

template<class DATA>
class TimeQueue;

Types

Name

Description

Key

This type is a wrapper around a void pointer that will be supplied and used by clients to uniquely identify an item in the queue.

Type Aliases

Name

Description

Handle

Handle defines an alias for uniquely identifying a valid node in the time queue. Handles are returned when nodes are added to the time queue, and must be supplied to the update and remove methods to identify existing nodes. When a node is removed, the handle value becomes invalid, though invalidated handle values are eventually reused. See the component‐level documentation for more details.

Member Functions

Name

Description

TimeQueue [constructor]

Constructors

~TimeQueue [destructor]

Destroy this time queue.

add

add overloads

countLE

Return the number of items in this queue that have a time value less than or equal to the specified time. Note that the value returned may be obsolete by the time it is received.

isRegisteredHandle

isRegisteredHandle overloads

length

Return number of items in this queue. Note that the value returned may be obsolete by the time it is received.

minTime

Load into the specified buffer, the time value of the lowest time in this queue. Return 0 on success, and a non‐zero value if this queue is empty.

popFront

Atomically remove the top item from this queue, and optionally load into the optionally specified buffer the time and associated data of the item removed. Optionally load into the optionally specified newLength, the number of items remaining in the queue. Optionally load into the optionally specified newMinTime the new lowest time in this queue. Return 0 on success, and a non‐zero value if there are no items in the queue. Note that if DATA follows the bdema allocator model, the allocator of the buffer is used to supply memory.

popLE

popLE overloads

remove

remove overloads

removeAll

Remove all the items from this queue. Optionally specify a removedItems vector in which to load the removed items. The resultant items in the buffer are ordered by increasing time interval; items of equivalent time interval have arbitrary ordering. Note that the allocator of the removedItems vector is used to supply memory.

removeIf

Remove all the items from this queue for which predicate returns true. Optionally specify newLength, in which to load the number of items remaining in this queue. Optionally specify newMinTime, in which to load the lowest remaining time value in this queue. Optionally specify a vector of removedItems in which to load the removed items.

update

update overloads

Specializations

Name

Description

TimeQueue<function<void()>>

This parameterized class provides a public interface which is similar in structure and intent to Queue<DATA>, with the exception that each item stored in the TimeQueue has an associated time value. Items are retrieved or exchanged by proxy of a TimeQueueItem<DATA>, and are referred to by an opaque data type TimeQueue::Handle which serves to identify an individual element on the Time Queue. Idiomatic usage of TimeQueue includes the member function popLE, which finds all items on the queue whose bsls::TimeInterval are less than a specified value and transfers those items to a provided vector of items, and the member function update, which can update the time value for a specific TimeQueueItem without removing it from the queue.

Created with MrDocs