mifluz

WordKeyInfo.h

Go to the documentation of this file.
00001 // WordKeyInfo.h
00002 //
00003 // NAME
00004 // information on the key structure of the inverted index.
00005 //
00006 // SYNOPSIS
00007 //
00008 // Helper for the WordKey class.
00009 //
00010 // DESCRIPTION
00011 //
00012 // Describe the structure of the index key (<i>WordKey</i>).
00013 // The description includes the layout of the packed version
00014 // stored on disk.
00015 //
00016 // CONFIGURATION
00017 //
00018 // wordlist_wordkey_description <desc> (no default)
00019 // Describe the structure of the inverted index key.
00020 // In the following explanation of the <i><desc></i> format,
00021 // mandatory words are
00022 // in bold and values that must be replaced in italic.
00023 // <br>
00024 // <b>Word</b> <i>bits/name bits</i>[/...]
00025 // <br>
00026 // The <i>name</i> is an alphanumerical symbolic name for the key field.
00027 // The <i>bits</i> is the number of bits required to store this field.
00028 // Note that all values are stored in unsigned integers (unsigned int).
00029 // Example:
00030 // <pre>
00031 // Word 8/Document 16/Location 8
00032 // </pre>
00033 //
00034 //
00035 // END
00036 // 
00037 // Part of the ht://Dig package <http://www.htdig.org/>
00038 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group
00039 // For copyright details, see the file COPYING in your distribution
00040 // or the GNU General Public License version 2 or later
00041 // <http://www.gnu.org/copyleft/gpl.html>
00042 //
00043 //
00044 
00045 #ifndef _WordKeyInfo_h_
00046 #define _WordKeyInfo_h_
00047 
00048 #include "Configuration.h"
00049 
00050 //
00051 // Maximum number of fields in a key description
00052 //
00053 #define WORD_KEY_MAX_NFIELDS 7
00054 
00055 #ifndef SWIG
00056 //
00057 // All numerical fields of the key are typed WordKeyNum.
00058 // Most of the code strongly assume that it is unsigned. 
00059 // Mainly provided to be replaced by unsigned longlong WordKeyNum
00060 // for 64 bits machines.
00061 //
00062 typedef unsigned int WordKeyNum;
00063 
00064 //
00065 // Maximum number of bits in a field
00066 //
00067 #define WORD_KEY_MAXBITS ((int)(sizeof(WordKeyNum) * 8))
00068 #define WORD_KEY_MAXVALUE ((WordKeyNum)~(WordKeyNum)0)
00069 
00070 //
00071 // Description of a single field
00072 //
00073 class WordKeyField
00074 {
00075 public:
00076 WordKeyField() {
00077 bits = 0;
00078 }
00079 
00080 inline WordKeyNum MaxValue() const {
00081 if(bits == 32) return 0xffffffff;
00082 else return ((1 << bits) - 1);
00083 }
00084 
00085 int bits; // Size of field in bits
00086 String name; // Symbolic name of the field
00087 };
00088 #endif /* SWIG */
00089 
00090 //
00091 // Description of the key structure
00092 //
00093 class WordKeyInfo 
00094 {
00095 public:
00096 WordKeyInfo(const Configuration& config);
00097 
00098 #ifndef SWIG
00099 
00100 int Set(const String &desc);
00101 
00102 #endif /* SWIG */
00103 
00104 inline int NFields() { return nfields; }
00105 #ifndef SWIG
00106 inline WordKeyNum MaxValue(int position) { return fields[position].MaxValue(); }
00107 
00108 //
00109 // Array describing the fields, in sort order.
00110 //
00111 WordKeyField fields[WORD_KEY_MAX_NFIELDS];
00112 //
00113 // Total number of fields
00114 //
00115 int nfields;
00116 #endif /* SWIG */
00117 };
00118 
00119 #endif

Generated on Sun Jun 8 10:56:40 2008 for GNUmifluz by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /