75 #ifndef SLIP_ITERATOR2D_BOX_HPP
76 #define SLIP_ITERATOR2D_BOX_HPP
119 template <
class Container2D>
127 typedef typename Container2D::pointer
pointer;
143 cont2d_(0),pos_(0),x1_(0),x2_(0),box_(0,0,0,0)
154 cont2d_(c),pos_((*c)[(b.upper_left())[0]] + (b.upper_left())[1]),x1_((b.upper_left())[0]),x2_((b.upper_left())[1]),box_(b)
163 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),box_(o.box_)
184 this->cont2d_ = o.cont2d_;
236 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
243 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
287 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
294 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
331 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
332 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) );
345 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
346 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) );
366 return ( i1.pos_ < i2.pos_);
427 this->x1_ += d.
dx1();
428 this->x2_ += d.
dx2();
429 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
445 this->x1_ -= d.
dx1();
446 this->x2_ -= d.
dx2();
447 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
514 assert( (
int(this->x1_)+d.
dx1()) <
int(cont2d_->dim1()) );
515 assert( (
int(this->x2_)+d.
dx2()) <
int(cont2d_->dim2()) );
516 return (*cont2d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()];
556 return typename Container2D::reverse_row_iterator(this->
row_end(row));
568 return typename Container2D::reverse_row_iterator(this->
row_begin(row));
608 return typename Container2D::reverse_col_iterator(this->
col_end(col));
620 return typename Container2D::reverse_col_iterator(this->
col_begin(col));
728 Container2D* cont2d_;
765 template <
class Container2D>
766 class const_iterator2d_box
773 typedef typename Container2D::const_pointer
pointer;
774 typedef typename Container2D::const_reference
reference;
789 cont2d_(0),pos_(0),x1_(0),x2_(0),box_(0,0,0,0)
800 cont2d_(c),pos_((*c)[(b.upper_left())[0]] + (b.upper_left())[1]),x1_((b.upper_left())[0]),x2_((b.upper_left())[1]),box_(b)
809 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),box_(o.box_)
830 this->cont2d_ = o.cont2d_;
886 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
893 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
935 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
942 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
979 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
980 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) );
993 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
994 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) );
1013 return ( i1.pos_ < i2.pos_);
1074 this->x1_ += d.
dx1();
1075 this->x2_ += d.
dx2();
1076 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
1092 this->x1_ -= d.
dx1();
1093 this->x2_ -= d.
dx2();
1094 this->pos_ = cont2d_->begin() + (this->x1_ * int(cont2d_->cols())) + this->x2_;
1162 assert(
int(this->x1_+d.
dx1()) <
int(cont2d_->dim1()) );
1163 assert(
int(this->x2_+d.
dx2()) <
int(cont2d_->dim2()) );
1164 return (*cont2d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()];
1208 return typename Container2D::const_reverse_row_iterator(this->
row_end(row));
1222 return typename Container2D::const_reverse_row_iterator(this->
row_begin(row));
1261 return typename Container2D::const_reverse_col_iterator(this->
col_end(col));
1273 return typename Container2D::const_reverse_col_iterator(this->
col_begin(col));
1326 Container2D* cont2d_;
1337 #endif //SLIP_ITERATOR2D_BOX_HPP
Container2D::reference reference
std::size_t iterations() const
Rerturns the number of iterations of the range.
Container2D::pointer pointer
self & operator+=(const difference_type &d)
const_iterator2d_box addition.
Container2D::const_reference reference
Provides a class to modelize the difference of slip::Point2d.
DPoint2d< int > difference_type
CoordType height() const
compute the height of the Box2d.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
const_iterator2d_box()
Constructs a const_iterator2d_box.
reference operator[](difference_type d)
iterator2d_box element assignment operator. Equivalent to *(i + d) = t.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint2d.
Container2D::size_type size_type
Container2D::size_type size_type
Container2D::reverse_col_iterator col_rend(size_type col)
iterator2d_box element assignment operator.
iterator2d_box(const self &o)
Constructs a copy of the iterator2d_box o.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
self & operator--()
Predecrement a const_iterator2d_box. Iterate to the previous location inside the Box2d.
int x1() const
Access to the first index of the current iterator2d_box.
Container2D::col_iterator col_begin(size_type col)
iterator2d_box element assignment operator.
Provides a class to manipulate 2d box.
self operator--(int)
Postdecrement a const_iterator2d_box. Iterate to the previous location inside the Box2d...
self operator++(int)
Postincrement a const_iterator2d_box. Iterate to the next location inside the Box2d.
self & operator++()
Preincrement a const_iterator2d_box. Iterate to the next location inside the Box2d.
Provides a class to tag SLIP iterators.
Container2D::const_reverse_row_iterator row_rend(size_type row) const
iterator2d_box element assignment operator.
std::random_access_iterator2d_tag iterator_category
Container2D::const_reverse_col_iterator col_rend(size_type col) const
iterator2d_box element assignment operator.
reference operator*() const
Dereference operator. Returns the element that the current const_iterator2d_box i point to...
CoordType width() const
compute the width of the Box2d.
self & operator-=(const difference_type &d)
const_iterator2d_box substraction.
friend bool operator<=(const self &i1, const self &i2)
<= operator.
self & operator++()
Preincrement a iterator2d_box. Iterate to the next location inside the Box2d.
void bottom_right(Point< CoordType, 2 >)
Accessor/Mutator of the bottom_right point (p2) of Box2d.
self operator+(const difference_type &d)
const_iterator2d_box addition.
Container2D::row_range_iterator row_begin(size_type row, const slip::Range< int > &range)
iterator2d_box element assignment operator.
self & operator--()
Predecrement a iterator2d_box. Iterate to the previous location inside the Box2d. ...
self operator+(const difference_type &d)
iterator2d_box addition.
Container2D::const_reverse_col_iterator col_rbegin(size_type col) const
iterator2d_box element assignment operator.
Container2D::const_col_iterator col_end(size_type col) const
const_iterator2d_box element assignment operator.
const_iterator2d_box(Container2D *c, const Box2d< int > &b)
Constructs a const_iterator2d_box.
self & operator-=(const difference_type &d)
iterator2d_box substraction.
DPoint2d< int > difference_type
iterator2d_box()
Constructs a iterator2d_box.
Container2D::row_iterator row_begin(size_type row)
iterator2d_box element assignment operator.
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint2d.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
pointer operator->() const
const_iterator2d_box(const self &o)
Constructs a copy of the const_iterator2d_box o.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
This is some iterator to iterate a 2d container into a Box area defined by the indices of the 2d cont...
Container2D::reverse_row_iterator row_rbegin(size_type row)
iterator2d_box element assignment operator.
self operator-(const difference_type &d)
const_iterator2d_box substraction.
Container2D::row_range_iterator row_end(size_type row, const slip::Range< int > &range)
iterator2d_box element assignment operator.
int x2() const
Access to the second index of the current iterator2d_box.
self & operator=(const self &o)
Assign a iterator2d_box.
friend bool operator<(const self &i1, const self &i2)
< operator.
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Container2D::const_row_iterator row_begin(size_type row) const
const_iterator2d_box element assignment operator.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
SubType start() const
Accessor of the start subscript of the Range.
Container2D::const_pointer pointer
self & operator+=(const difference_type &d)
iterator2d_box addition.
Container2D::const_row_iterator row_end(size_type row) const
const_iterator2d_box element assignment operator.
self operator--(int)
Postdecrement a iterator2d_box. Iterate to the previous location inside the Box2d.
Container2D::reverse_row_iterator row_rend(size_type row)
iterator2d_box element assignment operator.
int i() const
Access to the first index of the current iterator2d_box.
Container2D::value_type value_type
self operator-(const difference_type &d)
iterator2d_box substraction.
friend difference_type operator-(const self &i1, const self &i2)
iterator2d_box difference operator.
This is some iterator to iterate a 2d container into a slip::Box2d area defined by the indices of the...
friend bool operator>=(const self &i1, const self &i2)
>= operator.
friend bool operator>(const self &i1, const self &i2)
operator.
Container2D::row_iterator row_end(size_type row)
iterator2d_box element assignment operator.
void upper_left(Point< CoordType, 2 >)
Accessor/Mutator of the upper_left point (p1) of Box2d.
int x2() const
Access to the second index of the current const_iterator2d_box.
int i() const
Access to the first index of the current const_iterator2d_box.
int j() const
Access to the second index of the current iterator2d_box.
iterator2d_box(Container2D *c, const Box2d< int > &b)
Constructs a iterator2d_box.
Container2D::const_col_iterator col_begin(size_type col) const
const_iterator2d_box element assignment operator.
friend bool operator>(const self &i1, const self &i2)
operator.
reference operator[](difference_type d) const
const_iterator2d_box element assignment operator. Equivalent to *(i + d).
int stride() const
Accessor of the stride of the Range.
Container2D::const_reverse_row_iterator row_rbegin(size_type row) const
iterator2d_box element assignment operator.
Container2D::col_range_iterator col_begin(size_type col, const slip::Range< int > &range)
iterator2d_box element assignment operator.
Provides a class to modelize 2d points.
int j() const
Access to the second index of the current const_iterator2d_box.
self operator++(int)
Postincrement a iterator2d_box. Iterate to the next location inside the Box2d.
std::random_access_iterator2d_tag iterator_category
friend bool operator<=(const self &i1, const self &i2)
<= operator.
friend bool operator<(const self &i1, const self &i2)
< operator.
Container2D::reverse_col_iterator col_rbegin(size_type col)
iterator2d_box element assignment operator.
self & operator=(const self &o)
Assign a const_iterator2d_box.
Container2D::value_type value_type
friend difference_type operator-(const self &i1, const self &i2)
const_iterator2d_box difference operator.
Container2D::col_range_iterator col_end(size_type col, const slip::Range< int > &range)
iterator2d_box element assignment operator.
Provides a class to manipulate Ranges.
Container2D::col_iterator col_end(size_type col)
iterator2d_box element assignment operator.
int x1() const
Access to the first index of the current const_iterator2d_box.
reference operator*()
Dereference assignment operator. Returns the element that the current iterator2d_box i point to...