CircularBuffer< T > Class Template Reference

a Variant of Circular array, with 2 internal indexes: a start and end index. The collection acts like a "Queue" with two public functions are provided, Push and Pop. These functions will set and get the values at those internal indexes, and then increment the internal indexes appropriately. So, you can Push items into the buffer, and Pop items off the buffer

Detailed Description

Template Parameters
T

Public Member Functions

 CircularBuffer (int size)
 Constructor used to create a CircularBuffer of a specific size.
 
int CurrentBufferLength ()
 The size of the current buffer, when 0 this indicates there are no items remaining in the buffer to be Popped off. This is NOT the size of the internal array, which will remain unchanged.
 
IEnumerator< T > GetEnumerator ()
 This enumerator iterated though elements that have been push into the buffer, and have not yet been popped off the buffer. You can use this function to "peek" at the buffer values, without adjusting the buffer itself.
 
Pop ()
 Pop gets the oldest value that was pushed onto the buffer, that has not yet been popped off the buffer. If there are no items in the buffer, this function will throw an IndexOutOfRangeException.
 
void Push (T value)
 Puts the provided value into the buffer, right behind the last pushed value.
 
- Public Member Functions inherited from CircularArray< T >
 CircularArray (int size)
 All CircularArrays must be at least 1 element in size, or an exception is thrown.
 
int Add (object value)
 Circular array is static, and does not support this function.
 
void Add (T item)
 Circular array is static, and does not support this function.
 
void Clear ()
 Circular array is static, and does not support this function.
 
bool Contains (object value)
 Circular array is static, and does not support this function.
 
bool Contains (T item)
 Checks the array contents to see if the specified item is one of the elements it contains.
 
void CopyTo (Array array, int index)
 Circular array is static, and does not support this function.
 
void CopyTo (T[] array, int arrayIndex)
 Copies the circular array into the specified array, starting at the specified index.
 
void DecIndex (ref int index)
 Decrements, by one, then wraps the provided index. The value passed in is adjusted directly via the ref parameter keyword. No value is returned.
 
int GetIndexDifference (int earlierIndex, int laterIndex)
 
void IncIndex (ref int index)
 Increments, by one, then wraps the provided index. The value passed in is adjusted directly via the ref parameter keyword. No value is returned.
 
int IndexOf (object value)
 Circular array is static, and does not support this function.
 
int IndexOf (T item)
 IList function used to find the index of a specified element
 
void Insert (int index, object value)
 Circular array is static, and does not support this function.
 
void Insert (int index, T item)
 Circular array is static, and does not support this function.
 
void OffsetIndexBy (ref int index, int offset)
 
void Remove (object value)
 Circular array is static, and does not support this function.
 
bool Remove (T item)
 Circular array is static, and does not support this function.
 
void RemoveAt (int index)
 Circular array is static, and does not support this function.
 

Properties

int BufferEndIndex [get]
 index to the last valid item pushed into the buffer.
 
int BufferStartIndex [get]
 index to the first valid item pushed into the buffer.
 
- Properties inherited from CircularArray< T >
virtual int Count [get]
 Number of elements in the circular array
 
bool IsFixedSize [get]
 IList interface function. Returns true because the list size cannot be modified.
 
bool IsReadOnly [get]
 Implementation of ICollectable- always returns true, since the size of the array cannot be adjusted after creation.
 
bool IsSynchronized [get]
 ICollection interface function. Returns isSyncronized state of the internal array
 
object SyncRoot [get]
 ICollection interface function. Returns SyncRoot object of the internal array
 
virtual T this[int index] [get, set]
 Index lookup into the array. The index value passed in here does NOT need to be valid, it will be internally wrapped if it is. After wrapping the provided index, it will use that to lookup to get/set the appropriate value from the internal array.
 
+ Inheritance diagram for CircularBuffer< T >:
+ Collaboration diagram for CircularBuffer< T >: