Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class DictionaryDataLayer<TKey, TItem>

    Base class for all data layers that use a dictionary as a data structure.

    Inheritance
    object
    DataLayer
    DictionaryDataLayer<TKey, TItem>
    Implements
    IDisposable
    ICommitChanges
    Inherited Members
    DataLayer.IsDisposableItems
    DataLayer._readJobsDependency
    DataLayer.ReadDependency
    DataLayer._writeJobsDependency
    DataLayer.WriteDependency
    DataLayer.CombinedDependency
    DataLayer._isDirty
    DataLayer.IsDirty
    DataLayer._version
    DataLayer.Version
    DataLayer.AddReadDependency(JobHandle)
    DataLayer.AddWriteDependency(JobHandle)
    DataLayer.SetReadDependency(JobHandle)
    DataLayer.SetWriteDependency(JobHandle)
    DataLayer.PrepareToWrite()
    DataLayer.PrepareToRead()
    DataLayer.OpenToRead()
    DataLayer.OpenToWrite()
    DataLayer.CompleteReadJobs()
    DataLayer.CompleteWriteJobs()
    DataLayer.CompleteAllJobs()
    DataLayer.CommitChanges()
    DataLayer.SetDirty(bool)
    DataLayer.Dispose()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Fwt.Core.DataLayers
    Assembly: fwt.core.dll
    Syntax
    public abstract class DictionaryDataLayer<TKey, TItem> : DataLayer, IDisposable, ICommitChanges where TKey : IEquatable<TItem>
    Type Parameters
    Name Description
    TKey

    type of the key in the underlying dictionary

    TItem

    type of the item to store as value in the underlying dictionary

    Fields

    _data

    Declaration
    protected Dictionary<TKey, TItem> _data
    Field Value
    Type Description
    Dictionary<TKey, TItem>

    Properties

    Data

    Container for the data of the layer

    Declaration
    public Dictionary<TKey, TItem> Data { get; }
    Property Value
    Type Description
    Dictionary<TKey, TItem>

    Length

    Returns the number of items in the layer.

    Declaration
    public override int Length { get; }
    Property Value
    Type Description
    int
    Overrides
    DataLayer.Length

    Methods

    DisposeAllItems()

    Disposes all items in the data layer by calling DisposeDataItem() for each item.

    Declaration
    public override void DisposeAllItems()
    Overrides
    DataLayer.DisposeAllItems()

    DisposeDataItem(TItem)

    Disposes the data item if it is IDisposable.

    Declaration
    protected virtual void DisposeDataItem(TItem item)
    Parameters
    Type Name Description
    TItem item

    GetData(TKey)

    Returns the data item at the given key.

    Declaration
    public virtual TItem GetData(TKey key)
    Parameters
    Type Name Description
    TKey key

    key to get data by

    Returns
    Type Description
    TItem

    data found in the layer by provided key

    Init(int, Allocator)

    Initializes/Reinitializes the data layer with a given size.

    Declaration
    public virtual void Init(int layerSize, Allocator allocator = Allocator.Persistent)
    Parameters
    Type Name Description
    int layerSize

    size of the data layer (cells count)

    Allocator allocator

    allocator to create internal collections. Used in classes inherited from this data layer

    SetData(TKey, TItem)

    Sets the data item at the given key.

    Declaration
    public virtual bool SetData(TKey key, TItem value)
    Parameters
    Type Name Description
    TKey key

    key to put data under

    TItem value

    data to put at the cell of provided key

    Returns
    Type Description
    bool

    TryGetData(TKey, out TItem)

    Tries to get the data item at the given key. If nothing is found, returns false and sets the value to default.

    Declaration
    public virtual bool TryGetData(TKey key, out TItem value)
    Parameters
    Type Name Description
    TKey key

    key to find data by

    TItem value

    data from data layer by provided key or default if nothing found

    Returns
    Type Description
    bool

    true if data was found, otherwise - false

    TrySetData(TKey, TItem)

    Tries to set the data item at the given key.

    Declaration
    public virtual bool TrySetData(TKey key, TItem value)
    Parameters
    Type Name Description
    TKey key

    key to put data under

    TItem value

    value to put under the provided key

    Returns
    Type Description
    bool

    true if value was set

    Implements

    IDisposable
    ICommitChanges

    Extension Methods

    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX