HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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)=delete
 
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 26 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 31 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 30 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 34 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 40 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 47 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 104 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 102 of file UT_OrderedIterator.h.

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

Return the number of elemenets in the iteration.

Definition at line 97 of file UT_OrderedIterator.h.

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

Return current index.

Definition at line 94 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 89 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 64 of file UT_OrderedIterator.h.

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

Get the current item

Definition at line 90 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 77 of file UT_OrderedIterator.h.

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

Post-increment operator We used to have this operator, but it's the wrong signature (should not return a reference) and our implementation had a bug. Please use the pre-increment...

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 69 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 57 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 100 of file UT_OrderedIterator.h.


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