Quantum 3
3.0.13
Ring buffer collection implementation. Stores Capacity number of values and will overwrite the oldest value when full. More...
Public Member Functions | |
| RingBuffer (Int32 capacity) | |
| Create a new RingBuffer with a given capacity. More... | |
| void | Clear () |
| Clear the buffer and reset the start and end positions. More... | |
| T | PeekBack (Int32 offset=0) |
| Look at the last element in the buffer without removing it. More... | |
| T | PeekFront (Int32 offset=0) |
| Look at the first element in the buffer without removing it. More... | |
| T | PopBack () |
| Remove and return the last value in the buffer. More... | |
| T | PopFront () |
| Remove and return the first value in the buffer. More... | |
| void | PushBack (T item) |
| Add a value in the back of the buffer. More... | |
| void | PushFront (T item) |
| Add a value in the front of the buffer. More... | |
Public Attributes | |
| bool | IsEmpty => Size == 0 |
| Check if the buffer is empty. More... | |
| bool | IsFull => Size == Capacity |
| Check if the buffer is full. More... | |
| T[] | ToArray => array |
| Return the underlying array. More... | |
Properties | |
| int | Capacity [get] |
| The maximum size of the buffer. More... | |
| int | Size [get] |
| The current used size of the buffer. More... | |
Ring buffer collection implementation. Stores Capacity number of values and will overwrite the oldest value when full.
| T | Type of data that the collection stores |
|
inline |
Create a new RingBuffer with a given capacity.
| capacity | Initial capacity |
| ArgumentException | Is raised the the capacity is invalid. |
|
inline |
Clear the buffer and reset the start and end positions.
|
inline |
Add a value in the back of the buffer.
| item | The value to add to the collection |
|
inline |
Add a value in the front of the buffer.
| item | The value to add to the collection |
|
inline |
Remove and return the last value in the buffer.
| InvalidOperationException | Is raised when the buffer is empty. |
|
inline |
Remove and return the first value in the buffer.
| InvalidOperationException | Is raised when the buffer is empty. |
|
inline |
Look at the last element in the buffer without removing it.
| offset | Optional offset to apply |
| InvalidOperationException | Is raised when the buffer is empty. |
| IndexOutOfRangeException | Is raised when the offset is invalid |
|
inline |
Look at the first element in the buffer without removing it.
| offset | Optional offset to apply |
| InvalidOperationException | Is raised when the buffer is empty. |
| IndexOutOfRangeException | Is raised when the offset is invalid |
| T [] Quantum.Core.RingBuffer< T >.ToArray => array |
Return the underlying array.
| bool Quantum.Core.RingBuffer< T >.IsFull => Size == Capacity |
Check if the buffer is full.
| bool Quantum.Core.RingBuffer< T >.IsEmpty => Size == 0 |
Check if the buffer is empty.
|
get |
The maximum size of the buffer.
|
get |
The current used size of the buffer.