Class NativeParallelHashSetDataLayer<TItem>
Base class for all data layers that are based on NativeParallelHashSet{T}.
Inherited Members
Namespace: Fwt.Core.DataLayers
Assembly: fwt.core.dll
Syntax
public abstract class NativeParallelHashSetDataLayer<TItem> : DataLayer, IDisposable, ICommitChanges where TItem : unmanaged, IEquatable<TItem>
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of the items stored in the data layer |
Fields
_data
Declaration
protected NativeParallelHashSet<TItem> _data
Field Value
| Type | Description |
|---|---|
| NativeParallelHashSet<TItem> |
Properties
Data
Container for data in the layer
Declaration
public NativeParallelHashSet<TItem> Data { get; }
Property Value
| Type | Description |
|---|---|
| NativeParallelHashSet<TItem> |
Length
Returns the number of items in the layer.
Declaration
public override int Length { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
Add(TItem)
Adds an item to the data layer.
Declaration
public virtual bool Add(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | item to add to the layer |
Returns
| Type | Description |
|---|---|
| bool | true if value was added, otherwise - false |
Contains(TItem)
Checks if the layer contains the specified item.
Declaration
public virtual bool Contains(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | item to check if in the layer |
Returns
| Type | Description |
|---|---|
| bool | true if item is present in the layer, otherwise - false |
Dispose()
Disposes the data layer, calls DisposeAllItems() DisposeAllItems()
Declaration
public override void Dispose()
Overrides
DisposeAllItems()
Disposes every item in the data layer by calling DisposeDataItem() DisposeDataItem(TItem).
Declaration
public override void DisposeAllItems()
Overrides
DisposeDataItem(TItem)
Disposes the item if it is IDisposable.
Declaration
protected virtual void DisposeDataItem(TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | item |
Init(int, Allocator)
Initializes/Reinitializes the data layer with the specified size. Requires a layer size to be set because NativeParallelHashSet can't be resized in Jobs.
Declaration
public virtual void Init(int layerSize, Allocator allocator = Allocator.Persistent)
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerSize | max amount of items in the layer |
| Allocator | allocator | allocator to create internal collections with |
Remove(TItem)
Removes an item from the data layer.
Declaration
public virtual bool Remove(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | value to remove from layer |
Returns
| Type | Description |
|---|---|
| bool | true if value was in the layer, otherwise - false |
SafeAdd(TItem)
Adds an item to the data layer if the layer is created.
Declaration
public virtual bool SafeAdd(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | data to add into the layer |
Returns
| Type | Description |
|---|---|
| bool | true if data was added, otherwise - false |
SafeContains(TItem)
Checks if the layer contains the specified item if the layer is created.
Declaration
public virtual bool SafeContains(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | data to check if it is in the layer |
Returns
| Type | Description |
|---|---|
| bool | true if data is present in the layer, otherwise - false |
SafeRemove(TItem)
Removes an item from the data layer if the layer is created.
Declaration
public virtual bool SafeRemove(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | data to remove from layer |
Returns
| Type | Description |
|---|---|
| bool | true if data was in the layer, otherwise - false |