ExplicitBitVect Class Reference

a class for bit vectors that are densely occupied More...

`#include <ExplicitBitVect.h>`

Inheritance diagram for ExplicitBitVect:

## Public Member Functions

| ExplicitBitVect ()
| ExplicitBitVect (unsigned int size)
| initialize with a particular size; More...
| ExplicitBitVect (unsigned int size, bool bitsSet)
| initialize with a particular size and all bits set More...
| ExplicitBitVect (const ExplicitBitVect &other)
| ExplicitBitVect (const std::string &)
| construct from a string pickle More...
| ExplicitBitVect (const char *, const unsigned int)
| construct from a text pickle More...
| ExplicitBitVect (boost::dynamic_bitset<> *bits)
| ~ExplicitBitVect () override
ExplicitBitVect & | operator= (const ExplicitBitVect &other)
bool | operator[] (const unsigned int which) const override
bool | setBit (const unsigned int which) override
| sets a particular bit and returns its original value More...
bool | unsetBit (const unsigned int which) override
| unsets a particular bit and returns its original value More...
bool | getBit (const unsigned int which) const override
| returns the value of a particular bit More...
ExplicitBitVect | operator^ (const ExplicitBitVect &other) const
ExplicitBitVect | operator& (const ExplicitBitVect &other) const
ExplicitBitVect | operator| (const ExplicitBitVect &other) const
ExplicitBitVect | operator~ () const
ExplicitBitVect | operator+ (const ExplicitBitVect &other) const
ExplicitBitVect & | operator^= (const ExplicitBitVect &other)
ExplicitBitVect & | operator&= (const ExplicitBitVect &other)
ExplicitBitVect & | operator|= (const ExplicitBitVect &other)
ExplicitBitVect & | operator+= (const ExplicitBitVect &other)
unsigned int | getNumBits () const override
| returns the number of bits (the length of the BitVect) More...
unsigned int | getNumOnBits () const override
| returns the number of on bits More...
unsigned int | getNumOffBits () const override
| returns the number of off bits More...
void | getOnBits (IntVect &v) const override
| replaces the contents of `v` with indices of our on bits More...
void | clearBits () override
| clears (sets to off) all of our bits More...
std::string | toString () const override
| returns a serialized (pickled) version of this BitVect More...
bool | operator== (const ExplicitBitVect &o) const
bool | operator!= (const ExplicitBitVect &o) const
Public Member Functions inherited from BitVect
virtual | ~BitVect ()=0
void | initFromText (const char *data, const unsigned int dataLen, bool isBase64=false, bool allowOldFormat=false)
| initializes this BitVect from a pickle More...
unsigned int | size () const

## Public Attributes

boost::dynamic_bitset * | dp_bits {nullptr}
| our raw storage More...

## Detailed Description

a class for bit vectors that are densely occupied

ExplicitBitVect objects store all of their bits using a boost::dynamic_bitset

These are very fast, but can require large amounts of memory for large, sparsely occupied vectors.

Definition at line 29 of file ExplicitBitVect.h.

## Constructor & Destructor Documentation

## ExplicitBitVect() [1/7]

ExplicitBitVect::ExplicitBitVect | ( |  | ) |

inline

Definition at line 31 of file ExplicitBitVect.h.

## ExplicitBitVect() [2/7]

ExplicitBitVect::ExplicitBitVect | ( | unsigned int | size | ) |

inline explicit

initialize with a particular size;

Definition at line 33 of file ExplicitBitVect.h.

## ExplicitBitVect() [3/7]

ExplicitBitVect::ExplicitBitVect | ( | unsigned int | size,
|  | bool | bitsSet
| ) |  |

initialize with a particular size and all bits set

## ExplicitBitVect() [4/7]

ExplicitBitVect::ExplicitBitVect | ( | const ExplicitBitVect & | other | ) |

## ExplicitBitVect() [5/7]

ExplicitBitVect::ExplicitBitVect | ( | const std::string & |  | ) |

construct from a string pickle

## ExplicitBitVect() [6/7]

ExplicitBitVect::ExplicitBitVect | ( | const char * | ,
|  | const unsigned int |
| ) |  |

construct from a text pickle

## ExplicitBitVect() [7/7]

