atlas  0.6
Namespaces | Typedefs
bitmap.cpp File Reference

Contains the implementation of the BitMap class. More...

#include "bitmap.h"
#include <algorithm>
#include "bits.h"
#include <cassert>
Include dependency graph for bitmap.cpp:

Namespaces

 atlas
 
 atlas::bitmap
 

Typedefs

typedef std::vector< unsigned long >::iterator atlas::bitmap::VI
 

Detailed Description

Contains the implementation of the BitMap class.


A BitMap should be seen as a container of unsigned long, not bits; the idea is that the unsigned longs it contains are the bit-addresses of the set bits, i.e., their indices in the bit-array. It obeys the semantics of a Forward Container (notion from the C++ standard library).

A bitmap is a implemented as a vector of unsigned long, each representing a "chunk" of bits in the map. We wish to provide bit-address access to this map; for this purpose we use the reference trick from vector<bool>. Also we wish to define an iterator class, which traverses the set bits of the bitmap; so that for instance, |b.begin()| would give access to the first set bit (but is not a pointer or a reference to any value). Dereferencing the iterator returns the integer bit-address of that first set bit.