WordList.cc

Go to the documentation of this file.
00001 //
00002 // WordList.cc
00003 //
00004 // Part of the ht://Dig package   <http://www.htdig.org/>
00005 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group
00006 // For copyright details, see the file COPYING in your distribution
00007 // or the GNU General Public License version 2 or later
00008 // <http://www.gnu.org/copyleft/gpl.html>
00009 //
00010 // $Id: WordList_8cc-source.html,v 1.1 2008/06/08 10:13:15 sebdiaz Exp $
00011 //
00012 
00013 #ifdef HAVE_CONFIG_H
00014 #include "config.h"
00015 #endif /* HAVE_CONFIG_H */
00016 
00017 #include "WordList.h"
00018 #include "WordDBCache.h"
00019 
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <ctype.h>
00023 #include <errno.h>
00024 
00025 static int word_db_qcmp(WordContext* context, const WordDBCacheEntry *a, const WordDBCacheEntry *b)
00026 {
00027   return WordKey::Compare(context, (const unsigned char*)a->key, a->key_size, (const unsigned char*)b->key, b->key_size);
00028 }
00029 
00030 // *****************************************************************************
00031 void
00032 WordList::BatchStart()
00033 {
00034   if(caches) BatchEnd();
00035 
00036   Configuration& config = context->GetConfiguration();
00037   int cache_size = config.Value("wordlist_cache_size", 0);
00038   if(cache_size < 1 * 1024 * 1024) cache_size = 1 * 1024 * 1024;
00039   int cache_max = config.Value("wordlist_cache_max", 0);
00040 
00041   caches = new WordDBCaches(this, 50, cache_size, cache_max);
00042   caches->CacheCompare(word_db_qcmp);
00043 }
00044 
00045 // *****************************************************************************
00046 void
00047 WordList::BatchEnd()
00048 {
00049   if(caches) {
00050     delete caches;
00051     caches = 0;
00052   }
00053 }

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