Class CircularBuffer<T>
Circular buffer. When writing to a full buffer: PushBack -> removes this[0] / Front() PushFront -> removes this[Size-1] / Back() this implementation is inspired by http://www.boost.org/doc/libs/1_53_0/libs/circular_buffer/doc/circular_buffer.html because I liked their interface.
Inherited Members
Namespace: PoeShared.Scaffolding
Assembly: PoeShared.dll
Syntax
public class CircularBuffer<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name | Description |
---|---|
T |
Constructors
Name | Description |
---|---|
CircularBuffer(int) | |
CircularBuffer(int, T[]) | Initializes a new instance of the CircularBuffer<T> class. |
CircularBuffer(T[]) |
Properties
Name | Description |
---|---|
Capacity | Maximum capacity of the buffer. Elements pushed into the buffer after maximum capacity is reached (IsFull = true), will remove an element. |
Count | |
IsEmpty | |
IsFull | |
this[int] | |
Size | Current buffer size (the number of elements that the buffer has). |
Methods
Name | Description |
---|---|
Back() | Element at the back of the buffer - this[Size - 1]. |
ClearFill() | Fills an array with |
CopyTo(T[]) | |
Front() | Element at the front of the buffer - this[0]. |
GetEnumerator() | |
PopBack() | Removes the element at the back of the buffer. Decreasing the Buffer size by 1. |
PopFront() | Removes the element at the front of the buffer. Decreasing the Buffer size by 1. |
PushBack(T) | Pushes a new element to the back of the buffer. Back()/this[Size-1] will now return this element. When the buffer is full, the element at Front()/this[0] will be popped to allow for this new element to fit. |
PushFront(T) | Pushes a new element to the front of the buffer. Front()/this[0] will now return this element. When the buffer is full, the element at Back()/this[Size-1] will be popped to allow for this new element to fit. |
ToArray() | Copies the buffer contents to an array, according to the logical contents of the buffer (i.e. independent of the internal order/contents) |