Fast bit array that keeps track of the number of bits set and can find the next set in a timely manner.
More...
|
| | TfBits (size_t num=0) |
| | Constructs a fixed size bit array, clears all bits.
|
| |
| | TfBits (size_t num, size_t first, size_t last) |
| | Constructs a fixed size bit array, with a range of bits set.
|
| |
| | TfBits (const TfBits &rhs) |
| | Copy-constructs a fixed size bit array.
|
| |
| | TfBits (TfBits &&rhs) |
| | Move constructor.
|
| |
| | ~TfBits () |
| | Destructor.
|
| |
| TfBits & | operator= (const TfBits &rhs) |
| | Assignment operator.
|
| |
| TfBits & | operator= (TfBits &&rhs) |
| | Move assignment operator.
|
| |
| void | Resize (size_t num) |
| | Resizes the bit array, however, the bits are left uninitialized.
|
| |
| void | ResizeKeepContent (size_t num) |
| | Resizes the size of the bit array while keeping the content.
|
| |
| TF_API void | OrSubset (const TfBits &rhs) |
| | Combines two differently sized TfBits using an or operator.
|
| |
| void | Swap (TfBits &rhs) |
| | Provides a fast swap.
|
| |
| void | ClearAll () |
| | Clears all bits to zero.
|
| |
| void | SetAll () |
| | Sets all bits to one.
|
| |
| void | Clear (size_t index) |
| | Clears bit # index to zero.
|
| |
| void | Set (size_t index) |
| | Sets bit # index to one.
|
| |
| void | Assign (size_t index, bool val) |
| | Assigns val to bit # index.
|
| |
| bool | IsSet (size_t index) const |
| | Returns true, if bit # index is set.
|
| |
| size_t | FindNextSet (size_t index) const |
| | Finds the next set bit that has a higher or equal index than index.
|
| |
| size_t | FindPrevSet (size_t index) const |
| | Finds the prev set bit that has a lower or equal index than index.
|
| |
| size_t | FindNextUnset (size_t index) const |
| | Finds the next unset bit that has a higher or equal index than index.
|
| |
| size_t | GetSize () const |
| | Returns the size of the bit array, ie.
|
| |
| bool | IsEmpty () const |
| | Returns true if this bit array is empty, i.e.
|
| |
| size_t | GetFirstSet () const |
| | Returns the index of the first bit set in the bit array.
|
| |
| size_t | GetLastSet () const |
| | Returns the index of the last bit set in the bit array.
|
| |
| size_t | GetNumSet () const |
| | Returns the number of bits currently set in this array.
|
| |
| bool | AreAllSet () const |
| | Returns true, if all the bits in this bit array are set.
|
| |
| bool | AreAllUnset () const |
| | Returns true, if all the bits in this bit array are unset.
|
| |
| bool | IsAnySet () const |
| | Returns true, if there is at least a single set bit.
|
| |
| bool | IsAnyUnset () const |
| | Returns true, if there is at least a single unset bit.
|
| |
| bool | AreContiguouslySet () const |
| | Returns true if the set bits in this bit array are contiguous.
|
| |
| size_t | GetAllocatedSize () const |
| | Returns the amount of memory this object holds on to.
|
| |
| TF_API size_t | GetHash () const |
| | Returns a hash for this instance.
|
| |
| TF_API std::string | GetAsStringLeftToRight () const |
| | Returns a string representing the bits for debugging with bits ordered from left to right with increasing indices.
|
| |
| TF_API std::string | GetAsStringRightToLeft () const |
| | Returns a string representing the bits for debugging with bits ordered from right to left with increasing indices.
|
| |
| bool | HasNonEmptyIntersection (const TfBits &rhs) const |
| | Returns true if the result of the intersection with rhs would be non-zero.
|
| |
| bool | HasNonEmptyDifference (const TfBits &rhs) const |
| | Returns true if the result of an asymmetric set different is non-zero.
|
| |
| bool | Contains (const TfBits &rhs) const |
| | Returns true if this bit array contains rhs by computing: (rhs - this).GetNumSet() == 0.
|
| |
| AllView | GetAllView () const |
| | Returns an iteratable view for the bits that steps over all bits.
|
| |
| AllSetView | GetAllSetView () const |
| | Returns an iteratable view for the bits that steps over all set bits.
|
| |
| AllUnsetView | GetAllUnsetView () const |
| | Returns an iteratable view for the bits that steps over all unset bits.
|
| |
|
| TF_API bool | operator== (const TfBits &rhs) const |
| | Returns true if this == rhs.
|
| |
| bool | operator!= (const TfBits &rhs) const |
| | Returns true if this != rhs.
|
| |
| TF_API TfBits & | operator&= (const TfBits &rhs) |
| | Ands these bits with the rhs bits.
|
| |
| TfBits | operator& (const TfBits &rhs) const |
| | Returns these bits and'ed with rhs.
|
| |
| TF_API TfBits & | operator|= (const TfBits &rhs) |
| | Ors these bits with the rhs bits.
|
| |
| TfBits | operator| (const TfBits &rhs) const |
| | Returns these bits or'ed with rhs.
|
| |
| TF_API TfBits & | operator^= (const TfBits &rhs) |
| | Xors these bits with the rhs bits.
|
| |
| TfBits | operator^ (const TfBits &rhs) const |
| | Returns these bits xor'ed with rhs.
|
| |
| TF_API TfBits & | operator-= (const TfBits &rhs) |
| | Removes all bits in the rhs bits from these bits.
|
| |
| TF_API TfBits & | Complement () |
| | Flips all bits.
|
| |
| bool | operator[] (size_t index) const |
| | Returns bit at index.
|
| |
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manner.
Note about thread safety in this class:
TfBits supports only the most basic thread safety guarantee: multiple threads may safely call const methods concurrently. A thread must not invoke any non-const method on a TfBits object while any other thread is accessing it.
There are certain members in this class that are mutable and modified in const methods. However, since they are updated without being read and all threads would update them with the same values in the case of a race condition, the worst thing that can happen is redundant computation.
Successive access to these members will result in read only access patterns.
All occurances are marked.
Definition at line 48 of file bits.h.