CollectionBE.h

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 
00025 #ifndef _EYEDB_COLLECTION_BE_H
00026 #define _EYEDB_COLLECTION_BE_H
00027 
00028 #include <eyedb/IteratorAtom.h>
00029 
00030 namespace eyedb {
00031 
00032   class CollectionBE {
00033 
00034     eyedbsm::Idx *idx1, *idx2;
00035     Oid idx1_oid, idx2_oid;
00036     Oid oid;
00037     Database *db;
00038     DbHandle *dbh;
00039     Class *cls;
00040     Class *coll_class;
00041     eyedblib::int16 dim;
00042     Status status;
00043     eyedblib::int16 item_size;
00044     Bool isref;
00045     Data buff;
00046     int items_cnt;
00047     Bool locked;
00048     Oid inv_oid;
00049     eyedblib::int16 inv_num_item;
00050     const Attribute *inv_item;
00051     Bool inv_item_done;
00052     IndexImpl *idximpl;
00053     AttrIdxContext *idx_ctx;
00054     Bool is_literal;
00055     Bool is_pure_literal;
00056     IteratorAtomType type;
00057 
00058   public:
00059     CollectionBE(Database *, DbHandle *, const Oid *,
00060                  Class *,
00061                  const Oid&, const Oid&,
00062                  eyedbsm::Idx *, eyedbsm::Idx *, int, Bool, const Oid&,
00063                  eyedblib::int16,
00064                  IndexImpl *idximpl,
00065                  Data idx_data, Size idx_data_size,
00066                  Bool _is_literal,
00067                  Bool _is_pure_literal);
00068     CollectionBE(Database *, DbHandle *, const Oid *, Bool);
00069 
00070     void decode(const void* k, IteratorAtom &atom);
00071     void decode(const void* k, Data idr);
00072     IteratorAtomType getType();
00073 
00074     void getIdx(eyedbsm::Idx **, eyedbsm::Idx **);
00075     const Oid& getOid() const;
00076     const Oid& getInvOid() const {return inv_oid;}
00077     const eyedblib::int16 getInvNumItem() const {return inv_num_item;}
00078     const Attribute *getInvItem() const {return inv_item;}
00079     Status getInvItem(Database *, const Attribute*&, Oid&,
00080                       eyedbsm::Idx*&) const;
00081     void setInvItem(const Attribute *_inv_item) {inv_item = _inv_item;}
00082     Data getTempBuff();
00083     eyedblib::int16 getItemSize() const;
00084     Bool getIsRef() const;
00085     Database *getDatabase();
00086     DbHandle *getDbHandle();
00087 
00088     void setItemsCount(int cnt) {items_cnt = cnt;}
00089     int getItemsCount() const {return items_cnt;}
00090 
00091     Bool isBIdx() const {return IDBBOOL(idximpl->getType() == IndexImpl::BTree);}
00092 
00093     Class *getClass(Bool &isref, int&, eyedblib::int16&) const;
00094 
00095     Bool isLocked() const {return locked;}
00096     void unlock() {locked = False;}
00097     Status getStatus() const;
00098     ~CollectionBE();
00099   };
00100 
00101 #define IDB_MAX_HINTS_CNT         8
00102 #define IDB_IMPL_CODE_SIZE (sizeof(char) + sizeof(eyedblib::int16) + sizeof(eyedblib::int32) + sizeof(eyedbsm::Oid) + IDB_MAX_HINTS_CNT * sizeof(eyedblib::int32))
00103 
00104 #define IDB_COLL_OFF_LOCKED        IDB_OBJ_HEAD_SIZE
00105 #define IDB_COLL_OFF_ITEM_SIZE     (IDB_COLL_OFF_LOCKED    + sizeof(char))
00106 #define IDB_COLL_OFF_IMPL_BEGIN    (IDB_COLL_OFF_ITEM_SIZE + sizeof(eyedblib::int16))
00107 #define IDB_COLL_OFF_IMPL_TYPE     IDB_COLL_OFF_IMPL_BEGIN
00108 #define IDB_COLL_OFF_IMPL_DSPID    (IDB_COLL_OFF_IMPL_TYPE + sizeof(char))
00109 #define IDB_COLL_OFF_IMPL_INFO     (IDB_COLL_OFF_IMPL_DSPID + sizeof(eyedblib::int16))
00110 #define IDB_COLL_OFF_IMPL_MTH      (IDB_COLL_OFF_IMPL_INFO + sizeof(eyedblib::int32))
00111 #define IDB_COLL_OFF_IMPL_HINTS    (IDB_COLL_OFF_IMPL_MTH + sizeof(eyedbsm::Oid))
00112 #define IDB_COLL_OFF_IDX1_OID      (IDB_COLL_OFF_IMPL_HINTS + \
00113                                     IDB_MAX_HINTS_CNT * sizeof(eyedblib::int32))
00114 #define IDB_COLL_OFF_IDX2_OID      (IDB_COLL_OFF_IDX1_OID  + sizeof(eyedbsm::Oid))
00115 
00116 #define IDB_COLL_OFF_ITEMS_CNT     (IDB_COLL_OFF_IDX2_OID  + sizeof(eyedbsm::Oid))
00117 #define IDB_COLL_OFF_ITEMS_BOT     (IDB_COLL_OFF_ITEMS_CNT + sizeof(eyedblib::int32))
00118 #define IDB_COLL_OFF_ITEMS_TOP     (IDB_COLL_OFF_ITEMS_BOT + sizeof(eyedblib::int32))
00119 
00120 #define IDB_COLL_OFF_CARD_OID      (IDB_COLL_OFF_ITEMS_TOP + sizeof(eyedblib::int32))
00121 
00122 #define IDB_COLL_OFF_INV_OID       (IDB_COLL_OFF_CARD_OID + sizeof(eyedbsm::Oid))
00123 #define IDB_COLL_OFF_INV_ITEM      (IDB_COLL_OFF_INV_OID  + sizeof(eyedbsm::Oid))
00124 
00125 #define IDB_COLL_OFF_COLL_NAME   (IDB_COLL_OFF_INV_ITEM  + sizeof(eyedblib::int16))
00126 
00127 #define IDB_COLL_SIZE_HEAD       (IDB_COLL_OFF_COLL_NAME)
00128 
00129 #define IDB_COLL_IMPL_CHANGED   (short)0x1273
00130 #define IDB_COLL_IMPL_UNCHANGED (short)0x4e1a
00131 }
00132 
00133 #endif

Generated on Mon Dec 22 18:15:52 2008 for eyedb by  doxygen 1.5.3