2#ifndef _aspose_system_collections_concurrent_dictionary_h_
3#define _aspose_system_collections_concurrent_dictionary_h_
5#include <system/collections/dictionary.h>
6#include <system/collections/keyvalue_pair.h>
48template<
class TKey,
class TValue>
59 RTTI_INFO_TEMPLATE_CLASS(
ThisType, System::BaseTypesInfo<BaseType>);
65 virtual void idx_set(
const TKey& key, TValue value)
override
67 LockContext __guard(
this);
68 BaseType::idx_set(key, value);
76 LockContext __guard(
const_cast<ThisType*
>(
this));
77 keys = BaseType::get_KeysInternal();
91 LockContext __guard(
const_cast<ThisType*
>(
this));
92 values = BaseType::get_ValuesInternal();
101 bool TryAdd(
const TKey& key,
const TValue& value)
105 LockContext __guard(
this);
106 if (!BaseType::ContainsKey(key))
108 BaseType::Add(key, value);
117 virtual void Add(
const TKey& key,
const TValue& value)
override
119 LockContext __guard(
this);
120 BaseType::Add(key, value);
125 LockContext __guard(
this);
133 LockContext __guard(
this);
134 BaseType::CopyTo(arr, index);
139 virtual bool Remove(
const TKey& key)
override
143 LockContext __guard(
this);
144 value = BaseType::Remove(key);
Thread-safe dictionary implementation. Objects of this class should only be allocated using System::M...
Definition: concurrent_dictionary.h:50
virtual void Add(const TKey &key, const TValue &value) override
Adds value into dictionary.
Definition: concurrent_dictionary.h:117
virtual SharedPtr< typename ThisType::ValueCollection > get_ValuesInternal() const override
Gets wrapper collection to access dictionary values.
Definition: concurrent_dictionary.h:87
~ConcurrentDictionary() override
Destructor.
Definition: concurrent_dictionary.h:83
virtual SharedPtr< typename ThisType::KeyCollection > get_KeysInternal() const override
Gets wrapper collection to access dictionary keys.
Definition: concurrent_dictionary.h:72
virtual void CopyTo(ArrayPtr< System::Collections::Generic::KeyValuePair< TKey, TValue > > arr, int index) override
Copies container elements to existing array elements.
Definition: concurrent_dictionary.h:131
virtual void idx_set(const TKey &key, TValue value) override
Sets element at specific position.
Definition: concurrent_dictionary.h:65
virtual bool Remove(const TKey &key) override
Removes element from container.
Definition: concurrent_dictionary.h:139
bool TryAdd(const TKey &key, const TValue &value)
Tries to add key/value pair into the dictionary.
Definition: concurrent_dictionary.h:101
virtual void Clear() override
Deletes all elements in container.
Definition: concurrent_dictionary.h:123
Forward declaration of Dictionary class.
Definition: dictionary.h:96
Pair of key and value. This type should be allocated on stack and passed to functions by value or by ...
Definition: keyvalue_pair.h:20
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: db_command.h:9