Main Page | Class Hierarchy | Class List | File List | Class Members

ttree.h

00001 //-< TTREE.CPP >-----------------------------------------------------*--------*
00002 // FastDB                    Version 1.0         (c) 1999  GARRET    *     ?  *
00003 // (Main Memory Database Management System)                          *   /\|  *
00004 //                                                                   *  /  \  *
00005 //                          Created:     20-Nov-98    K.A. Knizhnik  * / [] \ *
00006 //                          Last update: 10-Dec-98    K.A. Knizhnik  * GARRET *
00007 //-------------------------------------------------------------------*--------*
00008 // T-Tree interface
00009 //-------------------------------------------------------------------*--------*
00010 
00011 #ifndef __TTREE_H__
00012 #define __TTREE_H__
00013 
00014 class FASTDB_DLL_ENTRY dbTtreeNode { 
00015     enum { 
00016         pageSize = 125,
00017         minItems = pageSize - 2 // minimal number of items in internal node
00018     };
00019 
00020   public:
00021     oid_t left;
00022     oid_t right;
00023     int1  balance;
00024     nat2  nItems;
00025     oid_t item[pageSize];
00026 
00027     static oid_t allocate(dbDatabase* db, oid_t recordId);
00028     
00029     static bool  insert(dbDatabase* db, oid_t& nodeId, oid_t recordId, 
00030                         void* key, int type, int sizeofType, dbUDTComparator comparator, int offs);
00031     static int   remove(dbDatabase* db, oid_t& nodeId, oid_t recordId,  
00032                         void* key, int type, int sizeofType, dbUDTComparator comparator, int offs);
00033     static int   balanceRightBranch(dbDatabase* db, oid_t& nodeId);
00034     static int   balanceLeftBranch(dbDatabase* db, oid_t& nodeId);
00035     
00036     static void  purge(dbDatabase* db, oid_t nodeId);
00037 
00038     bool find(dbDatabase* db, dbSearchContext& sc);
00039 
00040     bool traverseForward(dbDatabase* db,dbAnyCursor* cursor);
00041     bool traverseBackward(dbDatabase* db, dbAnyCursor* cursor);
00042     bool traverseForward(dbDatabase* db,dbAnyCursor* cursor,dbExprNode* cond);
00043     bool traverseBackward(dbDatabase* db,dbAnyCursor* cursor,dbExprNode* cond);
00044 };
00045 
00046 class FASTDB_DLL_ENTRY dbTtree { 
00047   protected:
00048     oid_t root;
00049 
00050   public:
00051     static oid_t allocate(dbDatabase* db);
00052     static void  find(dbDatabase* db, oid_t treeId, dbSearchContext& sc);
00053     static void  insert(dbDatabase* db, oid_t treeId, oid_t recordId, 
00054                         int type, int sizeofType, dbUDTComparator comparator, int offs);
00055     static void  remove(dbDatabase* db, oid_t treeId, oid_t recordId,
00056                         int type, int sizeofType, dbUDTComparator comparator, int offs);
00057     static void  drop(dbDatabase* db, oid_t treeId);
00058     static void  purge(dbDatabase* db, oid_t treeId);
00059     
00060     static void  traverseForward(dbDatabase* db, oid_t treeId,
00061                                  dbAnyCursor* cursor);
00062     static void  traverseBackward(dbDatabase* db, oid_t treeId,
00063                                   dbAnyCursor* cursor);
00064     static void  traverseForward(dbDatabase* db, oid_t treeId,
00065                                  dbAnyCursor* cursor, dbExprNode* condition);
00066     static void  traverseBackward(dbDatabase* db, oid_t treeId,
00067                                   dbAnyCursor* cursor, dbExprNode* condition);
00068 };
00069 
00070 
00071 #endif

Generated on Thu Feb 12 13:04:48 2004 for FastDB by doxygen 1.3.5