RDCode: SparseBitVect Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# SparseBitVect Class Reference

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

`#include <SparseBitVect.h>`

Inheritance diagram for SparseBitVect:

List of all members.

## Public Member Functions
| SparseBitVect ()
| SparseBitVect (unsigned int size)
| initialize with a particular size;
| SparseBitVect (const SparseBitVect &other)
| copy constructor
| SparseBitVect (const std::string)
| construct from a string pickle
| SparseBitVect (const char *data, const unsigned int dataLen)
| construct from a text pickle
SparseBitVect & | operator= (const SparseBitVect &)
| ~SparseBitVect ()
bool | operator[] (const unsigned int which) const
SparseBitVect | operator| (const SparseBitVect &) const
SparseBitVect | operator & (const SparseBitVect &) const
SparseBitVect | operator^ (const SparseBitVect &) const
SparseBitVect | operator~ () const
const IntSet * | GetBitSet () const
| returns a (const) pointer to our raw storage
const unsigned int | GetNumBits () const
| returns the number of bits (the length of the BitVect)
bool | SetBit (const unsigned int which)
| sets a particular bit and returns its original value
bool | SetBit (const IntSetIter which)
bool | UnSetBit (const unsigned int which)
| unsets a particular bit and returns its original value
bool | GetBit (const unsigned int which) const
| returns the value of a particular bit
bool | GetBit (const IntVectIter which) const
bool | GetBit (const IntSetIter which) const
const unsigned int | GetNumOnBits () const
| returns the number of on bits
const unsigned int | GetNumOffBits () const
| returns the number of off bits
std::string | ToString () const
| returns a serialized (pickled) version of this BitVect
void | GetOnBits (IntVect &v) const
| replaces the contents of `v` with indices of our on bits
void | ClearBits ()
| clears (sets to off) all of our bits
## Public Attributes
IntSet * | dp_bits
| our raw data, exposed for the sake of efficiency

## Detailed Description

a class for bit vectors that are sparsely occupied.

SparseBitVect objects store only their on bits, in an std::set.

They are, as you might expect, quite memory efficient for sparsely populated vectors but become rather a nightmare if they need to be negated.

Definition at line 31 of file SparseBitVect.h.

## Constructor & Destructor Documentation

SparseBitVect::SparseBitVect | ( |  | ) | `[inline]`

Definition at line 33 of file SparseBitVect.h.

SparseBitVect::SparseBitVect | ( | unsigned int | size | ) | `[inline, explicit]`

initialize with a particular size;

Definition at line 35 of file SparseBitVect.h.

SparseBitVect::SparseBitVect | ( | const SparseBitVect & | other | ) | `[inline]`

copy constructor

Definition at line 38 of file SparseBitVect.h.

References dp_bits, and GetNumBits().

SparseBitVect::SparseBitVect | ( | const std::string |  | ) |

construct from a string pickle

SparseBitVect::SparseBitVect | ( | const char * | data,
|  | const unsigned int | dataLen |
| ) |  |  |

construct from a text pickle

SparseBitVect::~SparseBitVect | ( |  | ) | `[inline]`

Definition at line 50 of file SparseBitVect.h.

References dp_bits.

## Member Function Documentation

SparseBitVect& SparseBitVect::operator= | ( | const SparseBitVect & |  | ) |

bool SparseBitVect::operator[] | ( | const unsigned int | which | ) | const`[virtual]`

Implements BitVect.

SparseBitVect SparseBitVect::operator| | ( | const SparseBitVect & |  | ) | const

SparseBitVect SparseBitVect::operator & | ( | const SparseBitVect & |  | ) | const

SparseBitVect SparseBitVect::operator^ | ( | const SparseBitVect & |  | ) | const

SparseBitVect SparseBitVect::operator~ | ( |  | ) | const

const IntSet* SparseBitVect::GetBitSet | ( |  | ) | const`[inline]`

returns a (const) pointer to our raw storage

Definition at line 59 of file SparseBitVect.h.

References dp_bits.

const unsigned int SparseBitVect::GetNumBits | ( |  | ) | const`[inline, virtual]`

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

Implements BitVect.

Definition at line 61 of file SparseBitVect.h.

Referenced by SparseBitVect().

bool SparseBitVect::SetBit | ( | const unsigned int | which | ) | `[virtual]`

sets a particular bit and returns its original value

Implements BitVect.

bool SparseBitVect::SetBit | ( | const IntSetIter | which | ) |

bool SparseBitVect::UnSetBit | ( | const unsigned int | which | ) | `[virtual]`

unsets a particular bit and returns its original value

Implements BitVect.

bool SparseBitVect::GetBit | ( | const unsigned int | which | ) | const`[virtual]`

returns the value of a particular bit

Implements BitVect.

bool SparseBitVect::GetBit | ( | const IntVectIter | which | ) | const

bool SparseBitVect::GetBit | ( | const IntSetIter | which | ) | const

const unsigned int SparseBitVect::GetNumOnBits | ( |  | ) | const`[inline, virtual]`

returns the number of on bits

Implements BitVect.

Definition at line 69 of file SparseBitVect.h.

References dp_bits.

const unsigned int SparseBitVect::GetNumOffBits | ( |  | ) | const`[inline, virtual]`

returns the number of off bits

Implements BitVect.

Definition at line 70 of file SparseBitVect.h.

References dp_bits.

std::string SparseBitVect::ToString | ( |  | ) | const`[virtual]`

returns a serialized (pickled) version of this BitVect

Implements BitVect.

void SparseBitVect::GetOnBits | ( | IntVect & | v | ) | const`[virtual]`

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

Implements BitVect.

void SparseBitVect::ClearBits | ( |  | ) | `[inline, virtual]`

clears (sets to off) all of our bits

Implements BitVect.

Definition at line 75 of file SparseBitVect.h.

## Member Data Documentation

IntSet* SparseBitVect::dp_bits

our raw data, exposed for the sake of efficiency

Definition at line 75 of file SparseBitVect.h.

Referenced by GetBitSet(), GetNumOffBits(), GetNumOnBits(), SparseBitVect(), and ~SparseBitVect().

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

- SparseBitVect.h