Main Page   Class Hierarchy   Compound List   File List   Compound Members  

container.h

00001 //-< CONTAINER.H >---------------------------------------------------*--------*
00002 // GigaBASE                  Version 1.0         (c) 1999  GARRET    *     ?  *
00003 // (Post Relational Database Management System)                      *   /\|  *
00004 //                                                                   *  /  \  *
00005 //                          Created:     04-Jun-2000  K.A. Knizhnik  * / [] \ *
00006 //                          Last update: 04-Jun-2000  K.A. Knizhnik  * GARRET *
00007 //-------------------------------------------------------------------*--------*
00008 // B-Tree object container
00009 //-------------------------------------------------------------------*--------*
00010 
00011 #ifndef __CONTAINER_H__
00012 #define __CONTAINER_H__
00013 
00014 BEGIN_GIGABASE_NAMESPACE
00015 
00019 enum SpatialSearchType { 
00020     SPATIAL_SEARCH_EQUAL,
00021     SPATIAL_SEARCH_OVERLAPS,
00022     SPATIAL_SEARCH_SUPERSET,
00023     SPATIAL_SEARCH_PROPER_SUPERSE,
00024     SPATIAL_SEARCH_SUBSET,
00025     SPATIAL_SEARCH_PROPER_SUBSET
00026 };
00027 
00032 class GIGABASE_DLL_ENTRY dbAnyContainer : public dbAnyReference {
00033   protected:
00034     dbFieldDescriptor* fd;
00035 
00036     void create(dbDatabase* db, bool caseInsensitive = false, bool thick = false);
00037     void purge(dbDatabase* db);
00038     void free(dbDatabase* db);
00039     void add(dbDatabase* db, dbAnyReference const& ref);
00040     void remove(dbDatabase* db, dbAnyReference const& ref);
00041     int  search(dbAnyCursor& cursor, void const* from, void const* till, bool ascent = true);
00042     int  spatialSearch(dbAnyCursor& cursor, rectangle const& r, SpatialSearchType type);
00043 
00044     dbAnyContainer(char_t const* fieldName, dbTableDescriptor& desc);
00045 };
00046 
00047 
00051 template<class T>
00052 class dbContainer : public dbAnyContainer {
00053   public:
00062     int search(dbCursor<T>& cursor, void const* from, void const* till, bool ascent = true) {
00063         return dbAnyContainer::search(cursor, from, till, ascent);
00064     }
00071     int search(dbCursor<T>& cursor, void const* key) {
00072         return dbAnyContainer::search(cursor, key, key, true);
00073     }
00074 
00081     int search(dbCursor<T>& cursor, bool ascent = true) {
00082         return dbAnyContainer::search(cursor, NULL, NULL, ascent);
00083     }
00084 
00092     int spatialSearch(dbCursor<T>& cursor, rectangle const& r, SpatialSearchType type) { 
00093         return dbAnyContainer::spatialSearch(cursor, r, type);
00094     }
00095         
00101     void create(bool caseInsensitive = false) {
00102         dbAnyContainer::create(T::dbDescriptor.getDatabase(), caseInsensitive);
00103     }
00104 
00108     void purge() {
00109         dbAnyContainer::purge(T::dbDescriptor.getDatabase());
00110     }
00111 
00115     void free() {
00116         dbAnyContainer::free(T::dbDescriptor.getDatabase());
00117     }
00118 
00123     void add(dbReference<T> const& ref) {
00124         dbAnyContainer::add(T::dbDescriptor.getDatabase(), ref);
00125     }
00126 
00131     void remove(dbReference<T> const& ref) {
00132         dbAnyContainer::remove(T::dbDescriptor.getDatabase(), ref);
00133     }
00134 
00139     dbContainer(const char_t* fieldName) : dbAnyContainer(fieldName, T::dbDescriptor) {}
00140     
00145     void create(dbDatabase* db) {
00146         dbAnyContainer::create(db);
00147     }
00148 
00153     void purge(dbDatabase* db) {
00154         dbAnyContainer::purge(db);
00155     }
00156 
00161     void free(dbDatabase* db) {
00162         dbAnyContainer::free(db);
00163     }
00164 
00170     void add(dbDatabase* db, dbReference<T> const& ref) {
00171         dbAnyContainer::add(db, ref);
00172     }
00173 
00179     void remove(dbDatabase* db, dbReference<T> const& ref) {
00180         dbAnyContainer::remove(db, ref);
00181     }
00182 
00188     dbContainer(dbDatabase* db, const char_t* fieldName) 
00189     : dbAnyContainer(fieldName, *db->lookupTable(&T::dbDescriptor)) {}
00190 };
00191 
00192 END_GIGABASE_NAMESPACE
00193 
00194 #endif
00195 
00196 
00197 
00198 

Generated on Mon Oct 23 13:22:58 2006 for GigaBASE by doxygen1.2.18