00001 // 00002 // WordDBCompress.h 00003 // 00004 // Part of the ht://Dig package <http://www.htdig.org/> 00005 // Copyright (c) 1999 The ht://Dig Group 00006 // For copyright details, see the file COPYING in your distribution 00007 // or the GNU Public License version 2 or later 00008 // <http://www.gnu.org/copyleft/gpl.html> 00009 // 00010 // $Id: WordDBCompress_8h-source.html,v 1.1 2008年06月08日 10:13:05 sebdiaz Exp $ 00011 // 00012 00013 #ifndef _WordDBCompress_h_ 00014 #define _WordDBCompress_h_ 00015 00016 #include "WordDBCompress.h" 00017 00018 #include "db.h" 00019 00020 class WordMonitor; 00021 class WordDBEncoded; 00022 class WordContext; 00023 00024 class WordDBCompress 00025 { 00026 public: 00027 WordDBCompress(WordContext* ncontext); 00028 ~WordDBCompress(); 00029 00030 // 00031 // Entry points 00032 // 00033 int Compress(const unsigned char* inbuff, int inbuff_length, unsigned char** outbuffp, int* outbuff_lengthp); 00034 int Uncompress(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int outbuff_length); 00035 00036 int CompressBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int* outbuff_lengthp); 00037 int CompressIBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int* outbuff_lengthp); 00038 int CompressLBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int* outbuff_lengthp); 00039 00040 int UncompressBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int outbuff_length); 00041 int UncompressIBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int outbuff_length); 00042 int UncompressLBtree(const unsigned char* inbuff, int inbuff_length, unsigned char* outbuff, int outbuff_length); 00043 00044 // 00045 // Return a new DB_CMPR_INFO initialized with characteristics of the 00046 // current object and suitable as WordDB::CmprInfo argument. 00047 // 00048 DB_CMPR_INFO *CmprInfo(); 00049 00050 //- 00051 // Return a pointer to the WordContext object used to create 00052 // this instance. 00053 // 00054 inline WordContext* GetContext() { return context; } 00055 00056 // 00057 // Debugging 00058 // 00059 void DumpPage(const unsigned char* page) const; 00060 int DiffPage(const unsigned char* first, const unsigned char* second) const; 00061 00062 private: 00063 DB_CMPR_INFO *cmprInfo; 00064 WordContext *context; 00065 WordDBEncoded *encoded; 00066 00067 int verbose; 00068 int debug; 00069 }; 00070 00071 #endif /* _WordDB_h */