Struct NativeSimpleQueue<T>
A Unity.Collections.NativeArray<T> backed simplified first-in, first-out (FIFO) data structure.
Implements
Namespace: GDX.Collections.Generic
Syntax
public struct NativeSimpleQueue<T> : IDisposable where T : struct
Type Parameters
Name | Description |
---|---|
T | The type of System.Objects contained within. |
Remarks
The NativeSimpleQueue<T> is backed by a Unity.Collections.NativeArray<T> which requires UnityEngine.CoreModule.dll.
Constructors
| Improve this Doc View SourceNativeSimpleQueue(Int32, Allocator, NativeArrayOptions)
Create a new NativeSimpleQueue<T>.
Declaration
public NativeSimpleQueue(int capacity, Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The maximum number of items allowed in the NativeSimpleQueue<T> |
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |
Fields
| Improve this Doc View SourceArray
Internal Unity.Collections.NativeArray<T> of backed data for the NativeSimpleQueue<T>.
Declaration
public NativeArray<T> Array
Field Value
Type | Description |
---|---|
Unity.Collections.NativeArray<T> |
Count
Number of elements.
Declaration
public int Count
Field Value
Type | Description |
---|---|
System.Int32 |
EndIndex
Last valid element (tail) index in the queue.
Declaration
public int EndIndex
Field Value
Type | Description |
---|---|
System.Int32 |
FirstIndex
First valid element (head) index in the queue.
Declaration
public int FirstIndex
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceClear()
Clear the NativeSimpleQueue<T>.
Declaration
public void Clear()
Dequeue()
Pop (remove and return) the first element from the NativeSimpleQueue<T>.
Declaration
public T Dequeue()
Returns
Type | Description |
---|---|
T | The first element. |
Dispose()
Properly dispose of the NativeSimpleQueue<T>.
Declaration
public void Dispose()
Enqueue(T, Allocator, NativeArrayOptions)
Add an item
to the NativeSimpleQueue<T> at its end..
Declaration
public void Enqueue(T item, Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
T | item | The typed System.Object to add. |
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |
GetElementAt(Int32)
Retrieve the element at the provided index
.
Declaration
public T GetElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The target System.Object index. |
Returns
Type | Description |
---|---|
T | The target element. |
Peek()
Retrieve the first element from the NativeSimpleQueue<T>.
Declaration
public T Peek()
Returns
Type | Description |
---|---|
T | The first element. |
TrimExcess(Allocator, NativeArrayOptions)
Shrink the capacity of the NativeSimpleQueue<T> to fit its contents.
Declaration
public void TrimExcess(Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |