[#BloombergLP-bdlcc-FixedQueue] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlcc.adoc[bdlcc]::FixedQueue :relfileprefix: ../../ :mrdocs: This class provides a thread‐aware, lock‐free, fixed‐size queue of values. == Synopsis Declared in `<bdlcc_fixedqueue.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class FixedQueue; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/FixedQueue/2constructor.adoc[`FixedQueue`] [.small]#[constructor]# | Create a thread‐aware lock‐free queue having the specified `capacity`. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is 0, the currently installed default allocator is used. The behavior is undefined unless `0 < capacity` and `capacity <= bdlcc::FixedQueueIndexManager::k_MAX_CAPACITY`. | xref:BloombergLP/bdlcc/FixedQueue/2destructor.adoc[`~FixedQueue`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bdlcc/FixedQueue/capacity.adoc[`capacity`] | Return the maximum number of elements that may be stored in this queue. | xref:BloombergLP/bdlcc/FixedQueue/disable.adoc[`disable`] | Disable this queue. All subsequent invocations of `pushBack` or `tryPushBack` will fail immediately. All blocked invocations of `pushBack` will fail immediately. If the queue is already disabled, this method has no effect. | xref:BloombergLP/bdlcc/FixedQueue/enable.adoc[`enable`] | Enable queuing. If the queue is not disabled, this call has no effect. | xref:BloombergLP/bdlcc/FixedQueue/isEmpty.adoc[`isEmpty`] | Return `true` if this queue is empty (has no elements), or `false` otherwise. | xref:BloombergLP/bdlcc/FixedQueue/isEnabled.adoc[`isEnabled`] | Return `true` if this queue is enabled, and `false` otherwise. Note that the queue is created in the "enabled" state. | xref:BloombergLP/bdlcc/FixedQueue/isFull.adoc[`isFull`] | Return `true` if this queue is full (when the number of elements currently in this queue equals its capacity), or `false` otherwise. | xref:BloombergLP/bdlcc/FixedQueue/length.adoc[`length`] | DEPRECATED: Use `numElements()` instead. | xref:BloombergLP/bdlcc/FixedQueue/numElements.adoc[`numElements`] | Returns the number of elements currently in this queue. | xref:BloombergLP/bdlcc/FixedQueue/popFront-07.adoc[`popFront`] | `popFront` overloads | xref:BloombergLP/bdlcc/FixedQueue/pushBack-04.adoc[`pushBack`] | `pushBack` overloads | xref:BloombergLP/bdlcc/FixedQueue/removeAll.adoc[`removeAll`] | Remove all items from this queue. Note that this operation is not atomic; if other threads are concurrently pushing items into the queue the result of numElements() after this function returns is not guaranteed to be 0. | xref:BloombergLP/bdlcc/FixedQueue/size.adoc[`size`] | DEPRECATED: Use `capacity()` instead. | xref:BloombergLP/bdlcc/FixedQueue/tryPopFront.adoc[`tryPopFront`] | Attempt to remove the element from the front of this queue without blocking, and, if successful, load the specified `value` with the removed element. Return 0 on success, and a non‐zero value if queue was empty. On failure, `value` is not changed. | xref:BloombergLP/bdlcc/FixedQueue/tryPushBack-08c.adoc[`tryPushBack`] | `tryPushBack` overloads | xref:BloombergLP/bdlcc/FixedQueue/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<FixedQueue, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlcc/FixedQueue_PopGuard.adoc[BloombergLP::bdlcc::FixedQueue_PopGuard]` | This class provides a guard that, upon its destruction, will remove (pop) the indicated element from the `FixedQueue` object supplied at construction. Note that this guard is used to provide exception safety when popping an element from a `FixedQueue` object. | `xref:BloombergLP/bdlcc/FixedQueue_PushProctor.adoc[BloombergLP::bdlcc::FixedQueue_PushProctor]` | This class provides a proctor that, unless the `release` method has been previously invoked, will remove and destroy all the elements from a `FixedQueue` object supplied at construction (putting that ring‐buffer into a valid empty state) upon the proctor's destruction. Note that this guard is used to provide exception safety when pushing an element into a `FixedQueue`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#