DGtal  1.5.beta
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator Struct Reference

Read iterator on set elements. Model of ForwardIterator. More...

#include <DGtal/kernel/UnorderedSetByBlock.h>

Inheritance diagram for DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator:
[legend]

Public Member Functions

 const_iterator ()
 Default constructor. More...
 
 const_iterator (const Self &aSet, typename Container::const_iterator anIt)
 
 const_iterator (const Self &aSet, typename Container::const_iterator anIt, Coordinate aBit)
 
 const_iterator (const Self &aSet, const Key &key)
 

Private Member Functions

void increment ()
 
bool equal (const const_iterator &other) const
 
const Key dereference () const
 

Private Attributes

const Selfcollection
 the collection that this iterator is traversing. More...
 
Container::const_iterator it
 the hidden iterator that traverses the block map. More...
 
Coordinate bit
 the current position in the block. More...
 
Word current
 the current value of the block, where visited bits have been erased. More...
 

Friends

struct UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual >
 
class boost::iterator_core_access
 

Detailed Description

template<typename Key, typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
struct DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator

Read iterator on set elements. Model of ForwardIterator.

Definition at line 200 of file UnorderedSetByBlock.h.

Constructor & Destructor Documentation

◆ const_iterator() [1/4]

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::const_iterator ( )
inline

Default constructor.

Definition at line 207 of file UnorderedSetByBlock.h.

207  : collection( nullptr ), it(),
208  bit( static_cast<Coordinate>(0) ),
209  current( static_cast<Word>(0) ) {}
Container::const_iterator it
the hidden iterator that traverses the block map.
const Self * collection
the collection that this iterator is traversing.
Coordinate bit
the current position in the block.
Word current
the current value of the block, where visited bits have been erased.
Splitter::Coordinate Coordinate

◆ const_iterator() [2/4]

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::const_iterator ( const Self aSet,
typename Container::const_iterator  anIt 
)
inline

Constructor from set and container iterator

Parameters
aSeta reference to the visited unordered block set
anItan iterator in the container of this set.

Definition at line 214 of file UnorderedSetByBlock.h.

215  : collection( &aSet ), it( anIt )
216  {
217  if ( it != collection->my_elements.cend() )
218  {
219  current = it->second;
220  bit = static_cast<Coordinate>( Bits::leastSignificantBit( current ) );
221  }
222  else
223  {
224  current = static_cast<Word>(0);
225  bit = static_cast<Coordinate>(0);
226  }
227  }
static unsigned int leastSignificantBit(DGtal::uint8_t n)
Definition: Bits.h:297
Container my_elements
the unordered_set containing the elements

References DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::bit, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::collection, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::current, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::it, DGtal::Bits::leastSignificantBit(), and DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::my_elements.

◆ const_iterator() [3/4]

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::const_iterator ( const Self aSet,
typename Container::const_iterator  anIt,
Coordinate  aBit 
)
inline

Constructor from set, container iterator and starting bit

Parameters
aSeta reference to the visited unordered block set
anItan iterator in the container of this set.
aBitthe bit index in the word pointed by anIt.

Definition at line 233 of file UnorderedSetByBlock.h.

235  : collection( &aSet ), it( anIt ), bit( aBit )
236  {
237  if ( it != collection->my_elements.cend() )
238  {
239  current = it->second;
240  current &= ~( ( static_cast<Word>(1) << bit ) - static_cast<Word>(1) );
241  }
242  else
243  current = static_cast<Word>(0);
244  }

References DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::bit, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::collection, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::current, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::it, and DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::my_elements.

◆ const_iterator() [4/4]

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::const_iterator ( const Self aSet,
const Key &  key 
)
inline

Constructor from set and starting key.

Parameters
aSeta reference to the visited unordered block set
keyany key (if it is in the set, the iterator point on the key, otherwise it is iterator cend().

Definition at line 249 of file UnorderedSetByBlock.h.

250  : collection( &aSet )
251  {
252  auto se = collection->my_splitter.split( key );
253  it = collection->my_elements.find( se.first );
254  if ( it != collection->my_elements.cend() )
255  {
256  bit = se.second;
257  current = it->second & ~( (static_cast<Word>(1) << bit )
258  - static_cast<Word>(1) );
259  }
260  else
261  {
262  bit = static_cast<Coordinate>(0);
263  current = static_cast<Word>(0);
264  }
265  }
Splitter my_splitter
The splitter object.

References DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::bit, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::collection, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::current, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::it, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::my_elements, and DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::my_splitter.

Member Function Documentation

◆ dereference()

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
const Key DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::dereference ( ) const
inlineprivate

◆ equal()

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
bool DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::equal ( const const_iterator other) const
inlineprivate

◆ increment()

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
void DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::increment ( )
inlineprivate

Friends And Related Function Documentation

◆ boost::iterator_core_access

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
friend class boost::iterator_core_access
friend

Definition at line 268 of file UnorderedSetByBlock.h.

◆ UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual >

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
friend struct UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual >
friend

Definition at line 1101 of file UnorderedSetByBlock.h.

Field Documentation

◆ bit

◆ collection

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
const Self* DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::collection
private

◆ current

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
Word DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::current
private

◆ it

template<typename Key , typename TSplitter = Splitter< Key >, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class UnorderedMapAllocator = std::allocator< std::pair<const Key, typename TSplitter::Word > >>
Container::const_iterator DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::const_iterator::it
private

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