Navigation
API > API/Runtime > API/Runtime/TimeManagement
A circular buffer of any size (opposed to TCircularBuffer which requires power of 2).
The next index is computed using the modulo operation: NextIndexToInsert = (NextIndexToInsert + 1) % Data.Num(). It's less performant than bitmasking, which TCircularBuffer uses, but does not require any specific element count.
| Name | TModuloCircularBuffer |
| Type | class |
| Header File | /Engine/Source/Runtime/TimeManagement/Public/Misc/ModuloCircularBuffer.h |
| Include Path | #include "Misc/ModuloCircularBuffer.h" |
Syntax
template<typename T, typename TAllocator>
class TModuloCircularBuffer
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TModuloCircularBuffer
(
SIZE_T InNumSamples |
Misc/ModuloCircularBuffer.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsBufferFull | bool | When recalculating, tells us how to sum up the samples. | Misc/ModuloCircularBuffer.h | |
| Data | TArray< T, TAllocator > | Misc/ModuloCircularBuffer.h | ||
| NextIndexToInsert | SIZE_T | The next item will be added to this index. | Misc/ModuloCircularBuffer.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Add
(
const T& InItem |
Adds an item to the buffer. If the buffer is full, the oldest item is replaced. | Misc/ModuloCircularBuffer.h | |
TConstArrayView< T > AsUnorderedView() |
Misc/ModuloCircularBuffer.h | ||
SIZE_T Capacity() |
Misc/ModuloCircularBuffer.h | ||
const T * GetNextReplacedItem() |
Misc/ModuloCircularBuffer.h | ||
bool IsEmpty() |
Misc/ModuloCircularBuffer.h | ||
bool IsFull() |
Misc/ModuloCircularBuffer.h | ||
SIZE_T Num() |
Misc/ModuloCircularBuffer.h |