ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CxxUtils::ConcurrentBitset::const_iterator Struct Reference

Iterator over all 1 bits in the set. More...

#include <ConcurrentBitset.h>

Collaboration diagram for CxxUtils::ConcurrentBitset::const_iterator:

Public Types

typedef std::forward_iterator_tag iterator_category
 
typedef size_t value_type
 
typedef ptrdiff_t difference_type
 
typedef const value_typepointer
 
typedef const value_typereference
 

Public Member Functions

bit_t operator* () const
 Return the bit number which the iterator is currently referencing. More...
 
const_iteratoroperator++ ()
 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...
 

Detailed Description

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.

Member Typedef Documentation

◆ difference_type

Definition at line 698 of file ConcurrentBitset.h.

◆ iterator_category

Definition at line 696 of file ConcurrentBitset.h.

◆ pointer

Definition at line 699 of file ConcurrentBitset.h.

◆ reference

Definition at line 700 of file ConcurrentBitset.h.

◆ value_type

Definition at line 697 of file ConcurrentBitset.h.

Constructor & Destructor Documentation

◆ const_iterator()

CxxUtils::ConcurrentBitset::const_iterator::const_iterator ( Block_t  cache,
bit_t  bit,
const std::atomic< Block_t > *  data,
const std::atomic< Block_t > *  end 
)
private

Constructor.

Parameters
cacheCached block at the current iteration point, shifted such that bit number bit has just been shifted off the right.
bitBit number the at which the iterator is currently pointing.
dataPointer to the block at which the iterator is currently pointing.
endOne past the last block of the iteration range.

Member Function Documentation

◆ operator!=()

Compare two iterators.

Parameters
otherThe other iterator to compare.

◆ operator*()

bit_t CxxUtils::ConcurrentBitset::const_iterator::operator* ( ) const

Return the bit number which the iterator is currently referencing.

◆ operator++() [1/2]

const_iterator& CxxUtils::ConcurrentBitset::const_iterator::operator++ ( )

Advance the iterator to the next set bit (preincrement).

◆ operator++() [2/2]

const_iterator CxxUtils::ConcurrentBitset::const_iterator::operator++ ( int  )

Advance the iterator to the next set bit (postincrement).

◆ operator==()

bool CxxUtils::ConcurrentBitset::const_iterator::operator== ( const const_iterator other) const

Compare two iterators.

Parameters
otherThe other iterator to compare.

Member Data Documentation

◆ ConcurrentBitset

friend CxxUtils::ConcurrentBitset::const_iterator::ConcurrentBitset
private

Definition at line 704 of file ConcurrentBitset.h.

◆ m_bit

bit_t CxxUtils::ConcurrentBitset::const_iterator::m_bit
private

Bit number which we're currently referencing.

Definition at line 761 of file ConcurrentBitset.h.

◆ m_cache

Block_t CxxUtils::ConcurrentBitset::const_iterator::m_cache
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.

◆ m_data

const std::atomic<Block_t>* CxxUtils::ConcurrentBitset::const_iterator::m_data
private

Pointer to the block containing the bit which we're currently referencing.

Definition at line 764 of file ConcurrentBitset.h.

◆ m_end

const std::atomic<Block_t>* CxxUtils::ConcurrentBitset::const_iterator::m_end
private

Pointer to one past the last block in the set.

Definition at line 768 of file ConcurrentBitset.h.


The documentation for this struct was generated from the following file: