[#BloombergLP-bdlcc-Queue] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlcc.adoc[bdlcc]::Queue :relfileprefix: ../../ :mrdocs: This class provides a thread‐enabled implementation of an efficient, in‐place, indexable, double‐ended queue of parameterized `TYPE` values. Very efficient access to the underlying `bdlc::Queue` object is provided, as well as to a `bslmt::Mutex` and a `bslmt::Condition` variable, to facilitate thread‐safe use of the `bdlc::Queue`. Note that `Queue` is not a value‐semantic type, but the underlying `bdlc::Queue` is. In this regard, `Queue` is a thread‐enabled handle for a `bdlc::Queue`. == Synopsis Declared in `<bdlcc_queue.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class Queue; ---- == Types [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/Queue/InitialCapacity.adoc[`InitialCapacity`] | Enable uniform use of an optional integral constructor argument to specify the initial internal capacity (in items). For example, ` const Queue<int>::InitialCapacity NUM_ITEMS(8)); Queue<int> x(NUM_ITEMS); ` defines an instance `x` with an initial capacity of 8 items, but with a logical length of 0 items. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/Queue/2constructor-07.adoc[`Queue`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlcc/Queue/2destructor.adoc[`~Queue`] [.small]#[destructor]# | Destroy this container. The behavior is undefined unless all access or modification of the container has completed prior to this call. | xref:BloombergLP/bdlcc/Queue/condition.adoc[`condition`] | Return a reference to the modifiable condition variable used by this queue to signal that the queue is not empty. | xref:BloombergLP/bdlcc/Queue/forcePushFront.adoc[`forcePushFront`] | Append the specified `item` to the front of this queue without regard for the high‐water mark. Note that this method is provided to allow high priority items to be inserted when the queue is full (i.e., has a number of items greater than or equal to its high‐water mark); `pushFront` and `pushBack` should be used for general use. | xref:BloombergLP/bdlcc/Queue/highWaterMark.adoc[`highWaterMark`] | Return the high‐water mark value for this queue. Note that a negative value indicates no suggested‐maximum capacity, and is not necessarily the same negative value that was passed to the constructor. | xref:BloombergLP/bdlcc/Queue/insertCondition.adoc[`insertCondition`] | Return a reference to the modifiable condition variable used by this queue to signal that the queue is not full (i.e., has fewer items than its high‐water mark). | xref:BloombergLP/bdlcc/Queue/length.adoc[`length`] | Return the number of elements in this queue. Note that if other threads are manipulating the queue, this information may be obsolete by the time it is returned. | xref:BloombergLP/bdlcc/Queue/mutex.adoc[`mutex`] | Return a reference to the modifiable mutex used by this queue to synchronize access to its underlying `bdlc::Queue` object. | xref:BloombergLP/bdlcc/Queue/notEmptyCondition.adoc[`notEmptyCondition`] | Return the condition variable used by this queue to signal that the queue is not empty. | xref:BloombergLP/bdlcc/Queue/notFullCondition.adoc[`notFullCondition`] | Return the condition variable used by this queue to signal that the queue is not full (i.e., has fewer items than its high‐water mark). | xref:BloombergLP/bdlcc/Queue/popBack-0a.adoc[`popBack`] | `popBack` overloads | xref:BloombergLP/bdlcc/Queue/popFront-08.adoc[`popFront`] | `popFront` overloads | xref:BloombergLP/bdlcc/Queue/pushBack.adoc[`pushBack`] | Append the specified `item` to the back of this queue. If the high‐water mark is non‐negative and the number of items in this queue is greater than or equal to the high‐water mark, then block until the number of items in this queue is less than the high‐water mark. | xref:BloombergLP/bdlcc/Queue/pushFront.adoc[`pushFront`] | Append the specified `item` to the front of this queue. If the high‐water mark is non‐negative and the number of items in this queue is greater than or equal to the high‐water mark, then block until the number of items in this queue is less than the high‐water mark. | xref:BloombergLP/bdlcc/Queue/queue.adoc[`queue`] | Return a reference to the modifiable underlying `bdlc::Queue` object used by this queue. Any access to the returned queue MUST first lock the associated mutex object (see the `mutex` method) in a multi‐threaded environment. And when items are directly added to the queue returned by this method, the associated condition variable (see the `condition` method) should be signaled to notify any waiting threads of the availability of the new data. | xref:BloombergLP/bdlcc/Queue/removeAll-08.adoc[`removeAll`] | `removeAll` overloads | xref:BloombergLP/bdlcc/Queue/timedPopBack.adoc[`timedPopBack`] | Remove the last item in this queue and load that item value into the specified `buffer`. If this queue is empty, block until an item is available or until the specified `timeout` (expressed as the *ABSOLUTE* time from 00:00:00 UTC, January 1, 1970) expires. Return 0 on success, and a non‐zero value if the call timed out before an item was available. | xref:BloombergLP/bdlcc/Queue/timedPopFront.adoc[`timedPopFront`] | Remove the first item in this queue and load that item value into the specified `buffer`. If this queue is empty, block until an item is available or until the specified `timeout` (expressed as the *ABSOLUTE* time from 00:00:00 UTC, January 1, 1970) expires. Return 0 on success, and a non‐zero value if the call timed out before an item was available. | xref:BloombergLP/bdlcc/Queue/timedPushBack.adoc[`timedPushBack`] | Append the specified `item` to the back of this queue. If the high‐water mark is non‐negative and the number of items in this queue is greater than or equal to the high‐water mark, then block until the number of items in this queue is less than the high‐water mark or until the specified `timeout` (expressed as the *ABSOLUTE* time from 00:00:00 UTC, January 1, 1970) expires. Return 0 on success, and a non‐zero value if the call timed out before the number of items in this queue fell below the high‐water mark. | xref:BloombergLP/bdlcc/Queue/timedPushFront.adoc[`timedPushFront`] | Append the specified `item` to the front of this queue. If the high water mark is non‐negative and the number of items in this queue is greater than or equal to the high‐water mark, then block until the number of items in this queue is less than the high‐water mark or until the specified `timeout` (expressed as the *ABSOLUTE* time from 00:00:00 UTC, January 1, 1970) expires. Return 0 on success, and a non‐zero value if the call timed out before the number of items in this queue fell below the high‐water mark. | xref:BloombergLP/bdlcc/Queue/tryPopBack-05.adoc[`tryPopBack`] | `tryPopBack` overloads | xref:BloombergLP/bdlcc/Queue/tryPopFront-039.adoc[`tryPopFront`] | `tryPopFront` overloads | xref:BloombergLP/bdlcc/Queue/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Queue, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#