Wt::Matrix< T >::iterator Class Reference

#include <matrix.h>

Inheritance diagram for Wt::Matrix< T >::iterator:

Inheritance graph
[legend]
Collaboration diagram for Wt::Matrix< T >::iterator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 iterator (Matrix *matrix_p=0, int row=0, int column=0)
bool operator== (const iterator &other) const
bool operator!= (const iterator &other) const
iteratoroperator++ ()
T & operator * () const
T * operator-> () const
int row () const
int column () const

Private Attributes

Matrixm_
int row_
int column_

Detailed Description

template<typename T>
class Wt::Matrix< T >::iterator

Definition at line 37 of file matrix.h.


Constructor & Destructor Documentation

template<typename T>
Wt::Matrix< T >::iterator::iterator ( Matrix matrix_p = 0,
int  row = 0,
int  column = 0 
) [inline]

Definition at line 39 of file matrix.h.

References Wt::Matrix< T >::iterator::column_, Wt::Matrix< T >::iterator::m_, Wt::Matrix< T >::numCols(), Wt::Matrix< T >::numRows(), and Wt::Matrix< T >::iterator::row_.

00039                                                                     :
00040                 m_(matrix_p),
00041                 row_(row),
00042         column_(column) {
00043             if (matrix_p) {
00044                 if (row_ >= m_->numRows())
00045                     row_ = -1;
00046                 if (column_ >= m_->numCols())
00047                     column_ = -1;
00048             }
00049         }
        bool operator==(const iterator& other) const {

Here is the call graph for this function:


Member Function Documentation

template<typename T>
int Wt::Matrix< T >::iterator::column (  )  const [inline]

Definition at line 90 of file matrix.h.

References Wt::Matrix< T >::iterator::column_.

00090                            {
00091             return column_;
00092         }

template<typename T>
T& Wt::Matrix< T >::iterator::operator * (  )  const [inline]

Definition at line 75 of file matrix.h.

References Wt::Matrix< T >::iterator::column_, Wt::Matrix< T >::iterator::m_, and Wt::Matrix< T >::iterator::row_.

00075                              {
00076             Matrix& matrix = *m_;
00077             T& t = matrix[row_][column_];
00078             return t;
00079         }

template<typename T>
bool Wt::Matrix< T >::iterator::operator!= ( const iterator other  )  const [inline]

Definition at line 53 of file matrix.h.

00053                                                      {
00054             return !(*this == other);
00055         }

template<typename T>
iterator& Wt::Matrix< T >::iterator::operator++ (  )  [inline]

Definition at line 56 of file matrix.h.

References Wt::Matrix< T >::iterator::column_, Wt::Matrix< T >::iterator::m_, Wt::Matrix< T >::numCols(), Wt::Matrix< T >::numRows(), and Wt::Matrix< T >::iterator::row_.

00056                                {
00057             const Matrix& matrix = *m_;
00058             if (column_ < matrix.numCols() - 1) {
00059                 ++column_;
00060             } else {
00061                 // end of column
00062                 if (row_ < matrix.numRows() - 1) {
00063                     // advance row
00064                     ++row_;
00065                     column_ = 0;
00066                 } else {
00067                     // end()
00068                     row_ = -1;
00069                     column_ = -1;
00070                 }
00071             }
00072             return *this;
00073         }

Here is the call graph for this function:

template<typename T>
T* Wt::Matrix< T >::iterator::operator-> (  )  const [inline]

Definition at line 80 of file matrix.h.

References Wt::Matrix< T >::iterator::column_, Wt::Matrix< T >::iterator::m_, and Wt::Matrix< T >::iterator::row_.

00080                               {
00081             Matrix& matrix = *m_;
00082             T* t = &matrix[row_][column_];
00083             return t;
00084         }

template<typename T>
bool Wt::Matrix< T >::iterator::operator== ( const iterator other  )  const [inline]

Definition at line 50 of file matrix.h.

References Wt::Matrix< T >::iterator::column_, and Wt::Matrix< T >::iterator::row_.

00050                                                      {
00051             return (other.column_ == column_) && (other.row_ == row_);
00052         }

template<typename T>
int Wt::Matrix< T >::iterator::row (  )  const [inline]

Definition at line 86 of file matrix.h.

References Wt::Matrix< T >::iterator::row_.

00086                         {
00087             return row_;
00088         }


Member Data Documentation

template<typename T>
int Wt::Matrix< T >::iterator::column_ [private]

Definition at line 97 of file matrix.h.

Referenced by Wt::Matrix< T >::iterator::column(), Wt::Matrix< T >::iterator::iterator(), Wt::Matrix< T >::iterator::operator *(), Wt::Matrix< T >::iterator::operator++(), Wt::Matrix< T >::iterator::operator->(), and Wt::Matrix< T >::iterator::operator==().

template<typename T>
Matrix* Wt::Matrix< T >::iterator::m_ [private]

Definition at line 95 of file matrix.h.

Referenced by Wt::Matrix< T >::iterator::iterator(), Wt::Matrix< T >::iterator::operator *(), Wt::Matrix< T >::iterator::operator++(), and Wt::Matrix< T >::iterator::operator->().

template<typename T>
int Wt::Matrix< T >::iterator::row_ [private]

Definition at line 96 of file matrix.h.

Referenced by Wt::Matrix< T >::iterator::iterator(), Wt::Matrix< T >::iterator::operator *(), Wt::Matrix< T >::iterator::operator++(), Wt::Matrix< T >::iterator::operator->(), Wt::Matrix< T >::iterator::operator==(), and Wt::Matrix< T >::iterator::row().


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

Generated Fri Jul 28 19:30:20 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.