HTM SpatialIndex Class Reference

class BitList

BitList class

Public Methods

BitList (size_t size = 0, size_t inc = 0)
Default constructor
BitList (const BitList &)
Copy constructor
BitList& operator = (const BitList &)
The assignment operator.
void set (size_t index, bool value)
Set a bit at a specific index to a given value
bool operator [] (size_t) const
Get the bit at a given index
size_t size () const
Get the size of the BitList
size_t count () const
Count the TRUE bits from a certain index on
size_t trim ()
Just chop off all trailing 'false' bits. Returns new size.
void clear (bool keepLength = false)
Clear the list, reset size to 0 by default
BitList& operator &= (const BitList &)
The standard &= operator.
BitList& operator |= (const BitList &)
The standard |= operator.
BitList& operator ^= (const BitList &)
The standard ^= operator.
void invert ()
The inversion method, flip every bit in the BitList.
bool covers (const BitList & BL) const
Check if BL is a subset of the current list
bool overlaps (const BitList & BL) const
Check if the current BitList overlaps with the other
void compress (ostream &) const
compress output
void decompress (istream &)
decompress input

Documentation

BitList class. The BitList is an array of bits. A bit can be set at any index using the set member function, the array expands itself automatically if the index exceeds the current size.
BitList(size_t size = 0, size_t inc = 0)
Default constructor. You can initialize the BitList to a specific size and optionally the increment may be set by which the size internal ValVec will be incremented upon need. (See VarVec.h for explanation on this.) The default is to double the size of the array whenever an expansion is requested.

BitList(const BitList &)
Copy constructor

BitList& operator = (const BitList &)
The assignment operator.

void set(size_t index, bool value)
Set a bit at a specific index to a given value. If the index is larger than the current size, the BitList expands itself to be able to hold that value at the given index.

bool operator [](size_t) const
Get the bit at a given index. If the index exceeds the size, the return value is 'false'. All BitLists are treated as if they were of infinite size, all bits set to zero at initialization.

size_t size() const
Get the size of the BitList. At construction time the size may be specified, and that much memory will be allocated. If the construction is done using the set() method, the size is 'minimal' i.e. as much as it needs to hold the last 'true' bit.

size_t count() const
Count the TRUE bits from a certain index on

size_t trim()
Just chop off all trailing 'false' bits. Returns new size.

void clear(bool keepLength = false)
Clear the list, reset size to 0 by default. If true is given as an argument, the size is kept.

BitList& operator &= (const BitList &)
The standard &= operator.

BitList& operator |= (const BitList &)
The standard |= operator.

BitList& operator ^= (const BitList &)
The standard ^= operator.

void invert()
The inversion method, flip every bit in the BitList.

bool covers(const BitList & BL) const
Check if BL is a subset of the current list

bool overlaps(const BitList & BL) const
Check if the current BitList overlaps with the other. (i.e. they have at least one common Bit)

void compress(ostream &) const
compress output

void decompress(istream &)
decompress input


This class has no child classes.

alphabetic index hierarchy of classes


© Copyright The Johns Hopkins University 1999, All Rights Reserved.
Peter Z. Kunszt,

generated by doc++