class Bonxai::Mask


Bit-mask to encode active states and facilitate sequential iterators.

#include <mrpt/maps/bonxai/bonxai.hpp>

class Mask
    // classes

    class Iterator;

    // fields

    const uint32_t SIZE;
    const uint32_t WORD_COUNT;

    // construction

    Mask(size_t log2dim);
    Mask(size_t log2dim, bool on);
    Mask(const Mask& other);
    Mask(Mask&& other);

    // methods

    size_t memUsage() const;
    uint32_t bitCount() const;
    uint32_t wordCount() const;
    uint64_t getWord(size_t n) const;

    void setWord(
        size_t n,
        uint64_t v

    uint32_t countOn() const;
    bool operator == (const Mask& other) const;
    bool operator != (const Mask& other) const;
    Iterator beginOn() const;
    bool isOn(uint32_t n) const;
    bool isOn() const;
    bool isOff() const;
    bool setOn(uint32_t n);
    bool setOff(uint32_t n);

    void set(
        uint32_t n,
        bool On

    void setOn();
    void setOff();
    void set(bool on);
    void toggle();
    void toggle(uint32_t n);


Mask(size_t log2dim)

Initialize all bits to zero.

Mask(size_t log2dim, bool on)

Initialize all bits to a given value.


size_t memUsage() const

Return the memory footprint in bytes of this Mask.

uint32_t bitCount() const

Return the number of bits available in this Mask.

uint32_t wordCount() const

Return the number of machine words used by this Mask.

bool isOn(uint32_t n) const

Return true if the given bit is set.

bool isOn() const

Return true if any bit is set.

void setOn()

Set all bits on.

void setOff()

Set all bits off.

void set(bool on)

Set all bits too the value “on”.

void toggle()

Toggle the state of all bits in the mask.

void toggle(uint32_t n)

Toggle the state of one bit in the mask.