11 #ifndef __RD_EXPLICITBITVECTS_H__ 12 #define __RD_EXPLICITBITVECTS_H__ 15 #include <boost/dynamic_bitset.hpp> 33 :
dp_bits(0), d_size(0), d_numOnBits(0) {
46 :
dp_bits(bits), d_size(static_cast<unsigned int>(bits->size())),
47 d_numOnBits(static_cast<unsigned int>(bits->count())){};
52 bool operator[](
const unsigned int which)
const;
53 bool setBit(
const unsigned int which);
54 bool unsetBit(
const unsigned int which);
55 bool getBit(
const unsigned int which)
const;
90 unsigned int d_numOnBits;
91 void _initForSize(
const unsigned int size);
bool operator[](const unsigned int which) const
bool unsetBit(const unsigned int which)
unsets a particular bit and returns its original value
void getOnBits(IntVect &v) const
replaces the contents of v with indices of our on bits
ExplicitBitVect operator~() const
ExplicitBitVect & operator^=(const ExplicitBitVect &other)
boost::dynamic_bitset * dp_bits
our raw storage
ExplicitBitVect operator &(const ExplicitBitVect &other) const
unsigned int getNumBits() const
returns the number of bits (the length of the BitVect)
void clearBits()
clears (sets to off) all of our bits
bool operator==(const ExplicitBitVect &o) const
ExplicitBitVect(boost::dynamic_bitset<> *bits)
construct directly from a dynamic_bitset pointer
ExplicitBitVect & operator=(const ExplicitBitVect &other)
ExplicitBitVect & operator+=(const ExplicitBitVect &other)
ExplicitBitVect(unsigned int size)
initialize with a particular size;
ExplicitBitVect operator+(const ExplicitBitVect &other) const
bool operator!=(const ExplicitBitVect &o) const
unsigned int size() const
ExplicitBitVect & operator &=(const ExplicitBitVect &other)
bool setBit(const unsigned int which)
sets a particular bit and returns its original value
bool getBit(const unsigned int which) const
returns the value of a particular bit
ExplicitBitVect & operator|=(const ExplicitBitVect &other)
std::string toString() const
returns a serialized (pickled) version of this BitVect
unsigned int getNumOnBits() const
returns the number of on bits
ExplicitBitVect operator^(const ExplicitBitVect &other) const
std::vector< int > IntVect
unsigned int getNumOffBits() const
returns the number of off bits
a class for bit vectors that are densely occupied
ExplicitBitVect operator|(const ExplicitBitVect &other) const
Abstract base class for storing BitVectors.