75 #ifndef SLIP_COMPONENT_ITERATOR2D_RANGE_HPP
76 #define SLIP_COMPONENT_ITERATOR2D_RANGE_HPP
107 template <
class MultiComponentContainer2D, std::
size_t N>
113 typedef typename MultiComponentContainer2D::value_type
Block;
121 typedef typename MultiComponentContainer2D::size_type
size_type;
132 cont2d_(0),pos_(0),x1_(0),x2_(0),cp_(0),range_x1_(0,0),range_x2_(0,0)
149 cont2d_(c),pos_(&(*c)[0][0][cp] + (r1.start() * int(c->cols()) * N) + (r2.start() * N)),x1_(r1.start()),x2_(r2.start()),cp_(cp),range_x1_(r1),range_x2_(r2)
158 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),cp_(o.cp_),range_x1_(o.range_x1_), range_x2_(o.range_x2_)
179 this->cont2d_ = o.cont2d_;
184 this->range_x1_ = o.range_x1_;
185 this->range_x2_ = o.range_x2_;
227 this->x2_+= range_x2_.
stride();
228 this->pos_+= range_x2_.
stride()*N;
232 this->x1_+= range_x1_.
stride();
233 this->x2_ = range_x2_.
start();
234 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
239 this->x1_ = int(range_x1_.
start()
241 this->x2_ = int(range_x2_.
start()
243 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
280 this->x2_ -= range_x2_.
stride();
281 this->pos_ -= range_x2_.
stride()*N;
285 this->x1_-= range_x1_.
stride();
287 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
294 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
331 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
332 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.cp_ == i2.cp_));
345 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
346 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.cp_ != i2.cp_));
365 return ( i1.pos_ < i2.pos_);
426 this->x1_ += this->range_x1_.
stride() * d.
dx1();
427 this->x2_ += this->range_x2_.
stride() * d.
dx2();
428 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
442 this->x1_ -= this->range_x1_.
stride() * d.
dx1();
443 this->x2_ -= this->range_x2_.
stride() * d.
dx2();
444 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
490 assert(i1.range_x1_.stride() == i2.range_x1_.stride());
491 assert(i1.range_x2_.stride() == i2.range_x2_.stride());
492 return difference_type(
int((i1.x1_ - i2.x1_)/i1.range_x1_.stride()),
int((i1.x2_ - i2.x2_))/i1.range_x2_.stride());
507 assert( (this->x1_+ range_x1_.
stride() * d.
dx1()) < cont2d_->dim1() );
508 assert( (this->x2_+ range_x2_.
stride() * d.
dx2()) < cont2d_->dim2() );
509 return (*cont2d_)[this->x1_+ range_x1_.
stride() * d.
dx1()][this->x2_+ range_x2_.
stride() * d.
dx2()][cp_];
524 return cont2d_->row_begin(this->cp_, range_x1_.
start() + row * range_x1_.
stride(), range_x2_);
551 return cont2d_->col_begin(this->cp_, range_x2_.
start() + col * range_x2_.
stride(), range_x1_);
627 MultiComponentContainer2D* cont2d_;
656 template <
class MultiComponentContainer2D, std::
size_t N>
662 typedef typename MultiComponentContainer2D::value_type
Block;
670 typedef typename MultiComponentContainer2D::size_type
size_type;
681 cont2d_(0),pos_(0),x1_(0),x2_(0),cp_(0),range_x1_(0,0),range_x2_(0,0)
697 cont2d_(c),pos_(&(*c)[0][0][cp] + (r1.start() * int(c->cols()) * N) + (r2.start() * N)),x1_(r1.start()),x2_(r2.start()),cp_(cp),range_x1_(r1),range_x2_(r2)
706 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),cp_(o.cp_),
707 range_x1_(o.range_x1_), range_x2_(o.range_x2_)
728 this->cont2d_ = o.cont2d_;
733 this->range_x1_ = o.range_x1_;
734 this->range_x2_ = o.range_x2_;
780 this->x2_+= range_x2_.
stride();
781 this->pos_+= range_x2_.
stride()*N;
785 this->x1_+= range_x1_.
stride();
786 this->x2_ = range_x2_.
start();
787 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
792 this->x1_ = int(range_x1_.
start()
794 this->x2_ = int(range_x2_.
start()
796 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
833 this->x2_ -= range_x2_.
stride();
834 this->pos_ -= range_x2_.
stride()*N;
838 this->x1_-= range_x1_.
stride();
840 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
847 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
884 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
885 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.cp_ == i2.cp_));
898 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
899 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.cp_ != i2.cp_));
918 return ( i1.pos_ < i2.pos_);
984 this->x1_ += this->range_x1_.
stride() * d.
dx1();
985 this->x2_ += this->range_x2_.
stride() * d.
dx2();
986 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
1004 this->x1_ -= this->range_x1_.
stride() * d.
dx1();
1005 this->x2_ -= this->range_x2_.
stride() * d.
dx2();
1006 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
1052 assert(i1.range_x1_.stride() == i2.range_x1_.stride());
1053 assert(i1.range_x2_.stride() == i2.range_x2_.stride());
1054 return difference_type(
int((i1.x1_ - i2.x1_)/i1.range_x1_.stride()),
int((i1.x2_ - i2.x2_))/i1.range_x2_.stride());
1072 assert( (this->x1_+ range_x1_.
stride() * d.
dx1()) < cont2d_->dim1() );
1073 assert( (this->x2_+ range_x2_.
stride() * d.
dx2()) < cont2d_->dim2() );
1074 return (*cont2d_)[this->x1_+ range_x1_.
stride() * d.
dx1()][this->x2_+ range_x2_.
stride() * d.
dx2()][cp_];
1089 return cont2d_->row_begin(this->cp_, range_x1_.
start() + row * range_x1_.
stride(), range_x2_);
1103 return cont2d_->row_begin(this->cp_, row) + ((range_x2_.
iterations() + 1) * N);
1117 return cont2d_->col_begin(this->cp_, range_x2_.
start() + col * range_x2_.
stride(), range_x1_);
1132 return cont2d_->col_begin(this->cp_, col) + ((range_x1_.
iterations() + 1) * N);
1194 MultiComponentContainer2D* cont2d_;
1208 #endif //SLIP_COMPONENT_ITERATOR2D_RANGE_HPP
self operator--(int)
Postdecrement a component_iterator2d_range. Iterate to the previous location inside the Range2d...
value_type const * pointer
std::size_t iterations() const
Rerturns the number of iterations of the range.
friend bool operator>(const self &i1, const self &i2)
operator.
self & operator+=(const difference_type &d)
component_iterator2d_range addition.
Provides a class to modelize the difference of slip::Point2d.
reference operator*() const
Dereference operator. Returns the element that the current const_component_iterator2d_range i point t...
self & operator=(const self &o)
Assign a component_iterator2d_range.
MultiComponentContainer2D::const_col_range_iterator col_end(size_type col) const
const_component_iterator2d_range element assignment operator.
self & operator++()
Preincrement a component_iterator2d_range. Iterate to the next location inside the Range...
MultiComponentContainer2D::size_type size_type
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint2d.
self operator-(const difference_type &d)
component_iterator2d_range substraction.
const_component_iterator2d_range(MultiComponentContainer2D *c, std::size_t cp, const slip::Range< int > &r1, const slip::Range< int > &r2)
Constructs a const_component_iterator2d_range.
MultiComponentContainer2D::size_type size_type
const_component_iterator2d_range(const self &o)
Constructs a copy of the const_component_iterator2d_range o.
self operator++(int)
Postincrement a const_component_iterator2d_range. Iterate to the next location inside the Range2d...
std::random_access_iterator2d_tag iterator_category
const_component_iterator2d_range()
Constructs a const_component_iterator2d_range.
component_iterator2d_range(const self &o)
Constructs a copy of the component_iterator2d_range o.
Provides a class to tag SLIP iterators.
self & operator=(const self &o)
Assign a const_component_iterator2d_range.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
self operator-(const difference_type &d)
const_component_iterator2d_range substraction.
int x1() const
Access to the first index of the current component_iterator2d_range.
friend difference_type operator-(const self &i1, const self &i2)
component_iterator2d_range difference operator.
self & operator-=(const difference_type &d)
const_component_iterator2d_range substraction.
MultiComponentContainer2D::const_row_range_iterator row_begin(size_type row) const
const_component_iterator2d_range element assignment operator.
MultiComponentContainer2D::const_row_range_iterator row_end(size_type row) const
const_component_iterator2d_range element assignment operator.
component_iterator2d_range(MultiComponentContainer2D *c, std::size_t cp, const slip::Range< int > &r1, const slip::Range< int > &r2)
Constructs a component_iterator2d_range.
int cp() const
Access to the component index of the current const_component_iterator2d_box.
int x2() const
Access to the second index of the current component_iterator2d_range.
self & operator++()
Preincrement a const_component_iterator2d_range. Iterate to the next location inside the Range...
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint2d.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
friend bool operator>=(const self &i1, const self &i2)
>= operator.
int x1() const
Access to the first index of the current const_component_iterator2d_range.
self & operator+=(const difference_type &d)
const_component_iterator2d_range addition.
friend bool operator>(const self &i1, const self &i2)
operator.
self & operator-=(const difference_type &d)
component_iterator2d_range substraction.
value_type const & reference
int i() const
Access to the first index of the current const_component_iterator2d_range.
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
SubType start() const
Accessor of the start subscript of the Range.
MultiComponentContainer2D::component_col_range_iterator col_end(size_type col)
component_iterator2d_range element assignment operator.
self operator+(const difference_type &d)
const_component_iterator2d_range addition.
self operator+(const difference_type &d)
component_iterator2d_range addition.
self & operator--()
Predecrement a component_iterator2d_range. Iterate to the previous location inside the Range2d...
Block::value_type value_type
int x2() const
Access to the second index of the current const_component_iterator2d_range.
int cp() const
Access to the component index of the current component_iterator2d_range.
MultiComponentContainer2D::component_col_range_iterator col_begin(size_type col)
component_iterator2d_range element assignment operator.
reference operator[](difference_type d) const
const_component_iterator2d_range element assignment operator. Equivalent to *(i + d)...
DPoint2d< int > difference_type
friend bool operator>=(const self &i1, const self &i2)
>= operator.
component_iterator2d_range()
Constructs a component_iterator2d_range.
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
int j() const
Access to the second index of the current const_component_iterator2d_range.
reference operator[](difference_type d)
component_iterator2d_range element assignment operator. Equivalent to *(i + d) = t.
std::random_access_iterator2d_tag iterator_category
int i() const
Access to the first index of the current component_iterator2d_range.
MultiComponentContainer2D::component_row_range_iterator row_end(size_type row)
component_iterator2d_range element assignment operator.
pointer operator->() const
friend difference_type operator-(const self &i1, const self &i2)
const_component_iterator2d_range difference operator.
int j() const
Access to the second index of the current component_iterator2d_range.
int stride() const
Accessor of the stride of the Range.
friend bool operator<(const self &i1, const self &i2)
< operator.
Provides a class to modelize 2d points.
reference operator*()
Dereference assignment operator. Returns the element that the current component_iterator2d_range i po...
MultiComponentContainer2D::value_type Block
friend bool operator==(const self &i1, const self &i2)
Equality operator.
self & operator--()
Predecrement a const_component_iterator2d_range. Iterate to the previous location inside the Range2d...
friend bool operator<=(const self &i1, const self &i2)
<= operator.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
friend bool operator<(const self &i1, const self &i2)
< operator.
MultiComponentContainer2D::value_type Block
DPoint2d< int > difference_type
self operator++(int)
Postincrement a component_iterator2d_range. Iterate to the next location inside the Range2d...
Block::value_type value_type
MultiComponentContainer2D::component_row_range_iterator row_begin(size_type row)
component_iterator2d_range element assignment operator.
Provides a class to manipulate Ranges.
SubType stop() const
Accessor of the stop subscript of the Range.
self operator--(int)
Postdecrement a const_component_iterator2d_range. Iterate to the previous location inside the Range2d...
MultiComponentContainer2D::const_col_range_iterator col_begin(size_type col) const
const_component_iterator2d_range element assignment operator.
friend bool operator<=(const self &i1, const self &i2)
<= operator.