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

Constructor & Destructor Documentation

BLBitArray::~BLBitArray()◆ 

Destroys the BitArray.

Member Function Documentation

BLBitArray::operator bool() constexplicit◆ 

Tests whether the BitArray has a content.

Note
This is essentially the opposite of empty().

BLBitArray& BLBitArray::operator=(BLBitArray&& other)[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)[2/2]◆ 

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

BLResult BLBitArray::reset()◆ 

Clears the content of the BitArray and releases its data.

After reset the BitArray content matches a default constructed instance.

void BLBitArray::swap(BLBitArrayCore& other)◆ 

Swaps the content of this string with the other string.

bool BLBitArray::empty() const◆ 

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

Returns true if the BitArray's size is zero.

uint32_t BLBitArray::size() const◆ 

Returns the size of the BitArray in bits.

uint32_t BLBitArray::wordCount() const◆ 

Returns number of BitWords this BitArray uses.

uint32_t BLBitArray::capacity() const◆ 

Returns the capacity of the BitArray in bits.

uint32_t BLBitArray::cardinality() const◆ 

Returns the number of bits set in the BitArray.

uint32_t BLBitArray::cardinalityInRange(uint32_t startBit, uint32_t endBit) const◆ 

Returns the number of bits set in the given [startBit, endBit) range.

const uint32_t* BLBitArray::data() const◆ 

Returns bit data.

bool BLBitArray::hasBit(uint32_t bitIndex) const◆ 

Returns a bit-value at the given bitIndex.

bool BLBitArray::hasBitsInRange(uint32_t startBit, uint32_t endBit) const◆ 

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

bool BLBitArray::subsumes(const BLBitArrayCore& other) const◆ 

Returns whether this BitArray subsumes other.

bool BLBitArray::intersects(const BLBitArrayCore& other) const◆ 

Returns whether this BitArray intersects with other.

bool BLBitArray::equals(const BLBitArrayCore& other) const◆ 

Returns whether this BitArray and other are bitwise equal.

int BLBitArray::compare(const BLBitArrayCore& other) const◆ 

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

BLResult BLBitArray::assign(BLBitArrayCore&& other)[1/2]◆ 

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

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

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

BLResult BLBitArray::assignWords(const uint32_t* wordData, uint32_t wordCount)◆ 

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

BLResult BLBitArray::clear()◆ 

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

BLResult BLBitArray::resize(uint32_t nBits)◆ 

Resizes the BitArray so its size matches nBits.

BLResult BLBitArray::reserve(uint32_t nBits)◆ 

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

BLResult BLBitArray::shrink()◆ 

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

BLResult BLBitArray::setBit(uint32_t bitIndex)◆ 

Sets a bit to true at the given bitIndex.

BLResult BLBitArray::fillRange(uint32_t startBit, uint32_t endBit)◆ 

Fills bits in [startBit, endBit) range to true.

BLResult BLBitArray::fillWords(uint32_t bitIndex, const uint32_t* wordData, uint32_t wordCount)◆ 

Fills bits starting from bitIndex specified by wordData and wordCount to true (zeros in wordData are ignored).

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

BLResult BLBitArray::clearBit(uint32_t bitIndex)◆ 

Sets a bit to false at the given bitIndex.

BLResult BLBitArray::clearRange(uint32_t startBit, uint32_t endBit)◆ 

Sets bits in [startBit, endBit) range to false.

BLResult BLBitArray::clearWord(uint32_t bitIndex, uint32_t wordValue)◆ 

Sets bits starting from bitIndex specified by wordValue to false (zeros in wordValue are ignored).

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

BLResult BLBitArray::clearWords(uint32_t bitIndex, const uint32_t* wordData, uint32_t wordCount)◆ 

Sets bits starting from bitIndex specified by wordData and wordCount to false (zeros in wordData are ignored).

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

BLResult BLBitArray::replaceOp(uint32_t nBits, uint32_t** dataOut)◆ 

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::replaceBit(uint32_t bitIndex, bool bitValue)◆ 

Replaces a bit in the BitArray at the given bitIndex to match bitValue.

BLResult BLBitArray::replaceWord(uint32_t bitIndex, uint32_t wordValue)◆ 

Replaces bits starting from bitIndex to match the bits specified by wordValue.

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

BLResult BLBitArray::replaceWords(uint32_t bitIndex, const uint32_t* wordData, uint32_t wordCount)◆ 

Replaces bits starting from bitIndex to match the bits specified by wordData and wordCount.

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

BLResult BLBitArray::appendBit(bool bitValue)◆ 

Appends a bit bitValue to the BitArray.

BLResult BLBitArray::appendWord(uint32_t wordValue)◆ 

Appends a single word wordValue to the BitArray.

BLResult BLBitArray::appendWords(const uint32_t* wordData, uint32_t wordCount)◆ 

Appends whole words to the BitArray.