Overview     Modules     Class Hierarchy     Classes     Members  

tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR > Class Template Reference
[Iterator]

UniqueIterator enables to remove duplicated elements in an iterator. More...

#include <uniqueiterator.h>

Inheritance diagram for tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >:
Collaboration diagram for tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >:

List of all members.

Public Member Functions


Detailed Description

template<typename TYPE, typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
class tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >

UniqueIterator enables to remove duplicated elements in an iterator.

Parameters:
it the iterator in which we want to filter out duplicated elements
checkFuncor a functor that enable to indicate wheter or not the element could be duplicated (default test all elements)

The functor function shoul have the following form

 class ACheckFunctor {
  bool operator(TYPE 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.


Constructor & Destructor Documentation

template<typename TYPE , typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >::UniqueIterator ( Iterator< TYPE > *  it,
TOCHECKFUNCTOR  checkFunctor = TOCHECKFUNCTOR() 
) [inline]
template<typename TYPE , typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >::~UniqueIterator (  )  [inline]

Member Function Documentation

template<typename TYPE , typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
bool tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >::hasNext (  )  [inline, virtual]

Tells if the sequence is at its end.

Returns:
bool Whether there are more elements to iterate on.

Implements tlp::Iterator< TYPE >.

template<typename TYPE , typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
TYPE tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >::next (  )  [inline, virtual]

Moves the Iterator on the next element.

Returns:
The current element pointed by the Iterator.

Implements tlp::Iterator< TYPE >.

template<typename TYPE , typename TOCHECKFUNCTOR = CheckAllFunctor<TYPE>>
void tlp::UniqueIterator< TYPE, TOCHECKFUNCTOR >::update (  )  [inline]


Tulip Software by LaBRI Visualization Team    2001 - 2011