// Bit-Array-Klasse (als Beispiel für Unit-Tests), Header
//
// Klaus Kusche, 2012

typedef long unsigned int tBitArrayWord;

class BitArray
{
  public:
    BitArray(unsigned int size, bool initVal = false);
    BitArray(const BitArray &orig);

    ~BitArray() { delete[] mArray; }

    unsigned int getSize() const { return mBits; }
    bool test(unsigned int index) const;
    BitArray &set(unsigned int index, bool val = true);
    BitArray &clear(unsigned int index) { return set(index, false); }

    BitArray &invert();
    BitArray &intersect(const BitArray &a);
    // analog für union, ssd, minus, ...

    bool operator!() const;
    bool operator==(const BitArray &a) const;
    bool operator<=(const BitArray &a) const;

    BitArray &operator=(const BitArray &a);
    
  private:
    unsigned int mBits;
    unsigned int mWords;
    tBitArrayWord *mArray;
};
