HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_OrderedIterator< T, ITERATOR_T > Class Template Reference

#include <UT_OrderedIterator.h>

Public Types

typedef UT_ValArray< TListType
 Storage for the list of items. More...
 
typedef int(* Comparator )(const T *, const T *)
 

Public Member Functions

 UT_OrderedIterator ()
 Default c-tor. More...
 
 UT_OrderedIterator (const UT_OrderedIterator &src)
 Copy c-tor. More...
 
 UT_OrderedIterator (ITERATOR_T it, Comparator cmp)
 
bool operator== (const UT_OrderedIterator< T, ITERATOR_T > &src) const
 Test equality. More...
 
bool operator!= (const UT_OrderedIterator< T, ITERATOR_T > &src) const
 Test inequality. More...
 
UT_OrderedIterator< T,
ITERATOR_T > & 
operator= (const UT_OrderedIterator< T, ITERATOR_T > &src)
 Assignment operator. More...
 
UT_OrderedIterator< T,
ITERATOR_T > & 
operator++ ()
 Pre-increment operator. More...
 
UT_OrderedIterator< T,
ITERATOR_T > & 
operator++ (int)
 Post-increment operator. More...
 
exint index () const
 Return current index. More...
 
exint entries () const
 Return the number of elemenets in the iteration. More...
 
void rewind ()
 Rewind and start iteration again. More...
 
bool atEnd () const
 Test if at end of the list. More...
 
void advance ()
 Advance to the next iteration. More...
 
Titem () const
 
Toperator* () const
 

Detailed Description

template<typename T, typename ITERATOR_T>
class UT_OrderedIterator< T, ITERATOR_T >

Given an iterator and a comparison function, iterate in sorted order

The iterator type must support:

  • atEnd()
  • T operator*() Currently, the ordered iterator extracts the items from the source iterator, storing them in an array which is then sorted.

Definition at line 25 of file UT_OrderedIterator.h.

Member Typedef Documentation

template<typename T, typename ITERATOR_T>
typedef int(* UT_OrderedIterator< T, ITERATOR_T >::Comparator)(const T *, const T *)

Definition at line 30 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
typedef UT_ValArray<T> UT_OrderedIterator< T, ITERATOR_T >::ListType

Storage for the list of items.

Definition at line 29 of file UT_OrderedIterator.h.

Constructor & Destructor Documentation

template<typename T, typename ITERATOR_T>
UT_OrderedIterator< T, ITERATOR_T >::UT_OrderedIterator ( )
inline

Default c-tor.

Definition at line 33 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
UT_OrderedIterator< T, ITERATOR_T >::UT_OrderedIterator ( const UT_OrderedIterator< T, ITERATOR_T > &  src)
inline

Copy c-tor.

Definition at line 39 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
UT_OrderedIterator< T, ITERATOR_T >::UT_OrderedIterator ( ITERATOR_T  it,
Comparator  cmp 
)
inline

Construct an ordered list by creating a copy of the items and sorting them.

Definition at line 46 of file UT_OrderedIterator.h.

Member Function Documentation

template<typename T, typename ITERATOR_T>
void UT_OrderedIterator< T, ITERATOR_T >::advance ( )
inline

Advance to the next iteration.

Definition at line 106 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
bool UT_OrderedIterator< T, ITERATOR_T >::atEnd ( ) const
inline

Test if at end of the list.

Definition at line 104 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
exint UT_OrderedIterator< T, ITERATOR_T >::entries ( void  ) const
inline

Return the number of elemenets in the iteration.

Definition at line 99 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
exint UT_OrderedIterator< T, ITERATOR_T >::index ( void  ) const
inline

Return current index.

Definition at line 96 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
T& UT_OrderedIterator< T, ITERATOR_T >::item ( ) const
inline

Get the current item

Definition at line 91 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
bool UT_OrderedIterator< T, ITERATOR_T >::operator!= ( const UT_OrderedIterator< T, ITERATOR_T > &  src) const
inline

Test inequality.

Definition at line 63 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
T& UT_OrderedIterator< T, ITERATOR_T >::operator* ( void  ) const
inline

Get the current item

Definition at line 92 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
UT_OrderedIterator<T,ITERATOR_T>& UT_OrderedIterator< T, ITERATOR_T >::operator++ ( )
inline

Pre-increment operator.

Definition at line 76 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
UT_OrderedIterator<T,ITERATOR_T>& UT_OrderedIterator< T, ITERATOR_T >::operator++ ( int  )
inline

Post-increment operator.

Definition at line 82 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
UT_OrderedIterator<T,ITERATOR_T>& UT_OrderedIterator< T, ITERATOR_T >::operator= ( const UT_OrderedIterator< T, ITERATOR_T > &  src)
inline

Assignment operator.

Definition at line 68 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
bool UT_OrderedIterator< T, ITERATOR_T >::operator== ( const UT_OrderedIterator< T, ITERATOR_T > &  src) const
inline

Test equality.

Definition at line 56 of file UT_OrderedIterator.h.

template<typename T, typename ITERATOR_T>
void UT_OrderedIterator< T, ITERATOR_T >::rewind ( )
inline

Rewind and start iteration again.

Definition at line 102 of file UT_OrderedIterator.h.


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