12 #ifndef __RD_EXPLICITBITVECTS_H__ 13 #define __RD_EXPLICITBITVECTS_H__ 16 #include <boost/dynamic_bitset.hpp> 34 : dp_bits(0), d_size(0), d_numOnBits(0) {
47 : dp_bits(bits), d_size(static_cast<unsigned int>(bits->size())),
48 d_numOnBits(static_cast<unsigned int>(bits->count())){};
53 bool operator[](
const unsigned int which)
const;
54 bool setBit(
const unsigned int which);
55 bool unsetBit(
const unsigned int which);
56 bool getBit(
const unsigned int which)
const;
91 unsigned int d_numOnBits;
92 void _initForSize(
const unsigned int size);
boost::dynamic_bitset * dp_bits
our raw storage
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
#define RDKIT_DATASTRUCTS_EXPORT
virtual unsigned int getNumBits() const =0
returns the number of bits (the length of the BitVect)
ExplicitBitVect(unsigned int size)
initialize with a particular size;
virtual bool unsetBit(const unsigned int which)=0
unsets a particular bit and returns its original value
virtual bool operator[](const unsigned int which) const =0
bool operator!=(const ExplicitBitVect &o) const
virtual unsigned int getNumOffBits() const =0
returns the number of off bits
virtual bool getBit(const unsigned int which) const =0
returns the value of a particular bit
virtual void getOnBits(IntVect &v) const =0
replaces the contents of v with indices of our on bits
std::vector< int > IntVect
virtual std::string toString() const =0
returns a serialized (pickled) version of this BitVect
a class for bit vectors that are densely occupied
RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect operator+(const DiscreteValueVect &p1, const DiscreteValueVect &p2)
Abstract base class for storing BitVectors.
virtual unsigned int getNumOnBits() const =0
returns the number of on bits
virtual bool setBit(const unsigned int which)=0
sets a particular bit and returns its original value