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

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

#include <TMatRowsAsArraysIterator_decl.h>

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

List of all members.

Public Types

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

Public Member Functions

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

Private Attributes

T * ptr
 current row pointer
int width
 vector width
int mod
 mod in underlying matrix
Array< T > v

Detailed Description

template<class T>
class PLearn::TMatRowsAsArraysIterator< 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 an Array

Definition at line 61 of file TMatRowsAsArraysIterator_decl.h.


Member Typedef Documentation

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

Definition at line 67 of file TMatRowsAsArraysIterator_decl.h.

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

Some useful typedefs.

Definition at line 65 of file TMatRowsAsArraysIterator_decl.h.

template<class T>
typedef Array<T>* PLearn::TMatRowsAsArraysIterator< T >::pointer

Definition at line 68 of file TMatRowsAsArraysIterator_decl.h.

template<class T>
typedef Array<T>& PLearn::TMatRowsAsArraysIterator< T >::reference

Definition at line 69 of file TMatRowsAsArraysIterator_decl.h.

template<class T>
typedef Array<T> PLearn::TMatRowsAsArraysIterator< T >::value_type

Definition at line 66 of file TMatRowsAsArraysIterator_decl.h.


Constructor & Destructor Documentation

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

Definition at line 78 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 81 of file TMatRowsAsArraysIterator_decl.h.

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

Member Function Documentation

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

Definition at line 89 of file TMatRowsAsArraysIterator_decl.h.

References PLearn::operator==().

    { return !operator==(y); }

Here is the call graph for this function:

template<class T>
Array<T>& PLearn::TMatRowsAsArraysIterator< T >::operator* ( ) [inline]

Definition at line 92 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 131 of file TMatRowsAsArraysIterator_decl.h.

References n.

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

Definition at line 102 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 107 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 126 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 142 of file TMatRowsAsArraysIterator_decl.h.

References n.

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

Definition at line 148 of file TMatRowsAsArraysIterator_decl.h.

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

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

Definition at line 119 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 114 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 137 of file TMatRowsAsArraysIterator_decl.h.

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

Definition at line 156 of file TMatRowsAsArraysIterator_decl.h.

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

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

Definition at line 152 of file TMatRowsAsArraysIterator_decl.h.

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

Member Data Documentation

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

mod in underlying matrix

Definition at line 74 of file TMatRowsAsArraysIterator_decl.h.

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

template<class T>
T* PLearn::TMatRowsAsArraysIterator< T >::ptr [private]
template<class T>
Array<T> PLearn::TMatRowsAsArraysIterator< T >::v [private]

Definition at line 75 of file TMatRowsAsArraysIterator_decl.h.

template<class T>
int PLearn::TMatRowsAsArraysIterator< T >::width [private]

vector width

Definition at line 73 of file TMatRowsAsArraysIterator_decl.h.

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


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