IndexContainersBLBitArray

BLBitArray Class Referencefinal [¶]

BitArray container [C++ API].

Member Functions

Construction & Destruction
Overloaded Operators
Common Functionality
Accessors
Test Operations
Equality & Comparison
Content Manipulation

Additional Inherited Members

Public Attributes inherited from BLObjectCore

BLBitArray::~BLBitArray()noexcept[¶]

Destroys the BitArray.

BLBitArray::operator bool() constexplicitnoexcept[¶]

Tests whether the BitArray has a content.

Note

This is essentially the opposite of is_empty().

BLBitArray& BLBitArray::operator=(
BLBitArray&& other
)noexcept[1/2][¶]

Move assignment.

Note

The other BitArray is reset by move assignment, so its state after the move operation is the same as a default constructed BitArray.

BLBitArray& BLBitArray::operator=(
const BLBitArray& other
)noexcept[2/2][¶]

Copy assignment, performs weak copy of the data held by the other BitArray.

BLResult BLBitArray::reset()noexcept[¶]

Clears the content of the BitArray and releases its data.

After reset the BitArray content matches a default constructed instance.

void BLBitArray::swap()noexcept[¶]

Swaps the content of this string with the other string.

bool BLBitArray::is_empty() constnoexcept[¶]

Tests whether the BitArray is empty (has no content).

Returns true if the BitArray's size is zero.

uint32_t BLBitArray::size() constnoexcept[¶]

Returns the size of the BitArray in bits.

uint32_t BLBitArray::word_count() constnoexcept[¶]

Returns number of BitWords this BitArray uses.

uint32_t BLBitArray::capacity() constnoexcept[¶]

Returns the capacity of the BitArray in bits.

uint32_t BLBitArray::cardinality() constnoexcept[¶]

Returns the number of bits set in the BitArray.

uint32_t BLBitArray::cardinality_in_range(
uint32_t start_bit,
uint32_t end_bit
) constnoexcept[¶]

Returns the number of bits set in the given [start_bit, end_bit) range.

const uint32_t* BLBitArray::data() constnoexcept[¶]

Returns bit data.

bool BLBitArray::has_bit(
uint32_t bit_index
) constnoexcept[¶]

Returns a bit-value at the given bit_index.

bool BLBitArray::has_bits_in_range(
uint32_t start_bit,
uint32_t end_bit
) constnoexcept[¶]

Returns whether the bit-set has at least on bit in the given [start_bit, endbit) range.

bool BLBitArray::subsumes(
const BLBitArrayCore& other
) constnoexcept[¶]

Returns whether this BitArray subsumes other.

bool BLBitArray::intersects(
const BLBitArrayCore& other
) constnoexcept[¶]

Returns whether this BitArray intersects with other.

bool BLBitArray::equals(
const BLBitArrayCore& other
) constnoexcept[¶]

Returns whether this BitArray and other are bitwise equal.

int BLBitArray::compare(
const BLBitArrayCore& other
) constnoexcept[¶]

Compares this BitArray with other and returns either -1, 0, or 1.

BLResult BLBitArray::assign()noexcept[1/2][¶]

Move assignment, the same as operator=, but returns a BLResult instead of this.

BLResult BLBitArray::assign(
const BLBitArrayCore& other
)noexcept[2/2][¶]

Copy assignment, the same as operator=, but returns a BLResult instead of this.

BLResult BLBitArray::assign_words(
const uint32_t* word_data,
uint32_t word_count
)noexcept[¶]

Replaces the content of the BitArray by bits specified by word_data of size word_count [the size is in uint32_t units].

BLResult BLBitArray::clear()noexcept[¶]

Clears the content of the BitArray without releasing its dynamically allocated data, if possible.

BLResult BLBitArray::resize(
uint32_t n_bits
)noexcept[¶]

Resizes the BitArray so its size matches n_bits.

BLResult BLBitArray::reserve(
uint32_t n_bits
)noexcept[¶]

Reserves n_bits in the BitArray (capacity would match n_bits) without changing its size.

BLResult BLBitArray::shrink()noexcept[¶]

Shrinks the capacity of the BitArray to match the actual content with the intention to save memory.

BLResult BLBitArray::set_bit(
uint32_t bit_index
)noexcept[¶]

Sets a bit to true at the given bit_index.

BLResult BLBitArray::fill_range(
uint32_t start_bit,
uint32_t end_bit
)noexcept[¶]

Fills bits in [start_bit, end_bit) range to true.

BLResult BLBitArray::fill_words(
uint32_t bit_index,
const uint32_t* word_data,
uint32_t word_count
)noexcept[¶]

Fills bits starting from bit_index specified by word_data and word_count to true (zeros in word_data are ignored).

Note

This operation uses an OR operator - bits in word_data are combined with OR operator with existing bits in BitArray.

BLResult BLBitArray::clear_bit(
uint32_t bit_index
)noexcept[¶]

Sets a bit to false at the given bit_index.

BLResult BLBitArray::clear_range(
uint32_t start_bit,
uint32_t end_bit
)noexcept[¶]

Sets bits in [start_bit, end_bit) range to false.

BLResult BLBitArray::clear_word(
uint32_t bit_index,
uint32_t word_value
)noexcept[¶]

Sets bits starting from bit_index specified by word_value to false (zeros in word_value are ignored).

Note

This operation uses an AND_NOT operator - bits in word_data are negated and then combined with AND operator with existing bits in BitArray.

BLResult BLBitArray::clear_words(
uint32_t bit_index,
const uint32_t* word_data,
uint32_t word_count
)noexcept[¶]

Sets bits starting from bit_index specified by word_data and word_count to false (zeros in word_data are ignored).

Note

This operation uses an AND_NOT operator - bits in word_data are negated and then combined with AND operator with existing bits in BitArray.

BLResult BLBitArray::replace_op(
uint32_t n_bits,
uint32_t** data_out
)noexcept[¶]

Makes the BitArray mutable with the intention to replace all bits of it.

Note

All bits in the BitArray will be set to zero.

BLResult BLBitArray::replace_bit(
uint32_t bit_index,
bool bit_value
)noexcept[¶]

Replaces a bit in the BitArray at the given bit_index to match bit_value.

BLResult BLBitArray::replace_word(
uint32_t bit_index,
uint32_t word_value
)noexcept[¶]

Replaces bits starting from bit_index to match the bits specified by word_value.

Note

Replaced bits from BitArray are not combined by using any operator, word_value is copied as is, thus replaces fully the existing bits.

BLResult BLBitArray::replace_words(
uint32_t bit_index,
const uint32_t* word_data,
uint32_t word_count
)noexcept[¶]

Replaces bits starting from bit_index to match the bits specified by word_data and word_count.

Note

Replaced bits from BitArray are not combined by using any operator, word_data is copied as is, thus replaces fully the existing bits.

BLResult BLBitArray::append_bit(
bool bit_value
)noexcept[¶]

Appends a bit bit_value to the BitArray.

BLResult BLBitArray::append_word(
uint32_t word_value
)noexcept[¶]

Appends a single word word_value to the BitArray.

BLResult BLBitArray::append_words(
const uint32_t* word_data,
uint32_t word_count
)noexcept[¶]

Appends whole words to the BitArray.