A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/classCSeqDB__BitSet.html below:

NCBI C++ ToolKit: CSeqDB_BitSet Class Reference

Search Toolkit Book for CSeqDB_BitSet

Bit set class. More...

#include "seqdbbitset.hpp"
(Private to src/objtools/blast/seqdb_reader.)

  CSeqDB_BitSet ()   Default constructor for zero-length empty bit array. More...
    CSeqDB_BitSet (size_t start, size_t end, ESpecialCase sp=eNone)   Constructor for bit array with start/end range. More...
    CSeqDB_BitSet (size_t start, size_t end, const TByte *p1, const TByte *p2)   Constructor. More...
  void  SetBit (size_t index)   Set the specified bit (to true). More...
  void  ClearBit (size_t index)   Clear the specified bit (to false). More...
  void  AssignBit (size_t i, bool value)   Store a value at the given index. More...
  void  AssignBitRange (size_t start, size_t end, bool value)   Store the provided value in a range of bits. More...
  bool  GetBit (size_t index) const   Get the value of the specified bit. More...
  bool  CheckOrFindBit (size_t &index) const   Check if a bit is true or find the next bit that is. More...
  void  Swap (CSeqDB_BitSet &other)   Swap two bitsets. More...
  void  UnionWith (CSeqDB_BitSet &other, bool consume)   This bitset is assigned to the union of it and another. More...
  void  IntersectWith (CSeqDB_BitSet &other, bool consume)   This bitset is assigned to the intersection of it and another. More...
  void  Normalize ()   If this is a special case bitset, convert it to a normal one. More...
  void  DebugDump (CDebugDumpContext ddc, unsigned int depth) const   Allows to dump a snapshot of the object. More...
    CObject (void)   Constructor. More...
    CObject (const CObject &src)   Copy constructor. More...
  virtual  ~CObject (void)   Destructor. More...
  CObjectoperator= (const CObject &src) THROWS_NONE   Assignment operator. More...
  bool  CanBeDeleted (void) const THROWS_NONE   Check if object can be deleted. More...
  bool  IsAllocatedInPool (void) const THROWS_NONE   Check if object is allocated in memory pool (not system heap) More...
  bool  Referenced (void) const THROWS_NONE   Check if object is referenced. More...
  bool  ReferencedOnlyOnce (void) const THROWS_NONE   Check if object is referenced only once. More...
  void  AddReference (void) const   Add reference to object. More...
  void  RemoveReference (void) const   Remove reference to object. More...
  void  ReleaseReference (void) const   Remove reference without deleting object. More...
  virtual void  DoNotDeleteThisObject (void)   Mark this object as not allocated in heap – do not delete this object. More...
  virtual void  DoDeleteThisObject (void)   Mark this object as allocated in heap – object can be deleted. More...
  void *  operator new (size_t size)   Define new operator for memory allocation. More...
  void *  operator new[] (size_t size)   Define new[] operator for 'array' memory allocation. More...
  void  operator delete (void *ptr)   Define delete operator for memory deallocation. More...
  void  operator delete[] (void *ptr)   Define delete[] operator for memory deallocation. More...
  void *  operator new (size_t size, void *place)   Define new operator. More...
  void  operator delete (void *ptr, void *place)   Define delete operator. More...
  void *  operator new (size_t size, CObjectMemoryPool *place)   Define new operator using memory pool. More...
  void  operator delete (void *ptr, CObjectMemoryPool *place)   Define delete operator. More...
    CDebugDumpable (void)   virtual  ~CDebugDumpable (void)   void  DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const   void  DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const   void  DumpToConsole (void) const  

Bit set class.

Definition at line 49 of file seqdbbitset.hpp.

◆ TByte ◆ anonymous enum

Some useful constants related to word size.

Enumerator eWordBits 

Number of bits per stored word.

eWordShift 

Shift to convert from bit index to vector index.

eWordMask 

Mask to compute bit index within word.

Definition at line 61 of file seqdbbitset.hpp.

◆ ESpecialCase

Special edge cases (all-set and all-clear).

Enumerator eNone 

Normal OID list.

eAllSet 

All OIDs are set.

eAllClear 

All 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.

Parameters
start Starting OID for this bit set. end Ending OID for this bit set. sp Special case (homogeneous value) arrays.

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).

Parameters
start The first OID represented by this data. end The OID after the last OID represented by this data. p1 A pointer to the beginning of the byte data. p2 A pointer to past the end of the byte data.

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.

Parameters
start The index of the first bit to assign. end The index after the last bit to assign. value The value to store in this range.

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 ) const

Check 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.

Parameters
index The start index, and the returned index [in|out].
Returns
true if the index points to a true value.

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).

Parameters
index The index of the bit to clear.

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.

Parameters
other The bitset to intersect with this bitset. consume Specify true if the other bitset is expendable.

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).

Parameters
index The index of the bit to set.

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.

Parameters
other The bitset to union with this bitset. consume Specify true if the other bitset is expendable.

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'.)

Parameters
other The bitset to copy. consume Specify true if the other bitset is expendable.

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'.

Parameters
src The bitset to read from. begin The start of the index range to read. end The index past the end of the index range.

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  ) private

Replace `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.

Parameters
start Move start point down (but not up) to here. end Move end point up (but not down) to here.

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 private

Representation 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 private

Number 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_Special

Special 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 private

Number 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