ExplicitBitVect::ExplicitBitVect | ( | boost::dynamic_bitset<> * | bits | ) |

inline

construct directly from a dynamic_bitset pointer takes ownership of the pointer

Definition at line 46 of file ExplicitBitVect.h.

## ~ExplicitBitVect()

ExplicitBitVect::~ExplicitBitVect | ( |  | ) |

override

## Member Function Documentation

## clearBits()

void ExplicitBitVect::clearBits | ( |  | ) |

inline override virtual

clears (sets to off) all of our bits

Implements BitVect.

Definition at line 78 of file ExplicitBitVect.h.

## getBit()

bool ExplicitBitVect::getBit | ( | const unsigned int | which | ) | const

override virtual

returns the value of a particular bit

Implements BitVect.

## getNumBits()

unsigned int ExplicitBitVect::getNumBits | ( |  | ) | const

override virtual

returns the number of bits (the length of the BitVect)

Implements BitVect.

## getNumOffBits()

unsigned int ExplicitBitVect::getNumOffBits | ( |  | ) | const

override virtual

returns the number of off bits

Implements BitVect.

## getNumOnBits()

unsigned int ExplicitBitVect::getNumOnBits | ( |  | ) | const

override virtual

returns the number of on bits

Implements BitVect.

## getOnBits()

void ExplicitBitVect::getOnBits | ( | IntVect & | v | ) | const

override virtual

replaces the contents of `v` with indices of our on bits

Implements BitVect.

## operator!=()

bool ExplicitBitVect::operator!= | ( | const ExplicitBitVect & | o | ) | const

inline

Definition at line 86 of file ExplicitBitVect.h.

References dp_bits.

## operator&()

ExplicitBitVect ExplicitBitVect::operator& | ( | const ExplicitBitVect & | other | ) | const

## operator&=()

ExplicitBitVect& ExplicitBitVect::operator&= | ( | const ExplicitBitVect & | other | ) |

## operator+()

ExplicitBitVect ExplicitBitVect::operator+ | ( | const ExplicitBitVect & | other | ) | const

## operator+=()

ExplicitBitVect& ExplicitBitVect::operator+= | ( | const ExplicitBitVect & | other | ) |

## operator=()

ExplicitBitVect& ExplicitBitVect::operator= | ( | const ExplicitBitVect & | other | ) |

## operator==()

bool ExplicitBitVect::operator== | ( | const ExplicitBitVect & | o | ) | const

inline

Definition at line 83 of file ExplicitBitVect.h.

References dp_bits.

## operator[]()

bool ExplicitBitVect::operator[] | ( | const unsigned int | which | ) | const

override virtual

Implements BitVect.

## operator^()

ExplicitBitVect ExplicitBitVect::operator^ | ( | const ExplicitBitVect & | other | ) | const

## operator^=()

ExplicitBitVect& ExplicitBitVect::operator^= | ( | const ExplicitBitVect & | other | ) |

## operator|()

ExplicitBitVect ExplicitBitVect::operator| | ( | const ExplicitBitVect & | other | ) | const

## operator|=()

ExplicitBitVect& ExplicitBitVect::operator|= | ( | const ExplicitBitVect & | other | ) |

## operator~()

ExplicitBitVect ExplicitBitVect::operator~ | ( |  | ) | const

## setBit()

bool ExplicitBitVect::setBit | ( | const unsigned int | which | ) |

override virtual

sets a particular bit and returns its original value

Implements BitVect.

Referenced by RDInfoTheory::BitCorrMatGenerator::collectVotes().

## toString()

std::string ExplicitBitVect::toString | ( |  | ) | const

override virtual

returns a serialized (pickled) version of this BitVect

Implements BitVect.

## unsetBit()

bool ExplicitBitVect::unsetBit | ( | const unsigned int | which | ) |

override virtual

unsets a particular bit and returns its original value

Implements BitVect.

## Member Data Documentation

## dp_bits

boost::dynamic_bitset* ExplicitBitVect::dp_bits {nullptr}

our raw storage

Definition at line 81 of file ExplicitBitVect.h.

Referenced by operator!=(), and operator==().

The documentation for this class was generated from the following file:

- ExplicitBitVect.h