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-2014 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 public:
17  BitSet(uint32_t size = 0);
18  virtual ~BitSet();
19 
21 
22 protected:
23  typedef boost::dynamic_bitset<uint64_t> bitset_type;
24  bitset_type bitSet;
25 
26 public:
27  const uint64_t* getBits();
28  void clear();
29  void clear(uint32_t bitIndex);
30  void fastClear(uint32_t bitIndex);
31  void clear(uint32_t fromIndex, uint32_t toIndex);
32  void fastClear(uint32_t fromIndex, uint32_t toIndex);
33  void set(uint32_t bitIndex);
34  void fastSet(uint32_t bitIndex);
35  void set(uint32_t bitIndex, bool value);
36  void fastSet(uint32_t bitIndex, bool value);
37  void set(uint32_t fromIndex, uint32_t toIndex);
38  void fastSet(uint32_t fromIndex, uint32_t toIndex);
39  void set(uint32_t fromIndex, uint32_t toIndex, bool value);
40  void fastSet(uint32_t fromIndex, uint32_t toIndex, bool value);
41  void flip(uint32_t bitIndex);
42  void fastFlip(uint32_t bitIndex);
43  void flip(uint32_t fromIndex, uint32_t toIndex);
44  void fastFlip(uint32_t fromIndex, uint32_t toIndex);
45  uint32_t size() const;
46  uint32_t numBlocks() const;
47  bool isEmpty() const;
48  bool get(uint32_t bitIndex) const;
49  bool fastGet(uint32_t bitIndex) const;
50  int32_t nextSetBit(uint32_t fromIndex) const;
51  void _and(const BitSetPtr& set);
52  void _or(const BitSetPtr& set);
53  void _xor(const BitSetPtr& set);
54  void andNot(const BitSetPtr& set);
55  bool intersectsBitSet(const BitSetPtr& set) const;
56  uint32_t cardinality();
57  void resize(uint32_t size);
58 
59  virtual bool equals(const LuceneObjectPtr& other);
60  virtual int32_t hashCode();
61  virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
62 };
63 
64 }
65 
66 #endif
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Base class for all Lucene classes.
Definition: LuceneObject.h:31
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
boost::dynamic_bitset< uint64_t > bitset_type
Definition: BitSet.h:20
boost::shared_ptr< BitSet > BitSetPtr
Definition: LuceneTypes.h:522
Definition: BitSet.h:15
bitset_type bitSet
Definition: BitSet.h:24

clucene.sourceforge.net