Struct ListBuffer<T>
A list that stores value on a provided memory buffer.
Usually use this to have a list on stack allocated memory.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public struct ListBuffer<T> where T : unmanaged
Type Parameters
Name | Description |
---|---|
T | The type of the data stored in the list. |
Constructors
ListBuffer(T*, int*, int)
Instantiate a new list.
Declaration
public ListBuffer(T* bufferPtr, int* countPtr, int capacity)
Parameters
Type | Name | Description |
---|---|---|
T* | bufferPtr | The address in memory to store the data. |
int* | countPtr | The address in memory to store the number of item of this list.. |
int | capacity | The number of |
Properties
Capacity
The maximum number of item stored in this list.
Declaration
public int Capacity { get; }
Property Value
Type | Description |
---|---|
int |
Count
The number of item in the list.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Get an item from the list.
Declaration
public ref T this[in int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the item to get. |
Property Value
Type | Description |
---|---|
T | A reference to the item. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | If the index is invalid. |
Methods
CopyTo(T*, int, int)
Copy the content of this list into another buffer in memory.
Safety:
- The destination must have enough memory to receive the copied data.
Declaration
public void CopyTo(T* dstBuffer, int startDstIndex, int copyCount)
Parameters
Type | Name | Description |
---|---|---|
T* | dstBuffer | The destination buffer of the copy operation. |
int | startDstIndex | The index of the first element that will be copied in the destination buffer. |
int | copyCount | The number of item to copy. |
GetUnchecked(in int)
Get an item from the list.
Safety: index must be inside the bounds of the list.
Declaration
public ref T GetUnchecked(in int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the item to get. |
Returns
Type | Description |
---|---|
T | A reference to the item. |
TryAdd(in T)
Try to add a value in the list.
Declaration
public bool TryAdd(in T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | A reference to the value to add. |
Returns
Type | Description |
---|---|
bool | when the value was added,
when the value was not added because the capacity was reached.
|
TryCopyFrom(T*, int)
Try to copy the data from a buffer in this list.
Declaration
public bool TryCopyFrom(T* srcPtr, int count)
Parameters
Type | Name | Description |
---|---|---|
T* | srcPtr | The pointer of the source memory to copy. |
int | count | The number of item to copy from the source buffer. |
Returns
Type | Description |
---|---|
bool |
|
TryCopyTo(ListBuffer<T>)
Try to copy the list into another list.
Declaration
public bool TryCopyTo(ListBuffer<T> other)
Parameters
Type | Name | Description |
---|---|---|
ListBuffer<T> | other | The destination of the copy. |
Returns
Type | Description |
---|---|
bool |
|