class Core::BitSet

Overview

Set of bits. More…

#include <corebitset.h>

class BitSet
{
public:
    // construction

    BitSet (int size = 0);
    BitSet (const BitSet& bs);

    // methods

    BitSet& operator = (const BitSet& bs);
    bool operator == (const BitSet& bs) const;
    bool operator != (const BitSet& bs) const;
    void resize (int bitCount);
    int getSize () const;
    void setBit (int which, bool state);
    bool getBit (int which) const;
    void toggleBit (int which);
    void setAllBits (bool state);
    int findFirst (bool state) const;
    int countBits (bool state) const;
};

Detailed Documentation

Set of bits.

Methods

void resize (int bitCount)

Resize set to new bit count.

int getSize () const

Get current size (in bits).

void setBit (int which, bool state)

Set (or clear) bit at given index.

bool getBit (int which) const

Get bit state at given index.

void toggleBit (int which)

Toggle bit at given index.

void setAllBits (bool state)

Set (or clear) all bits.

int findFirst (bool state) const

Get index of first set (or cleared) bit.

int countBits (bool state) const

Returns number of set (or cleared) bits.