Tulip  5.3.0
Large graphs analysis and drawing
tlp::UniqueIterator< T, CheckFunc > Class Template Reference

#include <UniqueIterator.h>

+ Inheritance diagram for tlp::UniqueIterator< T, CheckFunc >:
+ Collaboration diagram for tlp::UniqueIterator< T, CheckFunc >:

Public Member Functions

 UniqueIterator (Iterator< T > *it, CheckFunc checkFunctor=CheckFunc())
 
bool hasNext ()
 
next ()
 
void update ()
 
- Public Member Functions inherited from tlp::Iterator< T >
iterator_t begin ()
 
iterator_t end ()
 

Detailed Description

template<typename T, typename CheckFunc = CheckAllFunctor<T>>
class tlp::UniqueIterator< T, CheckFunc >

UniqueIterator enables to remove duplicated elements in an iterator.

Parameters
itthe iterator in which we want to filter out duplicated elements
checkFunctora functor or a lambda function that enables to indicate whether or not the element could be duplicated (default test all elements)

The functor function shoul have the following form

template <typename T>
class ACheckFunctor {
bool operator(const T &a) {
return true if a could be duplicated else false;
}
};

checkFunctor are used for optimization purpose to prevent to log(n) test for all elements when not necessary.

Definition at line 66 of file UniqueIterator.h.

Member Function Documentation

◆ hasNext()

template<typename T, typename CheckFunc = CheckAllFunctor<T>>
bool tlp::UniqueIterator< T, CheckFunc >::hasNext ( )
inlinevirtual

Tells if the sequence is at its end.

Returns
bool Whether there are more elements to iterate.

Implements tlp::Iterator< T >.

Definition at line 83 of file UniqueIterator.h.

◆ next()

template<typename T, typename CheckFunc = CheckAllFunctor<T>>
T tlp::UniqueIterator< T, CheckFunc >::next ( )
inlinevirtual

Moves the Iterator on the next element.

Returns
The current element pointed by the Iterator.

Implements tlp::Iterator< T >.

Definition at line 77 of file UniqueIterator.h.