class cvflann::DynamicBitset

Overview

Class re-implementing the boost version of it This helps not depending on boost, it also does not do the bound checks and has a way to reset a block for speed More…

#include <dynamic_bitset.h>

class DynamicBitset
{
public:
    // construction

    DynamicBitset();
    DynamicBitset(size_t sz);

    // methods

    void
    clear();

    bool
    empty() const;

    void
    reset();

    void
    reset(size_t index);

    void
    reset_block(size_t index);

    void
    resize(size_t sz);

    void
    set(size_t index);

    size_t
    size() const;

    bool
    test(size_t index) const;
};

Detailed Documentation

Class re-implementing the boost version of it This helps not depending on boost, it also does not do the bound checks and has a way to reset a block for speed

Construction

DynamicBitset()

default constructor

DynamicBitset(size_t sz)

only constructor we use in our code

Parameters:

sz the size of the bitset (in bits)

Methods

void
clear()

Sets all the bits to 0

bool
empty() const

checks if the bitset is empty

Returns:

true if the bitset is empty

void
reset()

set all the bits to 0

void
reset(size_t index)

set one bit to 0

Parameters:

index  
void
reset_block(size_t index)

sets a specific bit to 0, and more bits too This function is useful when resetting a given set of bits so that the whole bitset ends up being 0: if that’s the case, we don’t care about setting other bits to 0

Parameters:

index  
void
resize(size_t sz)

resize the bitset so that it contains at least sz bits

Parameters:

sz  
void
set(size_t index)

set a bit to true

Parameters:

index the index of the bit to set to 1
size_t
size() const

gives the number of contained bits

bool
test(size_t index) const

check if a bit is set

Parameters:

index the index of the bit to check

Returns:

true if the bit is set