nlib
nn::nlib::SmartBitmap< N, BIT > Class Template Referencefinal

The data structure holding bit data operated on by Rank and Select. More...

#include "nn/nlib/SmartBitmap.h"

+ Inheritance diagram for nn::nlib::SmartBitmap< N, BIT >:

Additional Inherited Members

- Public Member Functions inherited from nn::nlib::SmartBitmapCrtp< N, SmartBitmap< N, BIT >, BIT >
unsigned int GetBitVectorSize () const noexcept
 Returns the size of the bit data. More...
 
const BIT * GetBitVector () const noexcept
 Returns the pointer to the bit data. More...
 
bool Has (unsigned int idx) const noexcept
 Tests to determine whether a particular value is contained in the set. More...
 
bool operator[] (const unsigned int idx) const noexcept
 Tests to determine whether a particular value is contained in the set. More...
 
unsigned int Rank1 (unsigned int idx) const noexcept
 Performs a Rank operation. More...
 
unsigned int Rank0 (unsigned int idx) const noexcept
 Performs a Rank operation. More...
 
int Select1 (unsigned int nth) const noexcept
 Returns the position of the nth 1 bit. nth starts from 0. More...
 
int Select0 (unsigned int nth) const noexcept
 Returns the position of the nth 0 bit. nth starts from 0. More...
 
bool Set (unsigned int idx) noexcept
 Adds a 32-bit unsigned integer to the set. More...
 
bool Set (unsigned int idx, bool value) noexcept
 Sets bits in the bit data. More...
 
bool TurnOn (unsigned int idx) noexcept
 Adds a 32-bit unsigned integer to the set. More...
 
bool Unset (unsigned int idx) noexcept
 Removes a 32-bit unsigned integer from the set. More...
 
void Reset () noexcept
 Returns the object to the state immediately after the constructor is called.
 

Detailed Description

template<size_t N, class BIT = uint64_t>
class nn::nlib::SmartBitmap< N, BIT >

The data structure holding bit data operated on by Rank and Select.

Template Parameters
NThe size of the bit data (N bits).
Description
Holds the instance of the bit data in a data member. This class is suited for the dynamic creation of bit data.
SmartBitmap<10> bmp;
bmp.Set(0);
bmp.Set(4);
bmp.Set(7);
bmp.Rank1(4); // Returns the number of 1 bits in the range [0..4]. 2 is returned.
bmp.Rank1(10000); // OK to be out of the range of the bitmap. 3 is returned.
bmp.Select1(2); // 7 is returned.
bmp.Select1(3); // -1 is returned.
Examples:
succinct/bitvector/bitvector.cpp.

Definition at line 161 of file SmartBitmap.h.


The documentation for this class was generated from the following file: