Succinct bit vector class. More...
#include <bit-vector.hpp>
Public Member Functions | |
| BitVector (uint64_t size) | |
| Constructor. More... | |
| virtual | ~BitVector () |
| Destructor. More... | |
| void | clear () |
| Clear bit vector. More... | |
| bool | operator[] (uint64_t i) const |
| Get value from bit vector by index. More... | |
| void | set (uint64_t i, bool b=true) |
| Set value to bit vector by index. More... | |
| void | push_back (bool b) |
| push bit to bit vector More... | |
| void | push_back_bits (uint64_t x, uint64_t len) |
| push bits to bit vector More... | |
| uint64_t | get_bits (uint64_t pos, uint64_t len) const |
| get bits from bit vector More... | |
| void | build (bool enable_faster_select1=false, bool enable_faster_select0=false) |
| Build succinct bit vector. More... | |
| FORCE_INLINE uint64_t | size () const |
| Returns number of the element in bit vector. More... | |
| FORCE_INLINE uint64_t | size (bool b) const |
| Returns the number of bits that matches with argument in the bit vector. More... | |
| FORCE_INLINE bool | empty () const |
| Returns whether the vector is empty (i.e. More... | |
| FORCE_INLINE uint64_t | rank (uint64_t i, bool b=true) const |
Returns Number of the bits equal to b up to position i More... | |
| uint64_t | rank0 (uint64_t i) const |
Returns Number of the bits equal to 0 up to position i More... | |
| uint64_t | rank1 (uint64_t i) const |
Returns Number of the bits equal to 1 up to position i More... | |
| FORCE_INLINE uint64_t | select (uint64_t x, bool b=true) const |
Returns the position of the x-th occurrence of b More... | |
| uint64_t | select0 (uint64_t x) const |
| Returns the position of the x-th occurrence of 0. More... | |
| uint64_t | select1 (uint64_t x) const |
| Returns the position of the x-th occurrence of 1. More... | |
| void | save (std::ostream &os) const throw (hsds::Exception) |
| Save bit vector to the ostream. More... | |
| void | load (std::istream &is) throw (hsds::Exception) |
| Load bit vector from istream. More... | |
| uint64_t | map (void *ptr, uint64_t size) throw (hsds::Exception) |
| Mapping pointer to BitVector. More... | |
| void | swap (BitVector &x) |
| Exchanges the content of the instance. More... | |
Static Public Member Functions | |
| BitVector () | |
| Constructor. More... | |
Succinct bit vector class.
Definition at line 53 of file bit-vector.hpp.
|
static |
Constructor.
| hsds::BitVector::BitVector | ( | uint64_t | size | ) |
Constructor.
| [in] | size | Size of bit vector |
|
virtual |
Destructor.
| void hsds::BitVector::build | ( | bool | enable_faster_select1 = false, |
| bool | enable_faster_select0 = false |
||
| ) |
|
inline |
Clear bit vector.
Definition at line 76 of file bit-vector.hpp.
|
inline |
Returns whether the vector is empty (i.e.
whether its size is 0)
| true | Container size equals 0. |
| false | Container size not equals 0. |
Definition at line 157 of file bit-vector.hpp.
| uint64_t hsds::BitVector::get_bits | ( | uint64_t | pos, |
| uint64_t | len | ||
| ) | const |
get bits from bit vector
| [in] | pos | position of bits |
| [in] | len | bit length |
| void hsds::BitVector::load | ( | std::istream & | is | ) | throw (hsds::Exception) |
Load bit vector from istream.
| [in] | is | The instance of std::istream |
| hsds::Exception | When failed to load. |
| uint64_t hsds::BitVector::map | ( | void * | ptr, |
| uint64_t | size | ||
| ) | throw (hsds::Exception) |
Mapping pointer to BitVector.
| [in] | ptr | Pointer of the mmaped file |
| [in] | size | Size of mmaped file |
ptr).| hsds::Exception | When failed to load. |
| bool hsds::BitVector::operator[] | ( | uint64_t | i | ) | const |
Get value from bit vector by index.
| [in] | i | Index of bit vector |
| void hsds::BitVector::push_back | ( | bool | b | ) |
push bit to bit vector
| [in] | b | Boolean value that indicates the bit to push.(true = 1, false = 0) |
| void hsds::BitVector::push_back_bits | ( | uint64_t | x, |
| uint64_t | len | ||
| ) |
push bits to bit vector
| [in] | x | bits |
| [in] | len | bit length |
|
inline |
Returns Number of the bits equal to b up to position i
| [in] | i | Index of the bit vector |
| [in] | b | Boolean value that indicates bit type.(true = 1, false = 0) |
Definition at line 169 of file bit-vector.hpp.
| uint64_t hsds::BitVector::rank0 | ( | uint64_t | i | ) | const |
Returns Number of the bits equal to 0 up to position i
| [in] | i | Index of the bit vector |
| uint64_t hsds::BitVector::rank1 | ( | uint64_t | i | ) | const |
Returns Number of the bits equal to 1 up to position i
| [in] | i | Index of the bit vector |
| void hsds::BitVector::save | ( | std::ostream & | os | ) | const throw (hsds::Exception) |
Save bit vector to the ostream.
| [out] | os | The instance of std::ostream |
| hsds::Exception | When failed to save. |
|
inline |
Returns the position of the x-th occurrence of b
| [in] | x | Rank number of b-bits |
| [in] | b | Boolean value that indicates bit type.(true = 1, false = 0) |
Definition at line 199 of file bit-vector.hpp.
| uint64_t hsds::BitVector::select0 | ( | uint64_t | x | ) | const |
Returns the position of the x-th occurrence of 0.
| [in] | x | Rank number of 0-bits |
| uint64_t hsds::BitVector::select1 | ( | uint64_t | x | ) | const |
Returns the position of the x-th occurrence of 1.
| [in] | x | Rank number of 1-bits |
| void hsds::BitVector::set | ( | uint64_t | i, |
| bool | b = true |
||
| ) |
Set value to bit vector by index.
| [in] | i | Index of bit vector |
| [in] | b | Boolean value that indicates the bit to set.(true = 1, false = 0) |
|
inline |
Returns number of the element in bit vector.
Definition at line 136 of file bit-vector.hpp.
|
inline |
Returns the number of bits that matches with argument in the bit vector.
| [in] | b | Boolean value that indicates bit type.(true = 1, false = 0) |
Definition at line 147 of file bit-vector.hpp.
| void hsds::BitVector::swap | ( | BitVector & | x | ) |
Exchanges the content of the instance.
| [in,out] | x | Another BitVector instance |
1.8.3.1