Search Toolkit Book for CSeqDB_BitSet
Bit set class. More...
#include "seqdbbitset.hpp"
(Private to src/objtools/blast/seqdb_reader
.)
Bit set class.
Definition at line 49 of file seqdbbitset.hpp.
◆ TByte ◆ anonymous enumSome useful constants related to word size.
Enumerator eWordBitsNumber of bits per stored word.
eWordShiftShift to convert from bit index to vector index.
eWordMaskMask to compute bit index within word.
Definition at line 61 of file seqdbbitset.hpp.
◆ ESpecialCaseSpecial edge cases (all-set and all-clear).
Enumerator eNoneNormal OID list.
eAllSetAll OIDs are set.
eAllClearAll OIDs are clear.
Definition at line 74 of file seqdbbitset.hpp.
◆ CSeqDB_BitSet() [1/4] CSeqDB_BitSet::CSeqDB_BitSet ( ) inline ◆ CSeqDB_BitSet() [2/4]Constructor for bit array with start/end range.
This constructs a bit array with the given start and end points. If the `sp' parameter is set to `eNone', a normal bit array is constructed, with all bits set to `false'. If sp is `eAllSet' or `eAllClear', the array is not constructed, but rather an object that acts as though the given range of OIDs is all `true' or all `false' respectively. These are termed `special case' bit sets. Special cases tend to be much more efficient in terms of memory usage and in the efficiency of boolean operations.
Definition at line 104 of file seqdbbitset.hpp.
References _ASSERT, eNone, and x_Alloc().
◆ CSeqDB_BitSet() [3/4]Constructor.
This constructs a normal (eNone) bit array with the given start and end points, and populates it from the byte data in the memory found between addresses p1 and p2. This method is meant for reading data from OID mask files and follows the format of those files, but the start pointer should be to the start of the bit map data within the file, not to the start of the file (the file contains a header that should be skipped).
Definition at line 37 of file seqdbbitset.cpp.
References _ASSERT, eWordBits, m_Bits, and x_Alloc().
◆ CSeqDB_BitSet() [4/4]Prevent copy construction.
◆ AssignBit() void CSeqDB_BitSet::AssignBit ( size_t i, bool value ) ◆ AssignBitRange() void CSeqDB_BitSet::AssignBitRange ( size_t start, size_t end, bool value )Store the provided value in a range of bits.
Definition at line 376 of file seqdbbitset.cpp.
References _ASSERT, AssignBit(), eWordBits, eWordMask, eWordShift, i, m_Bits, m_End, m_Start, mask, and rapidjson::value.
Referenced by UnionWith(), CSeqDBOIDList::x_ClearBitRange(), CSeqDBOIDList::x_ComputeFilters(), x_Normalize(), and CSeqDBOIDList::x_Setup().
◆ CheckOrFindBit() bool CSeqDB_BitSet::CheckOrFindBit ( size_t & index ) constCheck if a bit is true or find the next bit that is.
If the index points to a `false' value, the index is increased until a `true' value is found (true is returned) or until the index exceeds the OID range (false is returned). If the index initially points to a `true' bit, the index will not change.
Definition at line 90 of file seqdbbitset.cpp.
References _ASSERT, eAllClear, eAllSet, eWordMask, eWordShift, m_Bits, m_End, m_Special, and m_Start.
Referenced by IntersectWith(), x_CopyBits(), and CSeqDBOIDList::x_GetOidMask().
◆ ClearBit() void CSeqDB_BitSet::ClearBit ( size_t index )Clear the specified bit (to false).
Definition at line 75 of file seqdbbitset.cpp.
References _ASSERT, eNone, eWordMask, eWordShift, m_Bits, m_End, m_Special, and m_Start.
Referenced by AssignBit(), IntersectWith(), CSeqDBOIDList::x_ApplyNegativeList(), and CSeqDBOIDList::x_GetOidMask().
◆ DebugDump() ◆ GetBit() bool CSeqDB_BitSet::GetBit ( size_t index ) const ◆ IntersectWith()This bitset is assigned to the intersection of it and another.
Each bit in this bitset will be `true' if it was true in both this bitset and `other'. The `consume' flag can be specified as true if the value of the `other' bitset will not be used after this operation. Specifying `true' for consume may change the data in the other bitset but can sometimes use a more efficient algorithm.
Definition at line 193 of file seqdbbitset.cpp.
References CheckOrFindBit(), ClearBit(), eAllClear, eAllSet, eNone, i, int, m_Bits, m_End, m_Special, m_Start, max(), min(), result, Swap(), and x_Copy().
Referenced by CSeqDBOIDList::x_ApplyNegativeList(), CSeqDBOIDList::x_ApplyUserGiList(), CSeqDBOIDList::x_ComputeFilters(), and CSeqDBOIDList::x_Setup().
◆ Normalize() void CSeqDB_BitSet::Normalize ( void )If this is a special case bitset, convert it to a normal one.
Operations on normal (`eNone') bitsets can be more expensive in terms of memory and CPU time than on special case (eAllSet and eAllClear) bitsets, but normal bitsets support operations such as SetBit() and ClearBit() that special bitsets don't.
This method checks if this bitset is a special case, and converts it to a normal (`eNone') bitset if so.
Definition at line 419 of file seqdbbitset.cpp.
References eNone, m_End, m_Special, m_Start, and x_Normalize().
Referenced by CSeqDBOIDList::x_ApplyNegativeList().
◆ operator=() ◆ SetBit() void CSeqDB_BitSet::SetBit ( size_t index )Set the specified bit (to true).
Definition at line 60 of file seqdbbitset.cpp.
References _ASSERT, eNone, eWordMask, eWordShift, m_Bits, m_End, m_Special, and m_Start.
Referenced by AssignBit(), s_ProcessSeqIdFilters(), s_ProcessTaxIdFilters(), CSeqDBOIDList::x_ApplyUserGiList(), x_CopyBits(), and CSeqDBOIDList::x_IdsToBitSet().
◆ Swap() ◆ UnionWith()This bitset is assigned to the union of it and another.
Each bit in this bitset will be `true' if it was true in either this bitset or `other'. The `consume' flag can be specified as true if the value of the `other' bitset will not be used after this operation. Specifying `true' for consume may change the data in the other bitset but can sometimes use a more efficient algorithm.
Definition at line 142 of file seqdbbitset.cpp.
References _ASSERT, AssignBitRange(), eAllClear, eAllSet, eNone, m_End, m_Special, m_Start, x_Copy(), x_CopyBits(), and x_Normalize().
Referenced by CSeqDBOIDList::x_ComputeFilters(), and CSeqDBOIDList::x_Setup().
◆ x_Alloc() void CSeqDB_BitSet::x_Alloc ( size_t bits ) inlineprivate ◆ x_Copy()Set this bitset to the value of the provided one.
This is like a normal "copy assignment" operation, except that if `consume' is specified as true, a more efficient algorithm may be used. (Implementation: if `consume' is true, and the source is a normal (eNone) bitset, this is a `swap'.)
Definition at line 338 of file seqdbbitset.cpp.
References eNone, m_Bits, m_End, m_Special, m_Start, and Swap().
Referenced by IntersectWith(), and UnionWith().
◆ x_CopyBits() [1/2] ◆ x_CopyBits() [2/2]Set all bits in the given range that are true in `src'.
Definition at line 295 of file seqdbbitset.cpp.
References CheckOrFindBit(), i, and SetBit().
◆ x_Normalize() void CSeqDB_BitSet::x_Normalize ( size_t start, size_t end ) privateReplace `special' with normal bitsets, adjust the index range.
If this bitset is special, it becomes a normal bitset. If the start or end point is outside of the current one, the bitset expands (but does not contract). All bits that are `true' in the initial bitset will be true in the resulting bitset.
Definition at line 309 of file seqdbbitset.cpp.
References AssignBitRange(), eAllClear, eAllSet, eNone, m_End, m_Special, m_Start, max(), min(), Swap(), and x_CopyBits().
Referenced by Normalize(), and UnionWith().
◆ m_Bits vector<TByte> CSeqDB_BitSet::m_Bits privateRepresentation of bit data.
Definition at line 269 of file seqdbbitset.hpp.
Referenced by AssignBitRange(), CheckOrFindBit(), ClearBit(), CSeqDB_BitSet(), DebugDump(), GetBit(), IntersectWith(), SetBit(), Swap(), x_Alloc(), and x_Copy().
◆ m_End size_t CSeqDB_BitSet::m_End privateNumber of bits stored here.
Definition at line 263 of file seqdbbitset.hpp.
Referenced by AssignBitRange(), CheckOrFindBit(), ClearBit(), DebugDump(), GetBit(), IntersectWith(), Normalize(), SetBit(), Swap(), UnionWith(), x_Copy(), and x_Normalize().
◆ m_SpecialSpecial edge cases.
Definition at line 266 of file seqdbbitset.hpp.
Referenced by CheckOrFindBit(), ClearBit(), DebugDump(), GetBit(), IntersectWith(), Normalize(), SetBit(), Swap(), UnionWith(), x_Copy(), and x_Normalize().
◆ m_Start size_t CSeqDB_BitSet::m_Start privateNumber of bits stored here.
Definition at line 260 of file seqdbbitset.hpp.
Referenced by AssignBitRange(), CheckOrFindBit(), ClearBit(), DebugDump(), GetBit(), IntersectWith(), Normalize(), SetBit(), Swap(), UnionWith(), x_Copy(), and x_Normalize().
The documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4