Struct ConcurrentCircularBuffer<T>
A concurrent sized buffer which loops back over itself as elements are used.
Namespace: GDX.Collections.Generic
Syntax
[VisualScriptingCompatible((short)1)]
public struct ConcurrentCircularBuffer<T>
Type Parameters
Name | Description |
---|---|
T | The type of System.Objects contained within. |
Constructors
| Improve this Doc View SourceConcurrentCircularBuffer(Int32)
Create a ConcurrentCircularBuffer<T> with a capacity
.
Declaration
public ConcurrentCircularBuffer(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The maximum number of items allowed in the ConcurrentCircularBuffer<T> |
ConcurrentCircularBuffer(Int32, T[])
Create a ConcurrentCircularBuffer<T> with a capacity
, filling with
targetItems
.
Declaration
public ConcurrentCircularBuffer(int capacity, T[] targetItems)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The maximum number of items allowed in the ConcurrentCircularBuffer<T> |
T[] | targetItems | An array of values to fill the ConcurrentCircularBuffer<T> with. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Invalid number of entries provided to the ConcurrentCircularBuffer<T> constructor. |
System.ArgumentNullException | No items were provided to the ConcurrentCircularBuffer<T> constructor. |
Fields
| Improve this Doc View SourceArray
Internal array of backed data for the ConcurrentCircularBuffer<T>.
Declaration
public readonly T[] Array
Field Value
Type | Description |
---|---|
T[] |
Capacity
The cached array length for Array.
Declaration
public readonly int Capacity
Field Value
Type | Description |
---|---|
System.Int32 |
Count
The current size of occupied elements in the ConcurrentCircularBuffer<T>.
Declaration
public int Count
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
EndIndex
The index of the last item in Array.
Declaration
public int EndIndex
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
StartIndex
The index of the first item in Array.
Declaration
public int StartIndex
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
Properties
| Improve this Doc View SourceItem[Int32]
Access item at pseudoIndex
.
Declaration
public T this[int pseudoIndex] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pseudoIndex |
Property Value
Type | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.IndexOutOfRangeException | Provided index is out of buffers range. |
Methods
| Improve this Doc View SourceAdd(T)
Add an item
to the Array.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The typed System.Object to add. |
Clear()
Clear all values of the Array.
Declaration
public void Clear()
GetBack()
Get the last item in the Array.
Declaration
public T GetBack()
Returns
Type | Description |
---|---|
T | The last typed object in Array. |
GetFront()
Get the first item in the Array.
Declaration
public T GetFront()
Returns
Type | Description |
---|---|
T | The first typed object in Array. |
IsEmpty()
Does the Array have any items in it?
Declaration
public bool IsEmpty()
Returns
Type | Description |
---|---|
System.Boolean | true/false |
IsFull()
Is the Array at capacity?
Declaration
public bool IsFull()
Returns
Type | Description |
---|---|
System.Boolean | true/false |
PopBack()
Remove an item from the end of the Array.
Declaration
public void PopBack()
PopFront()
Remove an item from the start of the Array.
Declaration
public void PopFront()
PushBack(T)
Add an item to the end of the Array.
Declaration
public void PushBack(T targetItem)
Parameters
Type | Name | Description |
---|---|---|
T | targetItem | The item to add to the end of Array. |
PushFront(T)
Add an item to the start of the Array.
Declaration
public void PushFront(T targetItem)
Parameters
Type | Name | Description |
---|---|---|
T | targetItem | The item to add to the start of Array. |
ToArray()
Copy Array to an array of the same type.
Declaration
public T[] ToArray()
Returns
Type | Description |
---|---|
T[] | A copied version of the Array as an array. |