Esempio n. 1
0
        public object ReadDictionary(Ice.Dictionary dict)
        {
            Ice.DictionaryInfo dinfo = dict.IceDictInfo;

            int count = ReadSize();

            for (int i = 0; i < count; i++)
            {
                object k, v;
                bool   haveKey, haveValue;

                if (IceChannelUtils.IceByValue(dinfo.keyType))
                {
                    k       = ReadObject(dinfo.keyType);
                    haveKey = true;
                }
                else
                {
                    k = ReadClassInstanceRef();
                    if ((int)k == 0)
                    {
                        throw new InvalidOperationException("Got NULL dictionary key, expected class ref for type " + dinfo.keyType);
                    }
                    else
                    {
                        haveKey = false;
                    }
                }

                if (IceChannelUtils.IceByValue(dinfo.valueType))
                {
                    v         = ReadObject(dinfo.valueType);
                    haveValue = true;
                }
                else
                {
                    v = ReadClassInstanceRef();
                    if ((int)v == 0)
                    {
                        v         = null;
                        haveValue = true;
                    }
                    else
                    {
                        haveValue = false;
                    }
                }

                // if we have both the key and value, we put them in.
                // otherwise, we have to create a patch based on what
                // bits we have.
                if (haveKey && haveValue)
                {
                    dict.Add(k, v);
                }
                else
                {
                    if (haveKey)
                    {
                        _instancePatchList.Add(new DictionaryValuePatchInfo((int)v, dict, k));
                    }
                    else if (haveValue)
                    {
                        _instancePatchList.Add(new DictionaryKeyPatchInfo((int)k, dict, v));
                    }
                    else
                    {
                        _instancePatchList.Add(new DictionaryEntryPatchInfo((int)k, dict, (int)v));
                    }
                }
            }

            return(dict);
        }
Esempio n. 2
0
 public Dictionary (Type k, Type v) {
   IceDictInfo = new Ice.DictionaryInfo ();
   IceDictInfo.keyType = k;
   IceDictInfo.valueType = v;
 }
Esempio n. 3
0
 public Dictionary(Type k, Type v)
 {
     IceDictInfo           = new Ice.DictionaryInfo();
     IceDictInfo.keyType   = k;
     IceDictInfo.valueType = v;
 }
Esempio n. 4
0
 public Dictionary (Ice.DictionaryInfo dinfo) {
   IceDictInfo = dinfo.Clone();
 }
Esempio n. 5
0
 public Dictionary(Ice.DictionaryInfo dinfo)
 {
     IceDictInfo = dinfo.Clone();
 }