Craig's Utility Library  4.0 Beta
Utilities.DataTypes.RingBuffer< T > Class Template Reference

Implements a ring buffer More...

Inheritance diagram for Utilities.DataTypes.RingBuffer< T >:

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...
 
this[int Position] [get, set]
 Allows getting an item at a specific position in the buffer More...
 

Detailed Description

Implements a ring buffer

Template Parameters
TType of the data it holds

Definition at line 35 of file RingBuffer.cs.

Constructor & Destructor Documentation

Constructor

Definition at line 42 of file RingBuffer.cs.

Utilities.DataTypes.RingBuffer< T >.RingBuffer ( int  MaxCapacity,
bool  AllowOverflow = false 
)

Constructor

Parameters
MaxCapacityMax capacity for the circular buffer
AllowOverflowIs overflow allowed (defaults to false)

Definition at line 52 of file RingBuffer.cs.

Member Function Documentation

virtual void Utilities.DataTypes.RingBuffer< T >.Add ( item)
virtual

Adds an item to the buffer

Parameters
itemItem to add

Definition at line 154 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.Add ( IEnumerable< T >  Items)
virtual

Adds a number of items to the buffer

Parameters
ItemsItems to add

Definition at line 171 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.Add ( T[]  buffer,
int  offset,
int  count 
)
virtual

Adds a number of items to the buffer

Parameters
bufferItems to add
countNumber of items to add
offsetOffset to start at

Definition at line 183 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.Clear ( )
virtual

Clears the buffer

Definition at line 194 of file RingBuffer.cs.

virtual bool Utilities.DataTypes.RingBuffer< T >.Contains ( item)
virtual

Determines if the buffer contains the item

Parameters
itemItem to check
Returns
True if the item is present, false otherwise

Definition at line 208 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.CopyTo ( T[]  array,
int  arrayIndex 
)
virtual

Copies the buffer to an array

Parameters
arrayArray to copy to
arrayIndexArray index to start at

Definition at line 228 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.CopyTo ( Array  array,
int  index 
)
virtual

Copies the buffer to an array

Parameters
arrayArray to copy to
indexArray index to start at

Definition at line 248 of file RingBuffer.cs.

virtual IEnumerator<T> Utilities.DataTypes.RingBuffer< T >.GetEnumerator ( )
virtual

Gets the enumerator for the buffer

Returns
The enumerator

Definition at line 267 of file RingBuffer.cs.

static implicit Utilities.DataTypes.RingBuffer< T >.operator string ( RingBuffer< T >  Value)
static

Converts the object to a string

Parameters
ValueValue to convert
Returns
The value as a string

Definition at line 144 of file RingBuffer.cs.

virtual T Utilities.DataTypes.RingBuffer< T >.Remove ( )
virtual

Reads the next item from the buffer

Returns
The next item from the buffer

Definition at line 292 of file RingBuffer.cs.

virtual IEnumerable<T> Utilities.DataTypes.RingBuffer< T >.Remove ( int  Amount)
virtual

Reads the next X number of items from the buffer

Parameters
AmountNumber of items to return
Returns
The next X items from the buffer

Definition at line 309 of file RingBuffer.cs.

virtual bool Utilities.DataTypes.RingBuffer< T >.Remove ( item)
virtual

Removes an item from the buffer

Parameters
itemItem to remove
Returns
True if it is removed, false otherwise

Definition at line 324 of file RingBuffer.cs.

virtual int Utilities.DataTypes.RingBuffer< T >.Remove ( T[]  array,
int  offset,
int  count 
)
virtual

Reads the next X number of items and places them in the array passed in

Parameters
arrayArray to copy to
offsetOffset to start at
countNumber of items to read
Returns
The number of items that were read

Definition at line 349 of file RingBuffer.cs.

virtual void Utilities.DataTypes.RingBuffer< T >.Skip ( int  Count)
virtual

Skips ahead in the buffer

Parameters
CountNumber 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

Returns
The buffer as a string

Definition at line 388 of file RingBuffer.cs.

Property Documentation

bool Utilities.DataTypes.RingBuffer< T >.AllowOverflow
getprotected set

Is overflow allowed?

Definition at line 68 of file RingBuffer.cs.

T [] Utilities.DataTypes.RingBuffer< T >.Buffer
getsetprotected

Buffer that the circular buffer uses

Definition at line 106 of file RingBuffer.cs.

int Utilities.DataTypes.RingBuffer< T >.Count
getprotected set

Item count for the circular buffer

Definition at line 73 of file RingBuffer.cs.

bool Utilities.DataTypes.RingBuffer< T >.IsReadOnly
getprotected set

Is this read only?

Definition at line 78 of file RingBuffer.cs.

bool Utilities.DataTypes.RingBuffer< T >.IsSynchronized
getprotected set

Is this synchronized?

Definition at line 83 of file RingBuffer.cs.

int Utilities.DataTypes.RingBuffer< T >.MaxCapacity
getprotected set

Maximum capacity

Definition at line 88 of file RingBuffer.cs.

int Utilities.DataTypes.RingBuffer< T >.ReadPosition
getsetprotected

Read position

Definition at line 111 of file RingBuffer.cs.

object Utilities.DataTypes.RingBuffer< T >.SyncRoot
get

Sync root

Definition at line 94 of file RingBuffer.cs.

T Utilities.DataTypes.RingBuffer< T >.this[int Position]
getset

Allows getting an item at a specific position in the buffer

Parameters
PositionPosition to look at
Returns
The specified item

Definition at line 124 of file RingBuffer.cs.

int Utilities.DataTypes.RingBuffer< T >.WritePosition
getsetprotected

Write position

Definition at line 116 of file RingBuffer.cs.


The documentation for this class was generated from the following file: