DGtal  1.4.2
DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator Struct Reference

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

#include <DGtal/kernel/UnorderedSetByBlock.h>

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

Public Member Functions

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

Private Member Functions

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

Private Attributes

Selfcollection
 the collection that this iterator is traversing. More...
 
Container::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 >::iterator

Read-write iterator on set elements. Model of ForwardIterator.

Definition at line 315 of file UnorderedSetByBlock.h.

Constructor & Destructor Documentation

◆ iterator() [1/6]

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 >::iterator::iterator ( )
inline

Default constructor.

Definition at line 322 of file UnorderedSetByBlock.h.

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

◆ iterator() [2/6]

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 >::iterator::iterator ( Self aSet,
typename Container::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 329 of file UnorderedSetByBlock.h.

330  : collection( &aSet ), it( anIt )
331  {
332  if ( it != collection->my_elements.end() )
333  {
334  current = it->second;
335  bit = static_cast<Coordinate>(Bits::leastSignificantBit( current ));
336  }
337  else
338  {
339  current = static_cast<Word>(0);
340  bit = static_cast<Coordinate>(0);
341  }
342  }
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 >::iterator::bit, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator::collection, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator::current, DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator::it, DGtal::Bits::leastSignificantBit(), and DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::my_elements.

◆ iterator() [3/6]

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 >::iterator::iterator ( Self aSet,
typename Container::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 348 of file UnorderedSetByBlock.h.

349  : collection( &aSet ), it( anIt ), bit( aBit )
350  {
351  if ( it != collection->my_elements.end() )
352  {
353  current = it->second;
354  current &= ~( ( static_cast<Word>(1) << bit )
355  - static_cast<Word>(1) );
356  }
357  else
358  current = static_cast<Word>(0);
359  }

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

◆ iterator() [4/6]

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 >::iterator::iterator ( 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 end().

Definition at line 366 of file UnorderedSetByBlock.h.

367  : collection( &aSet )
368  {
369  auto se = collection->my_splitter.split( key );
370  it = collection->my_elements.find( se.first );
371  if ( it != collection->my_elements.end() )
372  {
373  bit = se.second;
374  current = it->second & ~( (static_cast<Word>(1) << bit )
375  - static_cast<Word>(1) );
376  }
377  else
378  {
379  bit = static_cast<Coordinate>(0);
380  current = static_cast<Word>(0);
381  }
382  }
Splitter my_splitter
The splitter object.

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

◆ iterator() [5/6]

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 >::iterator::iterator ( const const_iterator other)
inline

Constructor from const_iterator

Parameters
otherany const_iterator

Definition at line 386 of file UnorderedSetByBlock.h.

387  : collection( other.collection ), it( other.it ),
388  bit( other.bit ), current( other.current )
389  {}

◆ iterator() [6/6]

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 >::iterator::iterator ( const_iterator &&  other)
inline

Move constructor from const_iterator

Parameters
otherany const_iterator

Definition at line 393 of file UnorderedSetByBlock.h.

394  : collection( std::move( other.collection ) ),
395  it( std::move( other.it ) ),
396  bit( std::move( other.bit ) ),
397  current( std::move( other.current ) )
398  {}

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 >::iterator::dereference ( ) const
inlineprivate

◆ equal() [1/2]

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 >::iterator::equal ( const const_iterator other) const
inlineprivate

◆ equal() [2/2]

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 >::iterator::equal ( 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 >::iterator::increment ( )
inlineprivate

◆ operator const_iterator()

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 >::iterator::operator const_iterator ( ) const
inline

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 408 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 310 of file UnorderedSetByBlock.h.

Field Documentation

◆ bit

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 > >>
Coordinate DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator::bit
private

◆ 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 > >>
Self* DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::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 >::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::iterator DGtal::UnorderedSetByBlock< Key, TSplitter, Hash, KeyEqual, UnorderedMapAllocator >::iterator::it
private

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