예제 #1
0
 public override void Clear(ref DictionaryStorage storage)
 {
     foreach (var item in GetItems())
     {
         Remove(item.Key);
     }
 }
 public override void Clear(ref DictionaryStorage storage)
 {
     _storage.Clear(ref storage);
     foreach (var item in GetExtraItems())
     {
         TryRemoveExtraValue(item.Key);
     }
 }
 public override void AddNoLock(ref DictionaryStorage storage, object key, object value)
 {
     if (key is string && TrySetExtraValue((string)key, value))
     {
         return;
     }
     _storage.AddNoLock(ref storage, key, value);
 }
예제 #4
0
        /// <summary>
        /// Adds items from this dictionary into the other dictionary
        /// </summary>
        public virtual void CopyTo(ref DictionaryStorage/*!*/ into)
        {
            Debug.Assert(into != null);

            foreach (KeyValuePair<object, object> kvp in GetItems())
            {
                into.Add(ref into, kvp.Key, kvp.Value);
            }
        }
예제 #5
0
 public override void Add(ref DictionaryStorage storage, object key, object value)
 {
     string strKey = key as string;
     if (strKey != null)
     {
         TotemOps.ScopeSetMember(_context.SharedContext, _scope, strKey, value);
     }
     else
     {
         TotemScopeExtension ext = (TotemScopeExtension)_context.EnsureScopeExtension(_scope);
         ext.EnsureObjectKeys().Add(key, value);
     }
 }
예제 #6
0
        public override void Add(ref DictionaryStorage storage, object key, object value)
        {
            lock (this)
            {
                if (storage == this)
                {
                    CommonDictionaryStorage newStorage = new CommonDictionaryStorage();
                    newStorage.AddNoLock(key, value);
                    storage = newStorage;
                    return;
                }
            }

            // race, try again...
            storage.Add(ref storage, key, value);
        }
예제 #7
0
 public abstract bool Remove(ref DictionaryStorage storage, object key);
예제 #8
0
 public abstract void Clear(ref DictionaryStorage storage);
 public override void AddNoLock(ref DictionaryStorage storage, object key, object value)
 {
     AddNoLock(key, value);
 }
예제 #10
0
 public abstract void Add(ref DictionaryStorage storage, object key, object value);
예제 #11
0
 public virtual void AddNoLock(ref DictionaryStorage storage, object key, object value)
 {
     Add(ref storage, key, value);
 }
예제 #12
0
 public override bool Remove(ref DictionaryStorage storage, object key)
 {
     return false;
 }
예제 #13
0
        public virtual bool TryRemoveValue(ref DictionaryStorage storage, object key, out object value)
        {
            if (TryGetValue(key, out value))
            {
                return Remove(ref storage, key);

            }

            return false;
        }
예제 #14
0
 public override void Clear(ref DictionaryStorage storage)
 {
 }
 public override bool TryRemoveValue(ref DictionaryStorage storage, object key, out object value)
 {
     return TryRemoveValue(key, out value);
 }
 private void UncommonCopyTo(ref DictionaryStorage into)
 {
     for (int i = 0; i < _buckets.Length; i++)
     {
         Bucket curBucket = _buckets[i];
         if (curBucket.Key != null && curBucket.Key != _removed)
         {
             into.AddNoLock(ref into, curBucket.Key, curBucket.Value);
         }
     }
 }
        public DictionaryStorage CopyTo(DictionaryStorage into)
        {
            Debug.Assert(into != null);

            if (_buckets != null)
            {
                using (new OrderedLocker(this, into))
                {
                    CommonDictionaryStorage commonInto = into as CommonDictionaryStorage;
                    if (commonInto != null)
                    {
                        CommonCopyTo(commonInto);
                    }
                    else
                    {
                        UncommonCopyTo(ref into);
                    }
                }
            }

            var nullValue = _nullValue;
            if (nullValue != null)
            {
                into.Add(ref into, null, nullValue.Value);
            }
            return into;
        }
 public override void CopyTo(ref DictionaryStorage/*!*/ into)
 {
     into = CopyTo(into);
 }