Class BasicQueue<T>
Unity 2022 has a bug where codegen will not compile when referencing a Queue type, while also targeting .Net as the framework API. As a work around this class is used for queues instead.
Inheritance
Inherited Members
Namespace: GameKit.Dependencies.Utilities
Assembly: GameKit.Dependencies.dll
Syntax
public class BasicQueue<T>
Type Parameters
Name | Description |
---|---|
T |
Properties
Capacity
Maximum size of the collection.
Declaration
public int Capacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Count
Number of elements in the queue.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Returns value in actual index as it relates to simulated index.
Declaration
public T this[int simulatedIndex] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | simulatedIndex | Simulated index to return. A value of 0 would return the first simulated index in the collection. |
Property Value
Type | Description |
---|---|
T |
WriteIndex
Current write index of the collection.
Declaration
public int WriteIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clear()
Clears the queue.
Declaration
public void Clear()
Dequeue(Boolean)
Dequeues the next entry.
Declaration
public T Dequeue(bool defaultArrayEntry = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | defaultArrayEntry | True to set the array entry as default. |
Returns
Type | Description |
---|---|
T |
Enqueue(T)
Enqueues an entry.
Declaration
public void Enqueue(T data)
Parameters
Type | Name | Description |
---|---|---|
T | data |
Peek()
Peeks the next queue entry.
Declaration
public T Peek()
Returns
Type | Description |
---|---|
T |
TryDequeue(out T, Boolean)
Tries to dequeue the next entry.
Declaration
public bool TryDequeue(out T result, bool defaultArrayEntry = true)
Parameters
Type | Name | Description |
---|---|---|
T | result | Dequeued entry. |
System.Boolean | defaultArrayEntry | True to set the array entry as default. |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry existed to dequeue. |
TryPeek(out T)
Tries to peek the next entry.
Declaration
public bool TryPeek(out T result)
Parameters
Type | Name | Description |
---|---|---|
T | result | Peeked entry. |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry existed to peek. |