BLBitSetBuilderT< BitCount > Class Template Reference
template<uint32_t BitCount>
class BLBitSetBuilderT< BitCount >

BitSet builder [C++ API].

BitSet builder is a low-level utility class that can be used to efficiently build a BitSet in C++. It maintains a configurable buffer (called area) where intermediate bits are set, which are then committed to BitSet when an added bit/range is outside of the area or when user is done with BitSet building. The commit uses blBitSetBuilderCommit() function, which was specifically designed for BLBitSetBuilderT<BitCount> in addition to the BLBitSetBuilder alias.

Note
The destructor doesn't do anything. If there are still bits to be committed, they will be lost.

Public Members

Members
- Public Attributes inherited from BLBitSetBuilderCore

Public Types

Constants
- Public Types inherited from BLBitSetBuilderCore

Member Functions

Construction & Destruction
Accessors
Builder Interface
- Public Member Functions inherited from BLBitSetBuilderCore

Constructor & Destructor Documentation

template<uint32_t BitCount>
BLBitSetBuilderT<BitCount>::BLBitSetBuilderT()[1/2]◆ 

Constructs a new BitSet builder having no BitSet assigned.

template<uint32_t BitCount>
BLBitSetBuilderT<BitCount>::BLBitSetBuilderT(BLBitSetCore* bitSet)explicit[2/2]◆ 

Constructs a new BitSet builder having the given bitSet assigned.

Note
The builder only stores a pointer to the bitSet - the user must guarantee to not destroy the BitSet before the builder is destroyed or reset.

Member Function Documentation

template<uint32_t BitCount>
bool BLBitSetBuilderT<BitCount>::isValid() const◆ 

Returns whether the BitSet builder is valid, which means that is has an associated BLBitSet instance.

template<uint32_t BitCount>
BLBitSet* BLBitSetBuilderT<BitCount>::bitSet() const◆ 

Returns an associated BLBitSet instance that this builder commits to.

template<uint32_t BitCount>
BLResult BLBitSetBuilderT<BitCount>::addBit(uint32_t bitIndex)◆ 

Adds a bit to the area maintained by BitSet builder.

If the area of bitIndex is different compared to the current active area, the current area will be committed to the BitSet. This is actually the only operation that can return BL_ERROR_OUT_OF_MEMORY.

template<uint32_t BitCount>
BLResult BLBitSetBuilderT<BitCount>::addRange(uint32_t startBit, uint32_t endBit)◆ 

Adds a [startBit, endBit) range of bits to the BitSet.

If the range is relatively small and fits into a single builder area, it will be added to that area. On the other hand, if the range is large, the area will be kept and the builder would call BLBitSet::addRange() instead. If the are of the range is different compared to the current active area, the data in the current active area will be committed.

template<uint32_t BitCount>
BLResult BLBitSetBuilderT<BitCount>::commit()[1/2]◆ 

Commits changes in the current active area to the BitSet.

Note
This must be called in order to finalize building the BitSet. If this function is not called the BitSet could have missing bits that are in the current active area.

template<uint32_t BitCount>
BLResult BLBitSetBuilderT<BitCount>::commit(uint32_t newAreaIndex)[2/2]◆ 

Similar to commit(), but the additional parameter newAreaIndex will be used to set the current active area.

Member Data Documentation

template<uint32_t BitCount>
uint32_t BLBitSetBuilderT<BitCount>::_areaWords[kAreaWordCount]◆ 

Area words data.

template<uint32_t BitCount>
BLBitSetCore* BLBitSetBuilderT<BitCount>::_bitSet◆ 

BitSet we are building.

Note
This member is not part of C API. C API requires both BLBitSetCore and BLBitSetBuilderCore to be passed.