Class NativeHashSetDataLayer<TItem>
Base class for all data layers that are based on NativeHashSet{T}.
Inherited Members
Namespace: Fwt.Core.DataLayers
Assembly: fwt.core.dll
Syntax
public abstract class NativeHashSetDataLayer<TItem> : DataLayer, IDisposable, ICommitChanges where TItem : unmanaged, IEquatable<TItem>
Type Parameters
| Name | Description |
|---|---|
| TItem | type of data stored in the layer |
Fields
_data
Declaration
protected NativeHashSet<TItem> _data
Field Value
| Type | Description |
|---|---|
| NativeHashSet<TItem> |
Properties
Data
Container for data in the layer.
Declaration
public NativeHashSet<TItem> Data { get; }
Property Value
| Type | Description |
|---|---|
| NativeHashSet<TItem> |
Length
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 layer.
Declaration
public virtual bool Add(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 |
Contains(TItem)
Checks if the layer contains the specified item.
Declaration
public virtual bool Contains(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | data to check if it is in the layer |
Returns
| Type | Description |
|---|---|
| bool | true if data was found |
Dispose()
Disposes the 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 specified 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.
Declaration
public virtual void Init(int layerSize, Allocator allocator = Allocator.Persistent)
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerSize | |
| Allocator | allocator |
Remove(TItem)
Removes an item from the layer.
Declaration
public virtual bool Remove(TItem value)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem | value | data to remove from layer |
Returns
| Type | Description |
|---|---|
| bool | true if data was in the layer |
SafeAdd(TItem)
Adds an item to the layer if the layer is initialized.
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 |
SafeContains(TItem)
Checks if the layer contains the specified item if the layer is initialized.
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 in the layer |
SafeRemove(TItem)
Removes an item from the layer if the layer is initialized.
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 |