Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BitSet.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef BITSET_H
8 #define BITSET_H
9 
10 #include <boost/dynamic_bitset.hpp>
11 #include "LuceneObject.h"
12 
13 namespace Lucene
14 {
15  class LPPAPI BitSet : public LuceneObject
16  {
17  public:
18  BitSet(uint32_t size = 0);
19  virtual ~BitSet();
20 
22 
23  protected:
24  typedef boost::dynamic_bitset< uint64_t, LuceneAllocator<uint64_t> > bitset_type;
26 
27  public:
28  const uint64_t* getBits();
29  void clear();
30  void clear(uint32_t bitIndex);
31  void fastClear(uint32_t bitIndex);
32  void clear(uint32_t fromIndex, uint32_t toIndex);
33  void fastClear(uint32_t fromIndex, uint32_t toIndex);
34  void set(uint32_t bitIndex);
35  void fastSet(uint32_t bitIndex);
36  void set(uint32_t bitIndex, bool value);
37  void fastSet(uint32_t bitIndex, bool value);
38  void set(uint32_t fromIndex, uint32_t toIndex);
39  void fastSet(uint32_t fromIndex, uint32_t toIndex);
40  void set(uint32_t fromIndex, uint32_t toIndex, bool value);
41  void fastSet(uint32_t fromIndex, uint32_t toIndex, bool value);
42  void flip(uint32_t bitIndex);
43  void fastFlip(uint32_t bitIndex);
44  void flip(uint32_t fromIndex, uint32_t toIndex);
45  void fastFlip(uint32_t fromIndex, uint32_t toIndex);
46  uint32_t size() const;
47  uint32_t numBlocks() const;
48  bool isEmpty() const;
49  bool get(uint32_t bitIndex) const;
50  bool fastGet(uint32_t bitIndex) const;
51  int32_t nextSetBit(uint32_t fromIndex) const;
52  void _and(BitSetPtr set);
53  void _or(BitSetPtr set);
54  void _xor(BitSetPtr set);
55  void andNot(BitSetPtr set);
56  bool intersectsBitSet(BitSetPtr set) const;
57  uint32_t cardinality();
58  void resize(uint32_t size);
59 
60  virtual bool equals(LuceneObjectPtr other);
61  virtual int32_t hashCode();
62  virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
63  };
64 }
65 
66 #endif

clucene.sourceforge.net