Ejemplo n.º 1
0
        public virtual void Put(IPersistent obj, int mask)
        {
            StorageImpl db = (StorageImpl) Storage;
            if (db == null)
            {
                throw new StorageError(StorageError.DELETED_OBJECT);
            }

            if (!obj.IsPersistent())
            {
                db.MakePersistent(obj);
            }

            Key ins = new Key(mask, obj.Oid);
            if (root == 0)
            {
                root = BitIndexPage.Allocate(db, 0, ins);
                height = 1;
            }
            else
            {
                int result = BitIndexPage.Insert(db, root, ins, height);
                if (result == op_overflow)
                {
                    root = BitIndexPage.Allocate(db, root, ins);
                    height += 1;
                }
            }

            updateCounter += 1;
            nElems += 1;
            Modify();
        }
Ejemplo n.º 2
0
 public bool Add(IPersistent o)
 {
     if (!o.IsPersistent())
     {
         ((StorageImpl)Storage).storeObject(o);
     }
     return(base.Put(new Key(o), o));
 }
Ejemplo n.º 3
0
 public void Unpin()
 {
     for (int i = 0, n = used; i < n; i++)
     {
         IPersistent elem = arr[i];
         if (elem != null && !elem.IsRaw() && elem.IsPersistent())
         {
             arr[i] = new PersistentStub(elem.Storage, elem.Oid);
         }
     }
 }
Ejemplo n.º 4
0
 public void Put(Rectangle r, IPersistent obj)
 {
     if (!obj.IsPersistent())
     {
         ((StorageImpl)Storage).storeObject(obj);
     }
     if (root == null)
     {
         root   = new RtreePage(obj, r);
         height = 1;
     }
     else
     {
         RtreePage p = root.insert(r, obj, height);
         if (p != null)
         {
             root    = new RtreePage(root, p);
             height += 1;
         }
     }
     n += 1;
     Modify();
 }
Ejemplo n.º 5
0
 protected internal virtual int Swizzle(IPersistent obj)
 {
     int oid = 0;
     if (obj != null)
     {
         if (!obj.IsPersistent())
         {
             StoreObject0(obj);
         }
         oid = obj.Oid;
     }
     return oid;
 }
Ejemplo n.º 6
0
 public virtual void SetRoot(IPersistent root)
 {
     lock (this)
     {
         if (!opened)
             throw new StorageError(StorageError.STORAGE_NOT_OPENED);
         if (!root.IsPersistent())
         {
             StoreObject0(root);
         }
         header.root[1 - currIndex].rootObject = root.Oid;
         modified = true;
     }
 }