Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

include/om/omdatabase.h

00001 /* omdatabase.h
00002  *
00003  * ----START-LICENCE----
00004  * Copyright 1999,2000,2001 BrightStation PLC
00005  * Copyright 2002 Ananova Ltd
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020  * USA
00021  * -----END-LICENCE-----
00022  */
00023 
00024 #ifndef OM_HGUARD_OMDATABASE_H
00025 #define OM_HGUARD_OMDATABASE_H
00026 
00027 #include "om/omdocument.h"
00028 #include "om/omsettings.h"
00029 #include "om/ompostlistiterator.h"
00030 #include "om/omtermlistiterator.h"
00031 #include "om/ompositionlistiterator.h"
00032 
00033 class OmWritableDatabase;
00034 
00036 // OmDatabase class
00037 // ================
00038 
00049 class OmDatabase {
00050     public:
00062         void add_database(const OmSettings &params);
00063 
00072         void add_database(const OmDatabase & database);
00073     
00074     public:
00075         class Internal;
00077         Internal *internal;
00078 
00079     protected:
00097         OmDatabase(const OmSettings &params, bool readonly);
00098 
00099     public:
00111         OmDatabase(const OmSettings &params);
00112 
00115         OmDatabase();
00116 
00121         virtual ~OmDatabase();
00122 
00126         OmDatabase(const OmDatabase &other);
00127 
00131         virtual void operator=(const OmDatabase &other);
00132 
00138         void reopen();
00139 
00144         virtual std::string get_description() const;
00145 
00149         OmPostListIterator postlist_begin(const om_termname &tname) const;
00150 
00153         OmPostListIterator postlist_end(const om_termname &tname) const;
00154 
00158         OmTermIterator termlist_begin(om_docid did) const;
00159         
00162         OmTermIterator termlist_end(om_docid did) const;
00163 
00167         OmPositionListIterator positionlist_begin(om_docid did, const om_termname &tname) const;
00168 
00171         OmPositionListIterator positionlist_end(om_docid did, const om_termname &tname) const;
00172 
00175         OmTermIterator allterms_begin() const;
00176 
00179         OmTermIterator allterms_end() const;
00180 
00182         om_doccount get_doccount() const;
00183         
00185         om_doclength get_avlength() const;
00186 
00188         om_doccount get_termfreq(const om_termname & tname) const;
00189 
00196         bool term_exists(const om_termname & tname) const;
00197 
00207         om_termcount get_collection_freq(const om_termname & tname) const;
00208 
00211         om_doclength get_doclength(om_docid did) const;
00212 
00216         void keep_alive();
00217 
00230         OmDocument get_document(om_docid did) const;
00231 };
00232 
00234 // OmWritableDatabase class
00235 // ========================
00236 
00242 class OmWritableDatabase : public OmDatabase {
00243     public:
00255         OmWritableDatabase(const OmSettings &params);
00256 
00263         virtual ~OmWritableDatabase();
00264 
00268         OmWritableDatabase(const OmWritableDatabase &other);
00269 
00277         void operator=(const OmWritableDatabase &other);
00278 
00320         void flush();
00321 
00344         void begin_transaction();
00345 
00372         void commit_transaction();
00373 
00392         void cancel_transaction();
00393 
00423         om_docid add_document(const OmDocument & document);
00424 
00427         // FIXME: document more.
00428         void delete_document(om_docid did);
00429 
00432         // FIXME: document more.
00433         void replace_document(om_docid did, const OmDocument & document);
00434 
00439         std::string get_description() const;
00440 };
00441 
00442 #endif /* OM_HGUARD_OMDATABASE_H */

Documentation for Xapian (version 0.6.0).
Generated on 26 Nov 2002 by Doxygen 1.2.15.