CheckedIterator< T > Class Template Reference

A range-checked iterator class for memory debugging. More...

#include <Image/CheckedIterator.H>

List of all members.

Public Types

typedef T value_type
 This typedef is used by STL functions.
typedef T * pointer
 This typedef is used by STL functions.
typedef T & reference
 This typedef is used by STL functions.
typedef ptrdiff_t difference_type
 This typedef is used by STL functions.
typedef
std::random_access_iterator_tag 
iterator_category
 This typedef is used by STL functions.

Public Member Functions

 CheckedIterator ()
 Default constructor.
 CheckedIterator (T *p, T *a, T *b)
 Constructor.
template<class UU >
 CheckedIterator (const CheckedIterator< UU > &other)
 Constructor.
void ck_range (const diff_t offset) const
Pointer arithmetic operators

CheckedIterator< T > & operator++ ()
 Pre-increment operator.
CheckedIterator< T > operator++ (int)
 Post-increment operator.
CheckedIterator< T > & operator-- ()
 Pre-decrement operator.
CheckedIterator< T > operator-- (int)
 Post-decrement operator.
void operator+= (diff_t d)
void operator-= (diff_t d)
CheckedIterator< T > operator+ (diff_t d) const
CheckedIterator< T > operator- (diff_t d) const
diff_t operator- (CheckedIterator< T > other) const
Comparison operators

template<class U >
bool operator== (const CheckedIterator< U > &other) const
template<class U >
bool operator!= (const CheckedIterator< U > &other) const
template<class U >
bool operator< (const CheckedIterator< U > &other) const
template<class U >
bool operator> (const CheckedIterator< U > &other) const
template<class U >
bool operator<= (const CheckedIterator< U > &other) const
template<class U >
bool operator>= (const CheckedIterator< U > &other) const
Dereferencing operators

T * operator-> () const
T & operator* () const
T & operator[] (diff_t d) const

Public Attributes

T * ptr
 Pointer to the data.
T * start
 Pointer to the first element we can iterate on.
T * stop
 Pointer to the last element we can iterete on.

Detailed Description

template<class T>
class CheckedIterator< T >

A range-checked iterator class for memory debugging.

A CheckedIterator<T> object exposes essentially the same interface as a T*, but stores a start/stop range that should bound the iterator. This range is checked with a call to ck_range() every time the iterator is derefenced, by either operator*() or operator->().

Definition at line 63 of file CheckedIterator.H.


Member Typedef Documentation

template<class T>
typedef ptrdiff_t CheckedIterator< T >::difference_type

This typedef is used by STL functions.

Definition at line 76 of file CheckedIterator.H.

template<class T>
typedef std::random_access_iterator_tag CheckedIterator< T >::iterator_category

This typedef is used by STL functions.

Definition at line 79 of file CheckedIterator.H.

template<class T>
typedef T* CheckedIterator< T >::pointer

This typedef is used by STL functions.

Definition at line 70 of file CheckedIterator.H.

template<class T>
typedef T& CheckedIterator< T >::reference

This typedef is used by STL functions.

Definition at line 73 of file CheckedIterator.H.

template<class T>
typedef T CheckedIterator< T >::value_type

This typedef is used by STL functions.

Definition at line 67 of file CheckedIterator.H.


Constructor & Destructor Documentation

template<class T >
CheckedIterator< T >::CheckedIterator (  )  [inline]

Default constructor.

This builds an iterator with an empty valid range, so a new value must be assigned to the iterator before it can be dereferenced. However, providing a default constructor helps keep source compatibility with non-debug iterators (i.e., raw pointers).

Definition at line 163 of file CheckedIterator.H.

Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().

template<class T >
CheckedIterator< T >::CheckedIterator ( T *  p,
T *  a,
T *  b 
) [inline]

Constructor.

Definition at line 169 of file CheckedIterator.H.

template<class T >
template<class UU >
CheckedIterator< T >::CheckedIterator ( const CheckedIterator< UU > &  other  )  [inline]

Constructor.

Definition at line 175 of file CheckedIterator.H.


Member Function Documentation

template<class T >
CheckedIterator< T > CheckedIterator< T >::operator++ ( int   )  [inline]
template<class T >
CheckedIterator< T > & CheckedIterator< T >::operator++ (  )  [inline]

Pre-increment operator.

Definition at line 181 of file CheckedIterator.H.

References CheckedIterator< T >::ptr.

template<class T >
CheckedIterator< T > CheckedIterator< T >::operator-- ( int   )  [inline]
template<class T >
CheckedIterator< T > & CheckedIterator< T >::operator-- (  )  [inline]

Pre-decrement operator.

Definition at line 191 of file CheckedIterator.H.

References CheckedIterator< T >::ptr.


Member Data Documentation

template<class T>
T* CheckedIterator< T >::ptr

Pointer to the data.

Definition at line 148 of file CheckedIterator.H.

Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().

template<class T>
T* CheckedIterator< T >::start

Pointer to the first element we can iterate on.

Definition at line 151 of file CheckedIterator.H.

Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().

template<class T>
T* CheckedIterator< T >::stop

Pointer to the last element we can iterete on.

Definition at line 154 of file CheckedIterator.H.

Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().


The documentation for this class was generated from the following file:
Generated on Sun May 8 08:43:10 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3