PLearn 0.1
Public Types | Public Member Functions | Private Attributes
PLearn::TMatRowsIterator< T > Class Template Reference

Model of the Random Access Iterator concept for iterating through the ROWS of a TMat. More...

#include <TMatRowsIterator_decl.h>

Collaboration diagram for PLearn::TMatRowsIterator< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef random_access_iterator_tag iterator_category
 Some useful typedefs.
typedef TVec< T > value_type
typedef ptrdiff_t difference_type
typedef TVec< T > * pointer
typedef TVec< T > & reference

Public Member Functions

 TMatRowsIterator ()
 TMatRowsIterator (T *p, int w, int m)
bool operator== (const TMatRowsIterator &other) const
bool operator!= (const TMatRowsIterator &y)
value_type operator* ()
TMatRowsIteratoroperator++ ()
TMatRowsIterator operator++ (int)
TMatRowsIteratoroperator-- ()
TMatRowsIterator operator-- (int)
TMatRowsIteratoroperator+= (difference_type n)
TMatRowsIterator operator+ (difference_type n)
TMatRowsIteratoroperator-= (difference_type n)
TMatRowsIterator operator- (difference_type n)
difference_type operator- (const TMatRowsIterator &y)
value_type operator[] (difference_type n)
bool operator< (const TMatRowsIterator &y)

Private Attributes

T * ptr
 current row pointer
int width
 vector width
int mod
 mod in underlying matrix

Detailed Description

template<class T>
class PLearn::TMatRowsIterator< T >

Model of the Random Access Iterator concept for iterating through the ROWS of a TMat.

The basic idea is that operator* returns the current row as a TVec.

Definition at line 58 of file TMatRowsIterator_decl.h.


Member Typedef Documentation

template<class T>
typedef ptrdiff_t PLearn::TMatRowsIterator< T >::difference_type

Definition at line 64 of file TMatRowsIterator_decl.h.

template<class T>
typedef random_access_iterator_tag PLearn::TMatRowsIterator< T >::iterator_category

Some useful typedefs.

Definition at line 62 of file TMatRowsIterator_decl.h.

template<class T>
typedef TVec<T>* PLearn::TMatRowsIterator< T >::pointer

Definition at line 65 of file TMatRowsIterator_decl.h.

template<class T>
typedef TVec<T>& PLearn::TMatRowsIterator< T >::reference

Definition at line 66 of file TMatRowsIterator_decl.h.

template<class T>
typedef TVec<T> PLearn::TMatRowsIterator< T >::value_type

Definition at line 63 of file TMatRowsIterator_decl.h.


Constructor & Destructor Documentation

template<class T>
PLearn::TMatRowsIterator< T >::TMatRowsIterator ( ) [inline]

Definition at line 74 of file TMatRowsIterator_decl.h.

        : ptr(), width(), mod() {}
template<class T>
PLearn::TMatRowsIterator< T >::TMatRowsIterator ( T *  p,
int  w,
int  m 
) [inline]

Definition at line 77 of file TMatRowsIterator_decl.h.

        : ptr(p), width(w), mod(m) {}

Member Function Documentation

template<class T>
bool PLearn::TMatRowsIterator< T >::operator!= ( const TMatRowsIterator< T > &  y) [inline]

Definition at line 85 of file TMatRowsIterator_decl.h.

References PLearn::operator==().

    { return !operator==(y); }

Here is the call graph for this function:

template<class T>
value_type PLearn::TMatRowsIterator< T >::operator* ( ) [inline]

Definition at line 88 of file TMatRowsIterator_decl.h.

                           {
        return TVec<T>(width, ptr);
    }
template<class T>
TMatRowsIterator PLearn::TMatRowsIterator< T >::operator+ ( difference_type  n) [inline]

Definition at line 125 of file TMatRowsIterator_decl.h.

References n.

                                                  {
        TMatRowsIterator r(*this);
        r += n;
        return r;
    }
template<class T>
TMatRowsIterator& PLearn::TMatRowsIterator< T >::operator++ ( ) [inline]

Definition at line 96 of file TMatRowsIterator_decl.h.

                                   {
        ptr += mod;
        return *this;
    }
template<class T>
TMatRowsIterator PLearn::TMatRowsIterator< T >::operator++ ( int  ) [inline]

Definition at line 101 of file TMatRowsIterator_decl.h.

                                     {
        TMatRowsIterator r(*this);
        ptr += mod;
        return r;
    }
template<class T>
TMatRowsIterator& PLearn::TMatRowsIterator< T >::operator+= ( difference_type  n) [inline]

Definition at line 120 of file TMatRowsIterator_decl.h.

                                                    {
        ptr += n*mod;
        return *this;
    }
template<class T>
TMatRowsIterator PLearn::TMatRowsIterator< T >::operator- ( difference_type  n) [inline]

Definition at line 136 of file TMatRowsIterator_decl.h.

References n.

                                                  {
        TMatRowsIterator r(*this);
        r -= n;
        return r;
    }
template<class T>
difference_type PLearn::TMatRowsIterator< T >::operator- ( const TMatRowsIterator< T > &  y) [inline]

Definition at line 142 of file TMatRowsIterator_decl.h.

References PLearn::TMatRowsIterator< T >::ptr.

                                                         {
        return (ptr - y.ptr) / mod;
    }
template<class T>
TMatRowsIterator PLearn::TMatRowsIterator< T >::operator-- ( int  ) [inline]

Definition at line 113 of file TMatRowsIterator_decl.h.

                                     {
        TMatRowsIterator r(*this);
        ptr -= mod;
        return r;
    }
template<class T>
TMatRowsIterator& PLearn::TMatRowsIterator< T >::operator-- ( ) [inline]

Definition at line 108 of file TMatRowsIterator_decl.h.

                                   {
        ptr -= mod;
        return *this;
    }
template<class T>
TMatRowsIterator& PLearn::TMatRowsIterator< T >::operator-= ( difference_type  n) [inline]

Definition at line 131 of file TMatRowsIterator_decl.h.

                                                    {
        ptr -= n*mod;
        return *this;
    }
template<class T>
bool PLearn::TMatRowsIterator< T >::operator< ( const TMatRowsIterator< T > &  y) [inline]

Definition at line 150 of file TMatRowsIterator_decl.h.

References PLearn::TMatRowsIterator< T >::ptr.

                                              {
        return ptr < y.ptr;
    }
template<class T>
bool PLearn::TMatRowsIterator< T >::operator== ( const TMatRowsIterator< T > &  other) const [inline]

Definition at line 81 of file TMatRowsIterator_decl.h.

References PLearn::TMatRowsIterator< T >::mod, PLearn::TMatRowsIterator< T >::ptr, and PLearn::TMatRowsIterator< T >::width.

                                                         {
        return ptr == other.ptr && width == other.width && mod == other.mod;
    }
template<class T>
value_type PLearn::TMatRowsIterator< T >::operator[] ( difference_type  n) [inline]

Definition at line 146 of file TMatRowsIterator_decl.h.

                                             {
        return TVec<T>(width, ptr + n*mod);
    }

Member Data Documentation

template<class T>
int PLearn::TMatRowsIterator< T >::mod [private]

mod in underlying matrix

Definition at line 71 of file TMatRowsIterator_decl.h.

Referenced by PLearn::TMatRowsIterator< T >::operator==().

template<class T>
T* PLearn::TMatRowsIterator< T >::ptr [private]
template<class T>
int PLearn::TMatRowsIterator< T >::width [private]

vector width

Definition at line 70 of file TMatRowsIterator_decl.h.

Referenced by PLearn::TMatRowsIterator< T >::operator==().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines