Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    DictionaryStore<TKey, TValue> Class

    Namespace: Stride.Core.IO
    Assembly: Stride.Core.Serialization.dll

    A Key->Value store that will be incrementally saved on the HDD. Thread-safe and process-safe.

    System.Object → Store<System.Collections.Generic.KeyValuePair<TKey, TValue>> → DictionaryStore<TKey, TValue>
    Derived from DictionaryStore<TKey, TValue>: ContentIndexMap

    public class DictionaryStore<TKey, TValue> : Store<KeyValuePair<TKey, TValue>>, IDisposable
    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Name Description
    Constructors
    DictionaryStore(Stream)
    Fields
    loadedIdMap
    unsavedIdMap
    Properties
    Item[TKey]

    Gets or sets the item with the specified key.

    Methods
    AddLoaded(KeyValuePair<TKey, TValue>)
    AddUnsaved(KeyValuePair<TKey, TValue>, Int32)
    Contains(TKey)

    Gets or sets the item with the specified key.

    GetPendingItems(Int32)
    GetValues()

    Gets the values stored including unsaved.

    RemoveUnsaved(KeyValuePair<TKey, TValue>, Int32)
    ResetInternal()
    SearchValues(Func<KeyValuePair<TKey, TValue>, Boolean>)
    TryGetValue(TKey, out TValue)

    Tries to get the value from its key.

    | Improve this Doc View Source

    Constructors


    DictionaryStore(Stream)

    public DictionaryStore(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream
    | Improve this Doc View Source

    Fields


    loadedIdMap

    protected readonly Dictionary<TKey, TValue> loadedIdMap
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<TKey, TValue>

    unsavedIdMap

    protected readonly Dictionary<TKey, DictionaryStore<TKey, TValue>.UnsavedIdMapEntry> unsavedIdMap
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<TKey, DictionaryStore.UnsavedIdMapEntry<>>
    | Improve this Doc View Source

    Properties


    Item[TKey]

    Gets or sets the item with the specified key.

    public TValue this[TKey key] { get; set; }
    Parameters
    Type Name Description
    TKey key

    The key of the item to get or set.

    Property Value
    Type Description
    TValue

    The item to get or set.

    Exceptions
    Type Condition
    System.Collections.Generic.KeyNotFoundException
    | Improve this Doc View Source

    Methods


    AddLoaded(KeyValuePair<TKey, TValue>)

    protected override void AddLoaded(KeyValuePair<TKey, TValue> item)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, TValue> item
    Overrides
    Stride.Core.IO.Store<System.Collections.Generic.KeyValuePair<TKey, TValue>>.AddLoaded(System.Collections.Generic.KeyValuePair<TKey, TValue>)

    AddUnsaved(KeyValuePair<TKey, TValue>, Int32)

    protected override void AddUnsaved(KeyValuePair<TKey, TValue> item, int currentTransaction)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, TValue> item
    System.Int32 currentTransaction
    Overrides
    Stride.Core.IO.Store<System.Collections.Generic.KeyValuePair<TKey, TValue>>.AddUnsaved(System.Collections.Generic.KeyValuePair<TKey, TValue>, System.Int32)

    Contains(TKey)

    Gets or sets the item with the specified key.

    public bool Contains(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key of the item to get or set.

    Returns
    Type Description
    System.Boolean

    The item to get or set.

    Exceptions
    Type Condition
    System.Collections.Generic.KeyNotFoundException

    GetPendingItems(Int32)

    protected override IEnumerable<KeyValuePair<TKey, TValue>> GetPendingItems(int currentTransaction)
    Parameters
    Type Name Description
    System.Int32 currentTransaction
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    Overrides
    Stride.Core.IO.Store<System.Collections.Generic.KeyValuePair<TKey, TValue>>.GetPendingItems(System.Int32)

    GetValues()

    Gets the values stored including unsaved.

    public KeyValuePair<TKey, TValue>[] GetValues()
    Returns
    Type Description
    System.Collections.Generic.KeyValuePair<TKey, TValue>[]

    Values stored including unsaved.


    RemoveUnsaved(KeyValuePair<TKey, TValue>, Int32)

    protected override void RemoveUnsaved(KeyValuePair<TKey, TValue> item, int currentTransaction)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, TValue> item
    System.Int32 currentTransaction
    Overrides
    Stride.Core.IO.Store<System.Collections.Generic.KeyValuePair<TKey, TValue>>.RemoveUnsaved(System.Collections.Generic.KeyValuePair<TKey, TValue>, System.Int32)

    ResetInternal()

    protected override void ResetInternal()
    Overrides
    Stride.Core.IO.Store<System.Collections.Generic.KeyValuePair<TKey, TValue>>.ResetInternal()

    SearchValues(Func<KeyValuePair<TKey, TValue>, Boolean>)

    public IEnumerable<KeyValuePair<TKey, TValue>> SearchValues(Func<KeyValuePair<TKey, TValue>, bool> predicate)
    Parameters
    Type Name Description
    System.Func<System.Collections.Generic.KeyValuePair<TKey, TValue>, System.Boolean> predicate
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>

    TryGetValue(TKey, out TValue)

    Tries to get the value from its key.

    public bool TryGetValue(TKey key, out TValue value)
    Parameters
    Type Name Description
    TKey key

    The key.

    TValue value

    The value.

    Returns
    Type Description
    System.Boolean

    Inherited Members

    Store<KeyValuePair<TKey, TValue>>.stream
    Store<KeyValuePair<TKey, TValue>>.transaction
    Store<KeyValuePair<TKey, TValue>>.lockObject
    Store<KeyValuePair<TKey, TValue>>.UseTransaction
    Store<KeyValuePair<TKey, TValue>>.AutoLoadNewValues
    Store<KeyValuePair<TKey, TValue>>.Dispose()
    Store<KeyValuePair<TKey, TValue>>.AddValues(IEnumerable<KeyValuePair<TKey, TValue>>)
    Store<KeyValuePair<TKey, TValue>>.AddValue(KeyValuePair<TKey, TValue>)
    Store<KeyValuePair<TKey, TValue>>.Save()
    Store<KeyValuePair<TKey, TValue>>.Reset()
    Store<KeyValuePair<TKey, TValue>>.ResetInternal()
    Store<KeyValuePair<TKey, TValue>>.LoadNewValues()
    Store<KeyValuePair<TKey, TValue>>.AddUnsaved(KeyValuePair<TKey, TValue>, Int32)
    Store<KeyValuePair<TKey, TValue>>.RemoveUnsaved(KeyValuePair<TKey, TValue>, Int32)
    Store<KeyValuePair<TKey, TValue>>.RemoveUnsaved(IEnumerable<KeyValuePair<TKey, TValue>>, Int32)
    Store<KeyValuePair<TKey, TValue>>.AddLoaded(KeyValuePair<TKey, TValue>)
    Store<KeyValuePair<TKey, TValue>>.GetPendingItems(Int32)
    Store<KeyValuePair<TKey, TValue>>.BuildContext(Stream)
    Store<KeyValuePair<TKey, TValue>>.ReadEntries(Stream)
    Store<KeyValuePair<TKey, TValue>>.WriteEntry(Stream, KeyValuePair<TKey, TValue>)

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation