Name |
Description |
FixedQueueIndexManager [constructor]
|
Create an index manager for a circular buffer having the specified maximum capacity. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. isEnabled will be true for the newly created index manager. The behavior is undefined unless 0 < capacity and capacity <= k_MAX_CAPACITY. |
~FixedQueueIndexManager [destructor]
|
Destroy this object. |
abortPushIndexReservation
|
Release the specified index and make it available for use in the generation following the specified generation. The behavior is undefined unless the calling thread holds a reservation on generation and index, and clearPopIndex and then commitPushIndex have been repeatedly invoked with generation and index as input until no indices remain to clear. Note that this operation is used to facilitate removing all the elements in a circular buffer if an exception is thrown between reserving an index for pushing, and committing that index. |
capacity
|
Return the maximum number of items that may be stored in the queue. |
commitPopIndex
|
Mark the specified index as available (empty) in the generation following the specified generation. The behavior is undefined unless generation and index' match those returned by a previous successful call to reservePopIndex (that has not previously been committed). |
commitPushIndex
|
Mark the specified index as occupied (full) in the specified generation. The behavior is undefined unless generation and index match those returned by a previous successful call to reservePushIndex (that has not previously been committed). |
disable
|
Mark the queue as disabled. Future calls to reservePushIndex will fail. |
enable
|
Mark the queue as enabled. |
isEnabled
|
Return true if the queue is enabled, and false if it is disabled. |
length
|
Return a snapshot of the number of items in the queue. |
print
|
Print a formatted string describing the current state of this object to the specified stream. If stream is not valid on entry, this operation has no effect. Note that this method describes the internal state of the buffer and is provided purely for debugging purposes. |
reservePopIndex
|
Reserve the next available index from which to dequeue an element from an (externally managed) circular buffer; load the specified index with the reserved index and load the specified generation with the current generation of the circular buffer. Return 0 on success, and a non‐zero value if the queue is empty. If this method succeeds, other threads using this object may spin on the corresponding index state until commitPopIndex is called using the returned index and generation values; clients should call commitPopIndex quickly after this method returns, without performing any blocking operations. If this method fails the generation and index will be unmodified. The behavior is undefined if the current thread is already holding a reservation on either a push or pop index. Note that generation is necessary for invoking commitPopIndex but should not otherwise be used by the caller; the value reflects the of times the index in the circular buffer has been used. |
reservePopIndexForClear
|
If the next available index from which an element can be popped is before the specified endGeneration and endIndex then reserve that index for popping and load the specified disposedGeneration and disposedIndex with the generation and index of the reserved cell; otherwise this operation has no effect. Return 0 if an index was successfully reserved, and a non‐zero value if the current pop index is at endIndex and endGeneration. The behavior is undefined unless endGeneration and endIndex refer to a cell that has been acquired for writing. Note that this operation is used to facilitate removing all the elements in a circular buffer if an exception is thrown between reserving an index for pushing, and committing that index ‐‐ the intended usage is to call reservePopIndexForClear and then commitPopIndex, emptying all the cells up to the index that was reserved for writing, and then call abortPushIndexReservation on the reserved index. |
reservePushIndex
|
Reserve the next available index at which to enqueue an element in an (externally managed) circular buffer; load the specified index with the reserved index and load the specified generation with the current generation of the circular buffer. Return 0 on success, a negative value if the queue is disabled, and a positive value if the queue is full. If this method succeeds, other threads using this object may spin on the corresponding index state until commitPushIndex is called using the returned index and generation values; clients should call commitPushIndex quickly after this method returns, without performing any blocking operations. If this method fails the generation and index will be unmodified. The behavior is undefined if the current thread is already holding a reservation on either a push or pop index. Note that generation is necessary for invoking commitPushIndex but should not otherwise be used by the caller; the value reflects the number of times the index in the circular buffer has been used. |
operator BloombergLP::bslmf::NestedTraitDeclaration<FixedQueueIndexManager, UsesBslmaAllocator>
|
Declare that this type uses a bslma allocator. |