Craig's Utility Library
4.0 Beta
|
Implements a ring buffer More...
Public Member Functions | |
RingBuffer () | |
Constructor More... | |
RingBuffer (int MaxCapacity, bool AllowOverflow=false) | |
Constructor More... | |
virtual void | Add (T item) |
Adds an item to the buffer More... | |
virtual void | Add (IEnumerable< T > Items) |
Adds a number of items to the buffer More... | |
virtual void | Add (T[] buffer, int offset, int count) |
Adds a number of items to the buffer More... | |
virtual void | Clear () |
Clears the buffer More... | |
virtual bool | Contains (T item) |
Determines if the buffer contains the item More... | |
virtual void | CopyTo (T[] array, int arrayIndex) |
Copies the buffer to an array More... | |
virtual void | CopyTo (Array array, int index) |
Copies the buffer to an array More... | |
virtual IEnumerator< T > | GetEnumerator () |
Gets the enumerator for the buffer More... | |
virtual T | Remove () |
Reads the next item from the buffer More... | |
virtual IEnumerable< T > | Remove (int Amount) |
Reads the next X number of items from the buffer More... | |
virtual bool | Remove (T item) |
Removes an item from the buffer More... | |
virtual int | Remove (T[] array, int offset, int count) |
Reads the next X number of items and places them in the array passed in More... | |
virtual void | Skip (int Count) |
Skips ahead in the buffer More... | |
override string | ToString () |
Returns the buffer as a string More... | |
Static Public Member Functions | |
static implicit | operator string (RingBuffer< T > Value) |
Converts the object to a string More... | |
Properties | |
bool | AllowOverflow [get, protected set] |
Is overflow allowed? More... | |
int | Count [get, protected set] |
Item count for the circular buffer More... | |
bool | IsReadOnly [get, protected set] |
Is this read only? More... | |
bool | IsSynchronized [get, protected set] |
Is this synchronized? More... | |
int | MaxCapacity [get, protected set] |
Maximum capacity More... | |
object | SyncRoot [get] |
Sync root More... | |
T[] | Buffer [get, set] |
Buffer that the circular buffer uses More... | |
int | ReadPosition [get, set] |
Read position More... | |
int | WritePosition [get, set] |
Write position More... | |
T | this[int Position] [get, set] |
Allows getting an item at a specific position in the buffer More... | |
Implements a ring buffer
T | Type of the data it holds |
Definition at line 35 of file RingBuffer.cs.
Utilities.DataTypes.RingBuffer< T >.RingBuffer | ( | ) |
Constructor
Definition at line 42 of file RingBuffer.cs.
Utilities.DataTypes.RingBuffer< T >.RingBuffer | ( | int | MaxCapacity, |
bool | AllowOverflow = false |
||
) |
Constructor
MaxCapacity | Max capacity for the circular buffer |
AllowOverflow | Is overflow allowed (defaults to false) |
Definition at line 52 of file RingBuffer.cs.
|
virtual |
|
virtual |
Adds a number of items to the buffer
Items | Items to add |
Definition at line 171 of file RingBuffer.cs.
|
virtual |
Adds a number of items to the buffer
buffer | Items to add |
count | Number of items to add |
offset | Offset to start at |
Definition at line 183 of file RingBuffer.cs.
|
virtual |
Clears the buffer
Definition at line 194 of file RingBuffer.cs.
|
virtual |
Determines if the buffer contains the item
item | Item to check |
Definition at line 208 of file RingBuffer.cs.
|
virtual |
Copies the buffer to an array
array | Array to copy to |
arrayIndex | Array index to start at |
Definition at line 228 of file RingBuffer.cs.
|
virtual |
Copies the buffer to an array
array | Array to copy to |
index | Array index to start at |
Definition at line 248 of file RingBuffer.cs.
|
virtual |
Gets the enumerator for the buffer
Definition at line 267 of file RingBuffer.cs.
|
static |
Converts the object to a string
Value | Value to convert |
Definition at line 144 of file RingBuffer.cs.
|
virtual |
Reads the next item from the buffer
Definition at line 292 of file RingBuffer.cs.
|
virtual |
Reads the next X number of items from the buffer
Amount | Number of items to return |
Definition at line 309 of file RingBuffer.cs.
|
virtual |
Removes an item from the buffer
item | Item to remove |
Definition at line 324 of file RingBuffer.cs.
|
virtual |
Reads the next X number of items and places them in the array passed in
array | Array to copy to |
offset | Offset to start at |
count | Number of items to read |
Definition at line 349 of file RingBuffer.cs.
|
virtual |
Skips ahead in the buffer
Count | Number of items in the buffer to skip |
Definition at line 374 of file RingBuffer.cs.
override string Utilities.DataTypes.RingBuffer< T >.ToString | ( | ) |
Returns the buffer as a string
Definition at line 388 of file RingBuffer.cs.
|
getprotected set |
Is overflow allowed?
Definition at line 68 of file RingBuffer.cs.
|
getsetprotected |
Buffer that the circular buffer uses
Definition at line 106 of file RingBuffer.cs.
|
getprotected set |
Item count for the circular buffer
Definition at line 73 of file RingBuffer.cs.
|
getprotected set |
Is this read only?
Definition at line 78 of file RingBuffer.cs.
|
getprotected set |
Is this synchronized?
Definition at line 83 of file RingBuffer.cs.
|
getprotected set |
Maximum capacity
Definition at line 88 of file RingBuffer.cs.
|
getsetprotected |
Read position
Definition at line 111 of file RingBuffer.cs.
|
get |
Sync root
Definition at line 94 of file RingBuffer.cs.
|
getset |
Allows getting an item at a specific position in the buffer
Position | Position to look at |
Definition at line 124 of file RingBuffer.cs.
|
getsetprotected |
Write position
Definition at line 116 of file RingBuffer.cs.