File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
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.
 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.
Container::const_iterator it
 the hidden iterator that traverses the block map.
Coordinate bit
 the current position in the block.
Word current
 the current value of the block, where visited bits have been erased.

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.

References bit, collection, current, and it.

Referenced by equal().

◆ 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:295

References collection, and it.

◆ 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 bit, collection, current, and it.

◆ 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 }

References collection, and it.

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

Definition at line 298 of file UnorderedSetByBlock.h.

299 {
300 return collection->my_splitter.join( it->first, bit );
301 }

References bit, collection, and it.

◆ 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

Definition at line 292 of file UnorderedSetByBlock.h.

293 {
294 ASSERT( collection == other.collection );
295 return it == other.it && bit == other.bit;
296 }

References bit, collection, const_iterator(), and it.

◆ 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

Definition at line 269 of file UnorderedSetByBlock.h.

270 {
271 ASSERT( current != static_cast<Word>(0)
272 && "Invalid increment on const_iterator" );
273 current &= ~( static_cast<Word>(1) << bit );
274 if ( current == static_cast<Word>(0) )
275 {
276 ++it;
277 if ( it != collection->my_elements.cend() )
278 {
279 current = it->second;
281 }
282 else
283 {
284 current = static_cast<Word>(0);
285 bit = static_cast<Coordinate>(0); // NB: LSB(0) is undefined
286 }
287 }
288 else
290 }

References bit, collection, current, it, and DGtal::Bits::leastSignificantBit().

◆ 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.

References boost::iterator_core_access.

Referenced by boost::iterator_core_access.

◆ 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

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 >::const_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 > >>
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

the current value of the block, where visited bits have been erased.

Definition at line 310 of file UnorderedSetByBlock.h.

Referenced by const_iterator(), const_iterator(), and increment().

◆ 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: