00001 // 00002 // WordMeta.h 00003 // 00004 // NAME 00005 // 00006 // abstract class to manage and use an inverted index file. 00007 // 00008 // SYNOPSIS 00009 // 00010 // #include <mifluz.h> 00011 // 00012 // WordContext context; 00013 // 00014 // WordMeta* words = context->Meta(); 00015 // 00016 // delete words; 00017 // 00018 // DESCRIPTION 00019 // 00020 // WordMeta is the <i>mifluz</i> equivalent of a database handler. Each 00021 // WordMeta object is bound to an inverted index file and implements the 00022 // operations to create it, fill it with word occurrences and search 00023 // for an entry matching a given criterion. 00024 // 00025 // WordMeta is an abstract class and cannot be instanciated. 00026 // The <b>Meta</b> method of the class WordContext will create 00027 // an instance using the appropriate derived class, either WordMetaOne 00028 // or WordMetaMulti. Refer to the corresponding manual pages for 00029 // more information on their specific semantic. 00030 // 00031 // 00032 // 00033 // END 00034 // 00035 // Part of the ht://Dig package <http://www.htdig.org/> 00036 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group 00037 // For copyright details, see the file COPYING in your distribution 00038 // or the GNU General Public License version 2 or later 00039 // <http://www.gnu.org/copyleft/gpl.html> 00040 // 00041 // $Id: WordMeta_8h-source.html,v 1.1 2008/06/08 10:13:16 sebdiaz Exp $ 00042 // 00043 00044 #ifndef _WordMeta_h_ 00045 #define _WordMeta_h_ 00046 00047 #include <stdio.h> 00048 00049 #include "htString.h" 00050 #include "WordDB.h" 00051 00052 class WordContext; 00053 class WordLock; 00054 class WordMetaImp; 00055 00056 // 00057 // Serial number range [1-2^32] 00058 // 00059 #define WORD_META_SERIAL_INVALID 0 00060 00061 #define WORD_META_SERIAL_WORD 0 00062 #define WORD_META_SERIAL_FILE 1 00063 00064 class WordMeta 00065 { 00066 public: 00067 WordMeta() { words = 0; db = 0; imp = 0; } 00068 ~WordMeta(); 00069 00070 int Initialize(WordList* words); 00071 00072 int Open(); 00073 int Close(); 00074 00075 int Serial(int what, unsigned int& serial); 00076 int GetSerial(int what, unsigned int& serial); 00077 int SetSerial(int what, unsigned int serial); 00078 00079 int Lock(const String& resource, WordLock*& lock); 00080 int Unlock(const String& resource, WordLock*& lock); 00081 00082 private: 00083 WordList *words; 00084 WordDB *db; 00085 WordMetaImp *imp; 00086 }; 00087 #endif /* _WordMeta_h_ */