Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/RingBuffer.h |
Include |
#include "Containers/RingBuffer.h" |
template<typename T, typename AllocatorT>
class TRingBuffer
RingBuffer - an array with a Front and Back pointer and with implicit wraparound to the beginning of the array when reaching the end of the array when iterating from Front to Back Useful for providing O(1) push/pop at the end of the array (for Queue or Stack) while still having high cache coherency during iteration. Not threadsafe; caller must ensure there is no simultaneous access from multiple threads.
Implementation Details: Relies on unsigned arithmetics and ever increasing Front and Back indices to avoid having to store an extra element or maintain explicit empty state. Capacity will always be rounded up to the next power of two, to provide rapid masking of the index.
Name | Description | |
---|---|---|
|
TRingBuffer() |
Construct Empty Queue with capacity 0. |
|
TRingBuffer ( |
Construct Empty Queue with the given initial requested capacity. |
|
TRingBuffer ( |
Construct a Queue with initial state (from front to back) equal to the given list. |
|
TRingBuffer ( |
|
|
TRingBuffer ( |
|
|
TRingBuffer ( |
Constructor TRingBuffer implementation |
Name | Description | |
---|---|---|
|
~TRingBuffer() |
Default Destructor |
|
~TRingBuffer() |
Name | Description | ||
---|---|---|---|
|
Add ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
|
Add ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
Add_GetRef ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
ElementType ... |
Add_GetRef ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
AddFront ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
|
AddFront ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
AddFront_GetRef ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
ElementType ... |
AddFront_GetRef ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
AddFrontUninitialized() |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
AddFrontUninitialized_GetRef() |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
AddUninitialized() |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
AddUninitialized_GetRef() |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
begin() |
Begin iterator for ranged-for |
|
|
TConstIterat... |
begin() |
Begin iterator for const ranged-for |
|
const DataTy... |
Bottom() |
Gets the first data word in the FIFO (i.e. oldest). |
|
DataType & |
Bottom() |
Gets the first data word in the FIFO (i.e. oldest). |
|
BottomIndex() |
Gets the buffer index that the first data word is stored in. |
|
|
TArrayView< ... |
Compact() |
Shift all elements so that the front pointer's location in memory is less than the back pointer's. |
|
ConvertPointerToIndex ( |
Given a pointer to an Element anywhere in memory, return the index of the element in the RingBuffer, or INDEX_NONE if it is not present. |
|
|
Dequeue ( |
Take the next set of data words from the FIFO buffer. |
|
|
Dequeue ( |
Take the next data word from the FIFO buffer. |
|
|
Emplace ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
Emplace_GetRef ( |
Add a new element after the back pointer of the RingBuffer, resizing if necessary. |
|
EmplaceFront ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
|
ElementType ... |
EmplaceFront_GetRef ( |
Add a new element before the front pointer of the RingBuffer, resizing if necessary. |
|
Empty ( |
Empty the RingBuffer, destructing any elements and releasing the RingBuffer's storage. |
|
|
Empty() |
Clears memory and indexes |
|
|
end() |
End iterator for ranged-for |
|
|
TConstIterat... |
end() |
End iterator for const ranged-for |
|
Enqueue ( |
Pushes a data word to the end of the FIFO. WILL OVERWRITE OLDEST if full. |
|
|
Enqueue ( |
Pushes a buffer of data words to the end of the FIFO. WILL OVERWRITE OLDEST if full. |
|
|
ElementType ... |
First() |
Return a reference to the element at the front pointer of the RingBuffer. |
|
const Elemen... |
First() |
Return a const reference to the element at the front pointer of the RingBuffer. |
|
ElementType ... |
GetAtIndexNoCheck ( |
Unsafely return a writable reference to the value at the given Index. |
|
const Elemen... |
GetAtIndexNoCheck ( |
Unsafely return a const reference to the value at the given Index. |
|
GetShaHash ( |
Get the SHA1 hash for the data currently in the FIFO |
|
|
IsEmpty() |
Returns true if the RingBuffer is empty. |
|
|
IsValidIndex ( |
Tests if index is valid, i.e. greater than or equal to zero, and less than the number of elements in the array. |
|
|
const Elemen... |
Last() |
Return a const reference to the element at the back pointer of the RingBuffer. |
|
ElementType ... |
Last() |
Return a reference to the element at the back pointer of the RingBuffer. |
|
Max() |
Current allocated Capacity, this will always be a power of two, or the special case 0. |
|
|
NextIndex() |
Gets the buffer index that the next enqueued word will get stored in. |
|
|
Num() |
Gets the number of elements in the RingBuffer. |
|
|
Peek ( |
Get the next data word from the FIFO buffer without removing it. |
|
|
Peek ( |
Get the next set of data words from the FIFO buffer without removing them. |
|
|
Pop ( |
Pop the given number of arguments (default: 1) from the back pointer of the RingBuffer. |
|
|
PopFront ( |
Pop the given number of elements (default: 1) from the front pointer of the RingBuffer. |
|
|
PopFrontNoCheck ( |
Unsafely pop the given number of arguments (default: 1) from the front pointer of the RingBuffer. |
|
|
PopFrontValue() |
Pop one element from the front pointer of the RingBuffer and return the popped value. |
|
|
PopNoCheck ( |
Pop the given number of elements (default: 1) from the back pointer of the RingBuffer. |
|
|
PopValue() |
Pop one element from the back pointer of the RingBuffer and return the popped value. |
|
|
Remove ( |
Removes as many instances of Item as there are in the array, maintaining order but not indices. |
|
|
RemoveAll ( |
Removes as many instances of Item as there are in the array, maintaining order but not indices. |
|
|
RemoveAt ( |
Remove the value at the given index from the RingBuffer, and shift values ahead or behind it into its location to fill the hole. |
|
|
Reserve ( |
Set the capacity to the maximum of the current capacity and the (next power of two greater than or equal to) the given capacity. |
|
|
Reset() |
Empty the RingBuffer, destructing any elements in the RingBuffer but not releasing the RingBuffer's storage. |
|
|
RingDataSize() |
Gets the size of the data buffer. |
|
|
RingDataUsage() |
Gets the number of words currently in the FIFO. |
|
|
SerialCompare ( |
Compare the memory in the FIFO to the memory in the given buffer |
|
|
Serialize ( |
Serializes the internal buffer into the given buffer |
|
|
ShiftIndexToBack ( |
Move the value at the given index into the back pointer of the RingBuffer, and shift all elements behind of it up by one to make room for it. |
|
|
ShiftIndexToFront ( |
Move the value at the given index into the front pointer of the RingBuffer, and shift all elements ahead of it down by one to make room for it. |
|
|
DataType & |
Top() |
Gets the last data word in the FIFO (i.e. most recently pushed). |
|
const DataTy... |
Top() |
Gets the last data word in the FIFO (i.e. most recently pushed). |
|
TopIndex() |
Gets the buffer index that the last data word is stored in. |
|
|
TotalDataPushed() |
Gets the total number of words that have been pushed through this buffer since clearing |
|
|
Trim() |
Set the capacity to the minimum power of two (or 0) greater than or equal to the current number of elements in the RingBuffer. |
Name | Description | ||
---|---|---|---|
|
operator!= ( |
||
|
ElementType ... |
operator[] ( |
Return a writable reference to the value at the given Index. |
|
const DataTy... |
operator[] ( |
Square bracket operators for accessing data in the buffer by FIFO index. |
|
DataType & |
operator[] ( |
|
|
const Elemen... |
operator[] ( |
Return a const reference to the value at the given Index. |
|
TRingBuffer ... |
operator= ( |
|
|
TRingBuffer ... |
operator= ( |
|
|
operator== ( |
Name |
Description |
---|---|
Allocator |
The Allocator type being used |
ElementType |
Type of the Elements in the container. |
IndexType |
Type used to request values at a given index in the container. |
SizeType |
Type used to communicate size and capacity and counts |
StorageModuloType |
Type used for variables that are indexes into the underlying storage. |
TConstIterator |
|
TIterator |
Iterator type used for ranged-for traversal. |
Name |
Description |
---|---|
bConstructElements |
|
bDestructElements |