![]() |
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. | |
| const_iterator & | operator++ () |
| Advance the iterator to the next set bit (preincrement). | |
| const_iterator | operator++ (int) |
| Advance the iterator to the next set bit (postincrement). | |
| bool | operator== (const const_iterator &other) const |
| Compare two iterators. | |
| bool | operator!= (const const_iterator &other) const |
| Compare two iterators. | |
| const_iterator (typename Impl_t::const_iterator it) | |
| Constructor. | |
| bool | valid () const |
| Test if this iterator is valid. | |
| const_iterator (typename Impl_t::const_iterator it) | |
| Constructor. | |
| const_iterator (const iterator &other) | |
| Conversion from non-const iterator (for interoperability). | |
| bool | valid () const |
| Test if this iterator is valid. | |
Private Member Functions | |
| const_iterator (Block_t cache, bit_t bit, const std::atomic< Block_t > *data, const std::atomic< Block_t > *end) | |
| Constructor. | |
| void | increment () |
| iterator_facade requirement: Increment the iterator. | |
| void | decrement () |
| iterator_facade requirement: Decrement the iterator. | |
| bool | equal (const const_iterator &other) const |
| iterator_facade requirement: Equality test. | |
| const const_iterator_value | dereference () const |
| iterator_facade requirement: Dereference the iterator. | |
| void | increment () |
| iterator_facade requirement: Increment the iterator. | |
| void | decrement () |
| iterator_facade requirement: Decrement the iterator. | |
| bool | equal (const const_iterator &other) const |
| iterator_facade requirement: Equality test. | |
| bool | equal (const iterator &other) const |
| iterator_facade requirement: Equality test. | |
| const const_iterator_value | dereference () const |
| iterator_facade requirement: Dereference the iterator. | |
Private Attributes | |
| friend | ConcurrentBitset |
| Block_t | m_cache |
| 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. | |
| bit_t | m_bit |
| Bit number which we're currently referencing. | |
| const std::atomic< Block_t > * | m_data |
| Pointer to the block containing the bit which we're currently referencing. | |
| const std::atomic< Block_t > * | m_end |
| Pointer to one past the last block in the set. | |
| Impl_t::const_iterator | m_impl |
| The iterator on the underlying table. | |
Friends | |
| class | boost::iterator_core_access |
| Required by iterator_facade. | |
| class | iterator |
Iterator over all 1 bits in the set.
Const iterator class.
Iterator class.
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.
This uses boost::iterator_facade to define the methods required by an STL iterator in terms of the private methods below.
Since dereference() will be returning a const_iterator_value by value, we also need to override the reference type.
Definition at line 693 of file ConcurrentBitset.h.
| typedef ptrdiff_t CxxUtils::const_iterator::difference_type |
Definition at line 697 of file ConcurrentBitset.h.
| typedef std::forward_iterator_tag CxxUtils::const_iterator::iterator_category |
Definition at line 695 of file ConcurrentBitset.h.
| typedef const value_type* CxxUtils::const_iterator::pointer |
Definition at line 698 of file ConcurrentBitset.h.
| typedef const value_type& CxxUtils::const_iterator::reference |
Definition at line 699 of file ConcurrentBitset.h.
| typedef size_t CxxUtils::const_iterator::value_type |
Definition at line 696 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. |
| CxxUtils::const_iterator::const_iterator | ( | typename Impl_t::const_iterator | it | ) |
Constructor.
| it | Iterator of the underlying table. |
| CxxUtils::const_iterator::const_iterator | ( | typename Impl_t::const_iterator | it | ) |
Constructor.
| it | Iterator of the underlying table. |
Conversion from non-const iterator (for interoperability).
| other | The other iterator. |
|
private |
iterator_facade requirement: Decrement the iterator.
|
private |
iterator_facade requirement: Decrement the iterator.
|
private |
iterator_facade requirement: Dereference the iterator.
|
private |
iterator_facade requirement: Dereference the iterator.
|
private |
iterator_facade requirement: Equality test.
|
private |
iterator_facade requirement: Equality test.
iterator_facade requirement: Equality test.
(Interoperability.)
|
private |
iterator_facade requirement: Increment the iterator.
|
private |
iterator_facade requirement: Increment the iterator.
| bool CxxUtils::const_iterator::operator!= | ( | const const_iterator & | other | ) | const |
Compare two iterators.
| other | The other iterator to compare. |
| bit_t CxxUtils::const_iterator::operator* | ( | ) | const |
Return the bit number which the iterator is currently referencing.
| const_iterator & CxxUtils::const_iterator::operator++ | ( | ) |
Advance the iterator to the next set bit (preincrement).
| const_iterator CxxUtils::const_iterator::operator++ | ( | int | ) |
Advance the iterator to the next set bit (postincrement).
| bool CxxUtils::const_iterator::operator== | ( | const const_iterator & | other | ) | const |
Compare two iterators.
| other | The other iterator to compare. |
| bool CxxUtils::const_iterator::valid | ( | ) | const |
| bool CxxUtils::const_iterator::valid | ( | ) | const |
|
friend |
Required by iterator_facade.
Definition at line 272 of file ConcurrentMap.h.
|
friend |
Definition at line 284 of file ConcurrentToValMap.h.
|
private |
Definition at line 703 of file ConcurrentBitset.h.
|
private |
Bit number which we're currently referencing.
Definition at line 760 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 757 of file ConcurrentBitset.h.
|
private |
Pointer to the block containing the bit which we're currently referencing.
Definition at line 763 of file ConcurrentBitset.h.
|
private |
Pointer to one past the last block in the set.
Definition at line 767 of file ConcurrentBitset.h.
|
private |
The iterator on the underlying table.
Definition at line 300 of file ConcurrentMap.h.