11 #ifndef __RD_SPARSEBITVECTS_H__
12 #define __RD_SPARSEBITVECTS_H__
38 explicit SparseBitVect(
unsigned int size) : dp_bits(nullptr), d_size(0) {
48 std::copy(bv->begin(), bv->end(), std::inserter(*dp_bits, dp_bits->end()));
68 bool setBit(
const unsigned int which);
71 bool getBit(
const unsigned int which)
const;
76 return static_cast<unsigned int>(dp_bits->size());
79 return d_size -
static_cast<unsigned int>(dp_bits->size());
96 unsigned int d_size{0};
97 void _initForSize(
const unsigned int size);
std::vector< int > IntVect
IntVect::iterator IntVectIter
IntSet::iterator IntSetIter
IntSet::const_iterator IntSetConstIter
Abstract base class for storing BitVectors.
a class for bit vectors that are sparsely occupied.
std::string toString() const
returns a serialized (pickled) version of this BitVect
bool getBit(const IntSetIter which) const
SparseBitVect operator|(const SparseBitVect &) const
bool operator[](const unsigned int which) const
SparseBitVect operator&(const SparseBitVect &) const
unsigned int getNumOffBits() const
returns the number of off bits
unsigned int getNumOnBits() const
returns the number of on bits
SparseBitVect operator~() const
bool setBit(const unsigned int which)
sets a particular bit and returns its original value
bool operator!=(const SparseBitVect &o) const
unsigned int getNumBits() const
returns the number of bits (the length of the BitVect)
SparseBitVect(const char *data, const unsigned int dataLen)
construct from a text pickle
bool setBit(const IntSetIter which)
bool getBit(const unsigned int which) const
returns the value of a particular bit
void clearBits()
clears (sets to off) all of our bits
bool operator==(const SparseBitVect &o) const
SparseBitVect operator^(const SparseBitVect &) const
SparseBitVect(unsigned int size)
initialize with a particular size;
IntSet * dp_bits
our raw data, exposed for the sake of efficiency
bool getBit(const IntVectIter which) const
SparseBitVect & operator=(const SparseBitVect &)
SparseBitVect(const SparseBitVect &other)
copy constructor
void getOnBits(IntVect &v) const
replaces the contents of v with indices of our on bits
bool unsetBit(const unsigned int which)
unsets a particular bit and returns its original value
SparseBitVect(const std::string &)
construct from a string pickle
const IntSet * getBitSet() const
returns a (const) pointer to our raw storage
#define RDKIT_DATASTRUCTS_EXPORT