DictionaryStore<TKey, TValue> Class
Namespace: Stride.Core.IOAssembly: 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. |
|
Constructors
DictionaryStore(Stream)
public DictionaryStore(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream |
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<>> |
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 |
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 |