The fixed-size first-in-first-out (FIFO) collection of instances of the same specified type.
More...
|
| CircularBuffer (int capacity) |
| Creates a new CircularBuffer{TValue}. More...
|
|
void | Push (TValue value) |
| Inserts an object at the end of the buffer. More...
|
|
TValue | Pop () |
| Removes and returns the object at the beginning of the buffer. More...
|
|
void | Clear () |
| Removes all objects from the buffer. More...
|
|
void | CopyTo (TValue[] array, int offset) |
| Copies the buffer to an existing one-dimensional Array, starting at the specified array index. More...
|
|
IEnumerator< TValue > | GetEnumerator () |
| Returns an enumerator that iterates through the buffer. More...
|
|
|
int | Count => ( buffer.Length + head - tail ) % buffer.Length |
| Returns the number of objects in the buffer. More...
|
|
int | Capacity => buffer.Length - 1 |
| Returns the number of objects that fit into the buffer. More...
|
|
object | SyncRoot => syncRoot.Value |
| Returns the object that can be used to synchronize access to the buffer. More...
|
|
bool | IsSynchronized => false |
| Gets Returns the value indicating whether access to the buffer is synchronized (thread safe). More...
|
|
The fixed-size first-in-first-out (FIFO) collection of instances of the same specified type.
A circular buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.
- Template Parameters
-
TValue | The type of elements in the buffer. |
PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.CircularBuffer |
( |
int |
capacity | ) |
|
Creates a new CircularBuffer{TValue}.
- Parameters
-
capacity | The number of objects this buffer can hold. |
- Exceptions
-
ArgumentOutOfRangeException | The given capacity is negative. |
void PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.Clear |
( |
| ) |
|
Removes all objects from the buffer.
Count is set to zero, and references to other objects from elements of the collection are also released. The Capacity remains unchanged.
This method is an O(n) operation, where n is Count.
void PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.CopyTo |
( |
TValue[] |
array, |
|
|
int |
offset |
|
) |
| |
Copies the buffer to an existing one-dimensional Array, starting at the specified array index.
The elements are copied onto the array in first-in-first-out (FIFO) order, similar to the order of the elements returned by a succession of calls to Pop.
- Parameters
-
array | The one-dimensional Array that is the destination of the elements copied from the buffer. The Array must have zero-based indexing. |
offset | The zero-based index in array at which copying begins. |
- Exceptions
-
ArgumentNullException | The array is null . |
ArgumentOutOfRangeException | The given offset is negative or bigger than the given array . The given array is too small to hold all objects within the buffer. |
IEnumerator<TValue> PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.GetEnumerator |
( |
| ) |
|
Returns an enumerator that iterates through the buffer.
- Returns
- The enumerator that can be used to iterate through the buffer.
TValue PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.Pop |
( |
| ) |
|
Removes and returns the object at the beginning of the buffer.
The returned objects are in first-in-first-out (FIFO) order. If type TValue is a reference type, null can be pushed onto the buffer as a placeholder, if needed. The buffer is implemented as an array. This method is an O(1) operation.
- Returns
- The object removed from the beginning of the buffer.
- Exceptions
-
InvalidOperationException | The buffer is empty. |
void PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.Push |
( |
TValue |
value | ) |
|
Inserts an object at the end of the buffer.
If Count already equals the Capacity, the previously pushed objects are overwritten, starting from the beginning of the buffer. The beginning of the buffer is then moved to the next object in the buffer. Therefore the buffer can never hold more items than the given Capacity.
The buffer is implemented as an array. This method is an O(1) operation.
- Parameters
-
value | The object to push onto the buffer. The value can be null for reference types. |
int PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.Capacity => buffer.Length - 1 |
Returns the number of objects that fit into the buffer.
int PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.Count => ( buffer.Length + head - tail ) % buffer.Length |
Returns the number of objects in the buffer.
bool PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.IsSynchronized => false |
Gets Returns the value indicating whether access to the buffer is synchronized (thread safe).
Always returns false because this implementation is not thread-safe.
object PushTechnology.ClientInterface.Collections.CircularBuffer< TValue >.SyncRoot => syncRoot.Value |
Returns the object that can be used to synchronize access to the buffer.
The documentation for this class was generated from the following file:
- Collections.Public/CircularBuffer.cs