Runtime-sized bitset; one bit per flag, packed into 64-bit words. More...
#include <cl_DynamicBitset.hpp>
Public Member Functions | |
| DynamicBitset (const index_t aNumberOfBits) | |
| Constructor: Initializes the bitset with the given number of bits. | |
| DynamicBitset (const DynamicBitset &aBitset) | |
| copy constructor | |
| DynamicBitset (DynamicBitset &&aBitset) noexcept | |
| move constructor | |
| ~DynamicBitset () | |
| Destructor: Releases allocated memory. | |
| index_t | size () const |
| Returns the number of bits in the bitset. | |
| index_t | memory () const |
| Returns the number of 64-bit blocks used (memory size). | |
| void | reset (const index_t aPos) |
| Resets (clears) the bit at the given position. | |
| void | reset () |
| Resets (clears) all bits. | |
| void | set (const index_t aPos) |
| Sets the bit at the given position to 1. | |
| void | set (const index_t aPos, const bool aValue) |
| Sets the bit at the given position to the specified value. | |
| void | flip (const index_t aPos) |
| Flips (toggles) the bit at the given position. | |
| void | flip () |
| Flips all bits at once. | |
| bool | test (const index_t aPos) const |
| Tests whether the bit at the given position is set. | |
| index_t | count () const |
| Counts the number of bits set to 1. | |
| const uint64_t * | data () const |
| bool | summaries_are_tight () const |
| void | lock () |
| makes the bitset non-writable and computes the hash | |
| void | unlock () |
| makes the bitset writable and resets the hash | |
| bool | is_locked () const |
| checks if the bitset is writable | |
| size_t | hash () const |
| Returns a hash function for fast comparison. | |
| string | to_string () const |
| string | to_hex () const |
| index_t | to_int () const |
| string | to_raw_string () const |
| void | set_from_hex (const string &aString) |
| void | set_index (const index_t aIndex) |
| index_t | index () const |
| void | where (Cell< index_t > &aBits, const bool aAssumeSparse=true) const |
| bool | operator== (const DynamicBitset &aRhs) const |
| bool | operator!= (const DynamicBitset &aRhs) const |
| Comparison operator: Checks if two bitsets are not equal. | |
| DynamicBitset & | operator= (const DynamicBitset &aRhs) |
| Assignment operator. | |
| DynamicBitset & | operator= (DynamicBitset &&aRhs) noexcept |
| Move assignment operator. | |
| DynamicBitset | operator| (const DynamicBitset &aRhs) const |
| Bitwise OR operator. | |
| DynamicBitset & | operator|= (const DynamicBitset &aRhs) |
| Assignment or operator. | |
| DynamicBitset | operator^ (const DynamicBitset &aRhs) const |
| Bitwise XOR operator. | |
| DynamicBitset & | operator^= (const DynamicBitset &aRhs) |
| Bitwise XOR assignment operator. | |
| DynamicBitset | operator& (const DynamicBitset &aRhs) const |
| Bitwise AND operator. | |
| DynamicBitset & | operator&= (const DynamicBitset &aRhs) |
| Bitwise AND assignment operator. | |
Runtime-sized bitset; one bit per flag, packed into 64-bit words.
| belfem::DynamicBitset::DynamicBitset | ( | const index_t | aNumberOfBits | ) |
Constructor: Initializes the bitset with the given number of bits.
| belfem::DynamicBitset::DynamicBitset | ( | const DynamicBitset & | aBitset | ) |
copy constructor
|
noexcept |
move constructor
| belfem::DynamicBitset::~DynamicBitset | ( | ) |
Destructor: Releases allocated memory.
| index_t belfem::DynamicBitset::count | ( | ) | const |
Counts the number of bits set to 1.
|
inline |
| void belfem::DynamicBitset::flip | ( | ) |
Flips all bits at once.
|
inline |
Flips (toggles) the bit at the given position.
|
inline |
Returns a hash function for fast comparison.
returns the hash value
|
inline |
|
inline |
checks if the bitset is writable
|
inline |
makes the bitset non-writable and computes the hash
|
inline |
Returns the number of 64-bit blocks used (memory size).
|
inline |
Comparison operator: Checks if two bitsets are not equal.
|
inline |
Bitwise AND operator.
|
inline |
Bitwise AND assignment operator.
| DynamicBitset & belfem::DynamicBitset::operator= | ( | const DynamicBitset & | aRhs | ) |
Assignment operator.
|
noexcept |
Move assignment operator.
|
inline |
Comparison operator: Checks if two bitsets are equal. Both bitsets must be locked: a debug build asserts on an unlocked operand, a release build compares the words regardless. A size mismatch is an error in every build.
|
inline |
Bitwise XOR operator.
|
inline |
Bitwise XOR assignment operator.
|
inline |
Bitwise OR operator.
|
inline |
Assignment or operator.
| void belfem::DynamicBitset::reset | ( | ) |
Resets (clears) all bits.
|
inline |
Resets (clears) the bit at the given position.
|
inline |
Sets the bit at the given position to 1.
|
inline |
Sets the bit at the given position to the specified value.
| void belfem::DynamicBitset::set_from_hex | ( | const string & | aString | ) |
|
inline |
|
inline |
Returns the number of bits in the bitset.
| bool belfem::DynamicBitset::summaries_are_tight | ( | ) | const |
Diagnostic: checks that both summary levels are tight, i.e. that a summary bit is set exactly when the word below it is nonzero, and that no summary bit stands beyond its child array. Intended for tests and debugging; costs one pass over the data.
|
inline |
Tests whether the bit at the given position is set.
| std::string belfem::DynamicBitset::to_hex | ( | ) | const |
|
inline |
| std::string belfem::DynamicBitset::to_raw_string | ( | ) | const |
| string belfem::DynamicBitset::to_string | ( | ) | const |
|
inline |
makes the bitset writable and resets the hash
|
inline |