CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_util_BitSet_ 00008 #define _lucene_util_BitSet_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "CLucene/store/Directory.h" 00015 00016 CL_NS_DEF(util) 00017 class BitSet:LUCENE_BASE { 00018 int32_t _size; 00019 int32_t _count; 00020 uint8_t *bits; 00021 00022 protected: 00023 BitSet( const BitSet& copy ); 00024 00025 public: 00027 BitSet ( int32_t size ); 00028 BitSet(CL_NS(store)::Directory* d, const char* name); 00029 void write(CL_NS(store)::Directory* d, const char* name); 00030 00032 ~BitSet(); 00033 00035 inline bool get(const int32_t bit) const{ 00036 return (bits[bit >> 3] & (1 << (bit & 7))) != 0; 00037 } 00038 00040 void set(const int32_t bit, bool val=true); 00041 00043 int32_t size() const; 00044 00048 int32_t count(); 00049 BitSet *clone() const; 00050 }; 00051 CL_NS_END 00052 #endif