ATLAS Offline Software
|
Iterator over all 1 bits in the set. More...
#include <ConcurrentBitset.h>
Public Types | |
typedef std::forward_iterator_tag | iterator_category |
typedef size_t | value_type |
typedef ptrdiff_t | difference_type |
typedef const value_type * | pointer |
typedef const value_type & | reference |
Public Member Functions | |
bit_t | operator* () const |
Return the bit number which the iterator is currently referencing. More... | |
const_iterator & | operator++ () |
Advance the iterator to the next set bit (preincrement). More... | |
const_iterator | operator++ (int) |
Advance the iterator to the next set bit (postincrement). More... | |
bool | operator== (const const_iterator &other) const |
Compare two iterators. More... | |
bool | operator!= (const const_iterator &other) const |
Compare two iterators. More... | |
Private Member Functions | |
const_iterator (Block_t cache, bit_t bit, const std::atomic< Block_t > *data, const std::atomic< Block_t > *end) | |
Constructor. More... | |
Private Attributes | |
friend | ConcurrentBitset |
Block_t | m_cache |
Cache of the block to which we're currently pointing. More... | |
bit_t | m_bit |
Bit number which we're currently referencing. More... | |
const std::atomic< Block_t > * | m_data |
Pointer to the block containing the bit which we're currently referencing. More... | |
const std::atomic< Block_t > * | m_end |
Pointer to one past the last block in the set. More... | |
Iterator over all 1 bits in the set.
This iterator will visit all 1 bits in the set (that is, it works like the iterator for a set<bit_t>). The state of an iterator consists of:
The end iterator is marked by setting m_bit to -1; none of the other fields matter in that case. Thus, we can compare iterators by simply comparing m_bit.
To initialize an iterator in begin(), we set the iterator to point to the block preceding the first block of the set, with the cache set to 0. We can then use the increment operator to advance the iterator to the first 1 bit.
Definition at line 694 of file ConcurrentBitset.h.
typedef ptrdiff_t CxxUtils::ConcurrentBitset::const_iterator::difference_type |
Definition at line 698 of file ConcurrentBitset.h.
typedef std::forward_iterator_tag CxxUtils::ConcurrentBitset::const_iterator::iterator_category |
Definition at line 696 of file ConcurrentBitset.h.
Definition at line 699 of file ConcurrentBitset.h.
Definition at line 700 of file ConcurrentBitset.h.
typedef size_t CxxUtils::ConcurrentBitset::const_iterator::value_type |
Definition at line 697 of file ConcurrentBitset.h.
|
private |
Constructor.
cache | Cached block at the current iteration point, shifted such that bit number bit has just been shifted off the right. |
bit | Bit number the at which the iterator is currently pointing. |
data | Pointer to the block at which the iterator is currently pointing. |
end | One past the last block of the iteration range. |
bool CxxUtils::ConcurrentBitset::const_iterator::operator!= | ( | const const_iterator & | other | ) | const |
Compare two iterators.
other | The other iterator to compare. |
bit_t CxxUtils::ConcurrentBitset::const_iterator::operator* | ( | ) | const |
Return the bit number which the iterator is currently referencing.
const_iterator& CxxUtils::ConcurrentBitset::const_iterator::operator++ | ( | ) |
Advance the iterator to the next set bit (preincrement).
const_iterator CxxUtils::ConcurrentBitset::const_iterator::operator++ | ( | int | ) |
Advance the iterator to the next set bit (postincrement).
bool CxxUtils::ConcurrentBitset::const_iterator::operator== | ( | const const_iterator & | other | ) | const |
Compare two iterators.
other | The other iterator to compare. |
|
private |
Definition at line 704 of file ConcurrentBitset.h.
|
private |
Bit number which we're currently referencing.
Definition at line 761 of file ConcurrentBitset.h.
|
private |
Cache of the block to which we're currently pointing.
Should be shifted such that the bit we're referencing has just been shifted off the right.
Definition at line 758 of file ConcurrentBitset.h.
Pointer to the block containing the bit which we're currently referencing.
Definition at line 764 of file ConcurrentBitset.h.
Pointer to one past the last block in the set.
Definition at line 768 of file ConcurrentBitset.h.