Class NativeListChunkedDataLayer<TItem>
Base class for all data layers that are based on NativeList{T}.
Inheritance
Inherited Members
Namespace: Fwt.Core.DataLayers
Assembly: fwt.core.dll
Syntax
public abstract class NativeListChunkedDataLayer<TItem> : ChunkedDataLayer, IDisposable, ICommitChanges, IListDataLayer<TItem> where TItem : unmanaged
Type Parameters
| Name | Description |
|---|---|
| TItem | type of item stored in the layer |
Fields
_data
Declaration
protected NativeList<TItem> _data
Field Value
| Type | Description |
|---|---|
| NativeList<TItem> |
Properties
Data
Container for data in the layer.
Declaration
public NativeList<TItem> Data { get; }
Property Value
| Type | Description |
|---|---|
| NativeList<TItem> |
Length
Number of items in the layer.
Declaration
public override int Length { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
Dispose()
Disposes the data layer, calls DisposeAllItems() DisposeAllItems()
Declaration
public override void Dispose()
Overrides
DisposeAllItems()
Disposes all items in the layer by calling DisposeDataItem() for each DisposeDataItem(TItem)
Declaration
public override void DisposeAllItems()
Overrides
DisposeDataItem(TItem)
Disposes the item in the layer if it is IDisposable.
Declaration
protected virtual void DisposeDataItem(TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | item |
DisposeExcessItems(int)
Disposes items in layer that are in cells of index greater than layerSize.
Declaration
public virtual void DisposeExcessItems(int layerSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerSize | items in cells at index greater than this value will be disposed |
FillData(TItem)
Fills every cell of layer with provided data.
Declaration
public virtual bool FillData(TItem data)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | data | data to fill the layer with |
Returns
| Type | Description |
|---|---|
| bool | true if successfull |
GetData(int)
Gets the data at the specified index.
Declaration
public virtual TItem GetData(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | cell index to get data from |
Returns
| Type | Description |
|---|---|
| TItem | item from the cell at provided index |
Init(int)
Initializes/Reinitializes the data layer with the specified size.
Declaration
public override void Init(int layerSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerSize | amount of cells in the data layer |
Overrides
SetData(int, TItem)
Sets the data at the specified index.
Declaration
public virtual bool SetData(int index, TItem data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | cell index to put data into |
| TItem | data | data to put into the cell at provided index |
Returns
| Type | Description |
|---|---|
| bool |
SetData(TItem[])
Sets data for all cells in the layer. If the provided array is bigger than the layer size, the layer will be resized.
Declaration
public virtual bool SetData(TItem[] source)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem[] | source | source collection to copy data from |
Returns
| Type | Description |
|---|---|
| bool |
TryGetData(int, out TItem)
Tries to get the data at the specified index.
Declaration
public virtual bool TryGetData(int index, out TItem data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | cell index to get data from |
| TItem | data | data from cell at provided index |
Returns
| Type | Description |
|---|---|
| bool | true if data was found |
TrySetData(int, TItem)
Tries to set the data at the specified index.
Declaration
public bool TrySetData(int index, TItem data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | cell index to put data into |
| TItem | data | data to put into the cell at provided index |
Returns
| Type | Description |
|---|---|
| bool | true if data was set |