vg
tools for working with variation graphs
|
#include <stream_index.hpp>
Public Member Functions | |
BitString (uint64_t bits, size_t length) | |
Make a new BitString representing the low length bits of the given number. More... | |
BitString () | |
Make an empty BitString. More... | |
BitString & | operator= (const BitString &other)=default |
BitString & | operator= (BitString &&other)=default |
BitString (const BitString &other)=default | |
BitString (BitString &&other)=default | |
uint64_t | to_number () const |
Convert the BitString back to a number. More... | |
BitString | drop_prefix (size_t prefix_length) const |
pair< BitString, BitString > | split (size_t prefix_length) const |
Split into a prefix of the given length and a suffix of the rest. More... | |
bool | operator== (const BitString &other) const |
Determine if two BitStrings are equal. More... | |
bool | operator!= (const BitString &other) const |
Determine if two BitStrings are unequal. More... | |
size_t | common_prefix_length (const BitString &other) const |
bool | at_or_before (const BitString &other) const |
Return true if one BitString is a prefix of the other, or if this BitString has the 0 at the first differing bit. More... | |
bool | at_or_after (const BitString &other) const |
Return true if one BitString is a prefix of the other, or if the other BitString has the 0 at the first differing bit. More... | |
bool | peek () const |
size_t | length () const |
Get the length of the BitString. More... | |
bool | empty () const |
Return true if the bit string is empty. More... | |
Protected Attributes | |
uint64_t | bits |
uint8_t | bit_length |
Holds the number of bits that are used. More... | |
Static Protected Attributes | |
const static size_t | TOTAL_BITS = numeric_limits<uint64_t>::digits |
How many total bits are possible? More... | |
Represents a string of up to 64 bits.
vg::BitString::BitString | ( | uint64_t | bits, |
size_t | length | ||
) |
Make a new BitString representing the low length bits of the given number.
vg::BitString::BitString | ( | ) |
Make an empty BitString.
|
default |
|
default |
auto vg::BitString::at_or_after | ( | const BitString & | other | ) | const |
auto vg::BitString::at_or_before | ( | const BitString & | other | ) | const |
auto vg::BitString::common_prefix_length | ( | const BitString & | other | ) | const |
Get the length of the longest common prefix (index of the first mismatching bit) between this BitString and another.
auto vg::BitString::drop_prefix | ( | size_t | prefix_length | ) | const |
auto vg::BitString::empty | ( | ) | const |
Return true if the bit string is empty.
auto vg::BitString::length | ( | ) | const |
Get the length of the BitString.
auto vg::BitString::operator!= | ( | const BitString & | other | ) | const |
Determine if two BitStrings are unequal.
auto vg::BitString::operator== | ( | const BitString & | other | ) | const |
Determine if two BitStrings are equal.
auto vg::BitString::peek | ( | ) | const |
Peek at the top bit and see if it is a 1 (true) or 0 (false). Empty bit strings get false.
auto vg::BitString::split | ( | size_t | prefix_length | ) | const |
Split into a prefix of the given length and a suffix of the rest.
auto vg::BitString::to_number | ( | ) | const |
Convert the BitString back to a number.
|
protected |
Holds the number of bits that are used.
|
protected |
Holds the actual bits of the bit string. We store the bits aligned to the left to make finding the first mismatch easier. All bits below the last used bit are 0.
|
staticprotected |
How many total bits are possible?