Changeset 1080 for trunk/yat


Ignore:
Timestamp:
Feb 13, 2008, 12:49:57 PM (14 years ago)
Author:
Peter
Message:

refs #247, #252, and #267

Location:
trunk/yat
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/DataLookup1D.cc

    r1062 r1080  
    9595  DataLookup1D::const_iterator DataLookup1D::begin(void) const
    9696  {
    97     typedef utility::Iterator<const DataLookup2D, const double> Iter;
    9897    if (column_vector_)
    99       return const_iterator(Iter(*matrix_, 0, index_), matrix_->columns());
    100     return const_iterator(Iter(*matrix_, index_, 0), 1);
     98      return const_iterator(const_iterator::iterator_type(*matrix_, 0, index_),
     99                            matrix_->columns());
     100    return const_iterator(const_iterator::iterator_type(*matrix_, index_, 0),1);
    101101  }
    102102
     
    104104  DataLookup1D::const_iterator DataLookup1D::end(void) const
    105105  {
    106     typedef utility::Iterator<const DataLookup2D, const double> Iter;
    107106    if (column_vector_)
    108       return const_iterator(Iter(*matrix_, matrix_->rows(), index_),
     107      return const_iterator(const_iterator::iterator_type(*matrix_,
     108                                                          matrix_->rows(),
     109                                                          index_),
    109110                            matrix_->columns());
    110     return const_iterator(Iter(*matrix_, index_+1, 0), 1);
     111    return const_iterator(const_iterator::iterator_type(*matrix_,index_+1,0), 1);
    111112  }
    112113
  • trunk/yat/classifier/DataLookup1D.h

    r1062 r1080  
    2929#include "DataLookup2D.h"
    3030#include "yat/utility/Iterator.h"
     31#include "yat/utility/iterator_traits.h"
    3132#include "yat/utility/StrideIterator.h"
    3233
     
    4950  public:
    5051    /// 'Read Only' iterator
    51     typedef utility::StrideIterator<utility::Iterator<const DataLookup2D,
    52                                                       const double> >
     52    typedef utility::StrideIterator<
     53    utility::Iterator<const DataLookup2D, utility::unweighted_type, const double,
     54                      void, const double> >
    5355    const_iterator;
    5456
  • trunk/yat/classifier/KernelLookup.h

    r1066 r1080  
    3131#include "MatrixLookup.h"
    3232#include "yat/utility/Iterator.h"
     33#include "yat/utility/iterator_traits.h"
    3334#include "yat/utility/StrideIterator.h"
    3435
     
    7071  public:
    7172    /// 'Read Only' iterator
    72     typedef utility::StrideIterator<utility::Iterator<const KernelLookup,
    73                                                       const double> >
     73    typedef utility::StrideIterator<
     74    utility::Iterator<const KernelLookup, utility::unweighted_type, const double,
     75                      void, const double> >
    7476    const_iterator;
    7577
  • trunk/yat/classifier/MatrixLookup.h

    r1066 r1080  
    2929#include "DataLookup2D.h"
    3030#include "yat/utility/Iterator.h"
     31#include "yat/utility/iterator_traits.h"
    3132#include "yat/utility/StrideIterator.h"
    3233
     
    7374  public:
    7475    /// 'Read Only' iterator
    75     typedef utility::StrideIterator<utility::Iterator<const MatrixLookup,
    76                                                       const double> >
     76    typedef utility::StrideIterator<
     77    utility::Iterator<const MatrixLookup, utility::unweighted_type, const double,
     78                      void, const double> >
    7779    const_iterator;
    7880
  • trunk/yat/utility/Iterator.h

    r1067 r1080  
    2525*/
    2626
     27#include "IteratorPolicy.h"
    2728#include "yat_assert.h"
    2829
     
    3940     @brief Iterator
    4041  */
    41   template<typename Container, typename T>
     42  template<typename Container, typename weighted_tag, typename value,
     43           typename pointer = value*, typename reference = value&,
     44           class Policy = IteratorPolicy<Container, reference> >
    4245  class Iterator
    43     : public std::iterator<std::random_access_iterator_tag, double, size_t, T,
    44                            void>
     46    : public std::iterator<std::random_access_iterator_tag, value, size_t,
     47                           pointer, reference>
    4548  {
    4649  public:
    47     //typedef size_t difference_type;
    48     typedef T reference;
    49     typedef double* pointer;
    50    
     50    typedef weighted_tag weighted_iterator_type;
     51
    5152  private:
    52     typedef Iterator<Container, T> self;
     53    typedef Iterator<Container, weighted_tag, value, pointer, reference> self;
    5354
    5455  public:
     
    7576      yat_assert<std::out_of_range>(index_ < this->size(),
    7677                                    "Iterator::operator*");
    77       return container_->operator()(this->row(index_), this->column(index_));
     78      return ip_.dereference(*container_, row(index_), column(index_));
    7879    }
    7980
     
    8586      yat_assert<std::out_of_range>(index_+n < this->size(),
    8687                                    "Iterator::operator[]");
    87       return container_->operator()(this->row(index_+n), this->column(index_+n));
     88      return ip_.dereference(*container_, row(index_+n), column(index_+n));
    8889    }
    8990
     
    228229    Container* container_;
    229230    size_t index_;
     231    Policy ip_;
    230232
    231233    size_t column(size_t i) const
     
    236238    { return container_->columns()*container_->rows(); }
    237239
     240
    238241    // Using compiler generated copy
    239242    //Iterator(const Iterator&);
Note: See TracChangeset for help on using the changeset viewer.