Exemplo n.º 1
0
        public void Read <T>(ref T v) where T : IObject
        {
            var typeId = (ushort)0;

            Read(ref typeId);
            if (typeId == 0)
            {
                v = default(T);
                return;
            }
            if (typeId == 1)
            {
                throw new Exception("Read<T> does not support string type");
            }
            if (idxStore != null)
            {
                uint ptr_offset = 0, bb_offset_bak = (uint)this.offset - (uint)offsetRoot;
                Read(ref ptr_offset);
                if (ptr_offset == bb_offset_bak)
                {
                    v = (T)CreateByTypeId(typeId);
                    System.Diagnostics.Debug.Assert(v != null);
                    idxStore.Add(ptr_offset, v);
                    v.FromBBuffer(this);
                }
                else
                {
                    int idx = idxStore.Find(ptr_offset);
                    if (idx == -1)
                    {
                        throw new Exception("ptr_offset is not found");
                    }
                    v = (T)idxStore.ValueAt(idx);
                    System.Diagnostics.Debug.Assert(v != null);
                }
            }
            else
            {
                v = (T)CreateByTypeId(typeId);
                System.Diagnostics.Debug.Assert(v != null);
                v.FromBBuffer(this);
            }
        }
Exemplo n.º 2
0
 public bool Exists1(K1 key1)
 {
     return(d1.Find(key1) != -1);
 }
Exemplo n.º 3
0
 public bool Exists0(K0 key0)
 {
     return(d0.Find(key0) != -1);
 }