[#BloombergLP-bdlcc-FixedQueue]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlcc.adoc[bdlcc]::FixedQueue
:relfileprefix: ../../
:mrdocs:

This class provides a thread&hyphen;aware, lock&hyphen;free, fixed&hyphen;size queue of values&period;

== Synopsis

Declared in `&lt;bdlcc&lowbar;fixedqueue&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
class FixedQueue;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlcc/FixedQueue/2constructor.adoc[`FixedQueue`]         [.small]#[constructor]#
| Create a thread&hyphen;aware lock&hyphen;free queue having the specified `capacity`&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; The behavior is undefined unless `0 &lt; capacity` and `capacity &lt;&equals; bdlcc&colon;&colon;FixedQueueIndexManager&colon;&colon;k&lowbar;MAX&lowbar;CAPACITY`&period;
| xref:BloombergLP/bdlcc/FixedQueue/2destructor.adoc[`&#126;FixedQueue`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlcc/FixedQueue/capacity.adoc[`capacity`] 
| Return the maximum number of elements that may be stored in this queue&period;
| xref:BloombergLP/bdlcc/FixedQueue/disable.adoc[`disable`] 
| Disable this queue&period; All subsequent invocations of `pushBack` or `tryPushBack` will fail immediately&period; All blocked invocations of `pushBack` will fail immediately&period; If the queue is already disabled, this method has no effect&period;
| xref:BloombergLP/bdlcc/FixedQueue/enable.adoc[`enable`] 
| Enable queuing&period; If the queue is not disabled, this call has no effect&period;
| xref:BloombergLP/bdlcc/FixedQueue/isEmpty.adoc[`isEmpty`] 
| Return `true` if this queue is empty (has no elements), or `false` otherwise&period;
| xref:BloombergLP/bdlcc/FixedQueue/isEnabled.adoc[`isEnabled`] 
| Return `true` if this queue is enabled, and `false` otherwise&period; Note that the queue is created in the &quot;enabled&quot; state&period;
| 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&period;
| xref:BloombergLP/bdlcc/FixedQueue/length.adoc[`length`] 
| DEPRECATED&colon; Use `numElements()` instead&period;
| xref:BloombergLP/bdlcc/FixedQueue/numElements.adoc[`numElements`] 
| Returns the number of elements currently in this queue&period;
| 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&period; Note that this operation is not atomic&semi; if other threads are concurrently pushing items into the queue the result of numElements() after this function returns is not guaranteed to be 0&period;
| xref:BloombergLP/bdlcc/FixedQueue/size.adoc[`size`] 
| DEPRECATED&colon; Use `capacity()` instead&period;
| 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&period; Return 0 on success, and a non&hyphen;zero value if queue was empty&period; On failure, `value` is not changed&period;
| xref:BloombergLP/bdlcc/FixedQueue/tryPushBack-08c.adoc[`tryPushBack`] 
| `tryPushBack` overloads
| xref:BloombergLP/bdlcc/FixedQueue/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;FixedQueue, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlcc/FixedQueue_PopGuard.adoc[BloombergLP::bdlcc::FixedQueue&lowbar;PopGuard]`
| This class provides a guard that, upon its destruction, will remove (pop) the indicated element from the `FixedQueue` object supplied at construction&period; Note that this guard is used to provide exception safety when popping an element from a `FixedQueue` object&period;
| `xref:BloombergLP/bdlcc/FixedQueue_PushProctor.adoc[BloombergLP::bdlcc::FixedQueue&lowbar;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&hyphen;buffer into a valid empty state) upon the proctor&apos;s destruction&period; Note that this guard is used to provide exception safety when pushing an element into a `FixedQueue`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
