75 #ifndef SLIP_COMPONENT_ITERATOR2D_BOX_HPP
76 #define SLIP_COMPONENT_ITERATOR2D_BOX_HPP
108 template <
class MultiComponentContainer2D, std::
size_t N>
116 typedef typename MultiComponentContainer2D::value_type
Block;
124 typedef typename MultiComponentContainer2D::size_type
size_type;
135 cont2d_(0),pos_(0),x1_(0),x2_(0),cp_(0),box_(0,0,0,0)
147 cont2d_(c),pos_(&(*c)[0][0][cp] + ((b.upper_left())[0] * int(c->cols()) * N) + ((b.upper_left())[1] * N)),x1_((b.upper_left())[0]),x2_((b.upper_left())[1]),cp_(cp),box_(b)
156 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),cp_(o.cp_),box_(o.box_)
177 this->cont2d_ = o.cont2d_;
230 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
237 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
280 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
287 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
324 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
325 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_)
326 && (i1.cp_ == i2.cp_));
339 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
340 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_)
341 || (i1.cp_ != i2.cp_));
362 return ( i1.pos_ < i2.pos_);
422 this->x1_ += d.
dx1();
423 this->x2_ += d.
dx2();
424 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
440 this->x1_ -= d.
dx1();
441 this->x2_ -= d.
dx2();
442 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
503 assert( (this->x1_+d.
dx1()) < cont2d_->dim1() );
504 assert( (this->x2_+d.
dx2()) < cont2d_->dim2() );
505 return (*cont2d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()][cp_];
518 return cont2d_->row_begin(this->cp_,this->box_.
upper_left()[0] + row)+ this->box_.
upper_left()[1];
544 return cont2d_->col_begin(this->cp_,this->box_.
upper_left()[1] + col) + this->box_.
upper_left()[0];
570 return typename MultiComponentContainer2D::reverse_component_row_iterator(
typename MultiComponentContainer2D::component_row_iterator(cont2d_->row_begin(this->cp_,this->box_.upper_left()[0] + row)+ this->box_.
upper_left()[1])+ this->box_.
width());
583 return typename MultiComponentContainer2D::reverse_component_row_iterator(cont2d_->row_begin(this->cp_,this->box_.upper_left()[0] + row)+ this->box_.
upper_left()[1]);
595 return typename MultiComponentContainer2D::reverse_component_col_iterator(
typename MultiComponentContainer2D::component_col_iterator(cont2d_->col_begin(this->cp_,this->box_.upper_left()[1] + col) + this->box_.
upper_left()[0]) + this->box_.
height());
607 return typename MultiComponentContainer2D::reverse_component_col_iterator(
typename MultiComponentContainer2D::component_col_iterator(cont2d_->col_begin(this->cp_,this->box_.upper_left()[1] + col) + this->box_.
upper_left()[0]));
669 MultiComponentContainer2D* cont2d_;
697 template <
class MultiComponentContainer2D, std::
size_t N>
705 typedef typename MultiComponentContainer2D::value_type
Block;
713 typedef typename MultiComponentContainer2D::size_type
size_type;
724 cont2d_(0),pos_(0),x1_(0),x2_(0),cp_(0),box_(0,0,0,0)
736 cont2d_(c),pos_(&(*c)[0][0][cp] + ((b.upper_left())[0] * int(c->cols()) * N) + ((b.upper_left())[1] * N)),x1_((b.upper_left())[0]),x2_((b.upper_left())[1]),cp_(cp),box_(b)
745 cont2d_(o.cont2d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),cp_(o.cp_),box_(o.box_)
766 this->cont2d_ = o.cont2d_;
819 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
826 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
869 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
876 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
913 return ( (i1.cont2d_ == i2.cont2d_) && (i1.pos_ == i2.pos_)
914 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_)
915 && (i1.cp_ == i2.cp_));
928 return ( (i1.cont2d_ != i2.cont2d_) || (i1.pos_ != i2.pos_)
929 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_)
930 || (i1.cp_ != i2.cp_));
951 return ( i1.pos_ < i2.pos_);
1011 this->x1_ += d.
dx1();
1012 this->x2_ += d.
dx2();
1013 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
1029 this->x1_ -= d.
dx1();
1030 this->x2_ -= d.
dx2();
1031 this->pos_ = &(*cont2d_)[0][0][this->cp_] + (this->x1_ * int(cont2d_->cols()) * N) + this->x2_ * N;
1092 assert( (this->x1_+d.
dx1()) < cont2d_->dim1() );
1093 assert( (this->x2_+d.
dx2()) < cont2d_->dim2() );
1094 return (*cont2d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()][cp_];
1107 return cont2d_->row_begin(this->cp_,this->box_.
upper_left()[0] + row)+ this->box_.
upper_left()[1];
1133 return cont2d_->col_begin(this->cp_,this->box_.
upper_left()[1] + col) + this->box_.
upper_left()[0];
1158 return typename MultiComponentContainer2D::const_reverse_component_row_iterator(
typename MultiComponentContainer2D::const_component_row_iterator(cont2d_->row_begin(this->cp_,this->box_.upper_left()[0] + row)+ this->box_.
upper_left()[1])+ this->box_.
width());
1169 typename MultiComponentContainer2D::const_reverse_component_row_iterator
row_rend(
size_type row)
const
1171 return typename MultiComponentContainer2D::const_reverse_component_row_iterator(cont2d_->row_begin(this->cp_,this->box_.upper_left()[0] + row)+ this->box_.
upper_left()[1]);
1183 return typename MultiComponentContainer2D::reverse_component_col_iterator(
typename MultiComponentContainer2D::const_component_col_iterator(cont2d_->col_begin(this->cp_,this->box_.upper_left()[1] + col) + this->box_.
upper_left()[0]) + this->box_.
height());
1193 typename MultiComponentContainer2D::const_reverse_component_col_iterator
col_rend(
size_type col)
const
1195 return typename MultiComponentContainer2D::reverse_component_col_iterator(
typename MultiComponentContainer2D::const_component_col_iterator(cont2d_->col_begin(this->cp_,this->box_.upper_left()[1] + col) + this->box_.
upper_left()[0]));
1257 MultiComponentContainer2D* cont2d_;
1267 #endif //SLIP_COMPONENT_ITERATOR_HPP
friend bool operator>=(const self &i1, const self &i2)
>= operator.
self operator-(const difference_type &d)
const_component_iterator2d_box substraction.
pointer operator->() const
MultiComponentContainer2D::const_component_row_iterator row_end(size_type row) const
const_component_iterator2d_box element assignment operator.
MultiComponentContainer2D::const_component_row_iterator row_begin(size_type row) const
const_component_iterator2d_box element assignment operator.
MultiComponentContainer2D::reverse_component_col_iterator col_rend(size_type col)
component_iterator2d_box col reverse iterator.
Provides a class to modelize the difference of slip::Point2d.
CoordType height() const
compute the height of the Box2d.
const_component_iterator2d_box(const self &o)
Constructs a copy of the const_component_iterator2d_box o.
friend bool operator<=(const self &i1, const self &i2)
<= operator.
self & operator--()
Predecrement a component_iterator2d_box. Iterate to the previous location inside the Box2d...
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint2d.
value_type const * pointer
self & operator++()
Preincrement a component_iterator2d_box. Iterate to the next location inside the Box2d.
self & operator=(const self &o)
Assign a component_iterator2d_box.
Provides a class to manipulate 2d box.
const_component_iterator2d_box(MultiComponentContainer2D *c, std::size_t cp, const Box2d< int > &b)
Constructs a const_component_iterator2d_box.
int x2() const
Access to the second index of the current component_iterator2d_box.
component_iterator2d_box(MultiComponentContainer2D *c, std::size_t cp, const Box2d< int > &b)
Constructs a component_iterator2d_box.
int j() const
Access to the second index of the current component_iterator2d_box.
Provides a class to tag SLIP iterators.
self operator-(const difference_type &d)
component_iterator2d_box substraction.
int x1() const
Access to the first index of the current const_component_iterator2d_box.
MultiComponentContainer2D::const_component_col_iterator col_begin(size_type col) const
const_component_iterator2d_box element assignment operator.
self operator--(int)
Postdecrement a component_iterator2d_box. Iterate to the previous location inside the Box2d...
CoordType width() const
compute the width of the Box2d.
self & operator-=(const difference_type &d)
component_iterator2d_box substraction.
MultiComponentContainer2D::component_row_iterator row_end(size_type row)
component_iterator2d_box element assignment operator.
int i() const
Access to the first index of the current component_iterator2d_box.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
MultiComponentContainer2D::reverse_component_col_iterator col_rbegin(size_type col)
component_iterator2d_box col reverse iterator.
self operator--(int)
Postdecrement a const_component_iterator2d_box. Iterate to the previous location inside the Box2d...
void bottom_right(Point< CoordType, 2 >)
Accessor/Mutator of the bottom_right point (p2) of Box2d.
friend bool operator<(const self &i1, const self &i2)
< operator.
MultiComponentContainer2D::const_reverse_component_row_iterator row_rbegin(size_type row) const
component_iterator2d_box row reverse iterator.
std::random_access_iterator2d_tag iterator_category
self & operator-=(const difference_type &d)
const_component_iterator2d_box substraction.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
reference operator[](difference_type d)
component_iterator2d_box element assignment operator. Equivalent to *(i + d) = t. ...
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint2d.
MultiComponentContainer2D::size_type size_type
self & operator--()
Predecrement a const_component_iterator2d_box. Iterate to the previous location inside the Box2d...
This is some iterator to iterate a 2d MultiComponentContainer into a Box area defined by the indices ...
self & operator++()
Preincrement a const_component_iterator2d_box. Iterate to the next location inside the Box2d...
Block::value_type value_type
MultiComponentContainer2D::const_component_col_iterator col_end(size_type col) const
const_component_iterator2d_box element assignment operator.
int i() const
Access to the first index of the current const_component_iterator2d_box.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
self & operator+=(const difference_type &d)
component_iterator2d_box addition.
self operator+(const difference_type &d)
const_component_iterator2d_box addition.
size_type cp() const
Access to the component index of the current component_iterator2d_box.
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
MultiComponentContainer2D::value_type Block
const_component_iterator2d_box()
Constructs a const_component_iterator2d_box.
MultiComponentContainer2D::component_row_iterator row_begin(size_type row)
component_iterator2d_box element assignment operator.
MultiComponentContainer2D::reverse_component_row_iterator row_rbegin(size_type row)
component_iterator2d_box row reverse iterator.
MultiComponentContainer2D::component_col_iterator col_end(size_type col)
component_iterator2d_box element assignment operator.
component_iterator2d_box(const self &o)
Constructs a copy of the component_iterator2d_box o.
size_type cp() const
Access to the component index of the current const_component_iterator2d_box.
self operator+(const difference_type &d)
component_iterator2d_box addition.
std::random_access_iterator2d_tag iterator_category
MultiComponentContainer2D::component_col_iterator col_begin(size_type col)
component_iterator2d_box element assignment operator.
MultiComponentContainer2D::value_type Block
DPoint2d< int > difference_type
friend difference_type operator-(const self &i1, const self &i2)
component_iterator2d_box difference operator.
reference operator[](difference_type d) const
const_component_iterator2d_box element assignment operator. Equivalent to *(i + d) = t...
This is some iterator to iterate a 2d MultiComponentContainer into a Box area defined by the indices ...
friend difference_type operator-(const self &i1, const self &i2)
const_component_iterator2d_box difference operator.
void upper_left(Point< CoordType, 2 >)
Accessor/Mutator of the upper_left point (p1) of Box2d.
self operator++(int)
Postincrement a component_iterator2d_box. Iterate to the next location inside the Box2d...
component_iterator2d_box()
Constructs a component_iterator2d_box.
MultiComponentContainer2D::const_reverse_component_col_iterator col_rbegin(size_type col) const
component_iterator2d_box col reverse iterator.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
int x2() const
Access to the second index of the current const_component_iterator2d_box.
friend bool operator<(const self &i1, const self &i2)
< operator.
friend bool operator>(const self &i1, const self &i2)
operator.
MultiComponentContainer2D::const_reverse_component_row_iterator row_rend(size_type row) const
component_iterator2d_box row reverse iterator.
Provides a class to modelize 2d points.
reference operator*() const
Dereference assignment operator. Returns the element that the current const_component_iterator2d_box ...
self & operator=(const self &o)
Assign a const_component_iterator2d_box.
MultiComponentContainer2D::size_type size_type
friend bool operator>(const self &i1, const self &i2)
operator.
self operator++(int)
Postincrement a const_component_iterator2d_box. Iterate to the next location inside the Box2d...
value_type const & reference
int x1() const
Access to the first index of the current component_iterator2d_box.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
MultiComponentContainer2D::const_reverse_component_col_iterator col_rend(size_type col) const
component_iterator2d_box col reverse iterator.
reference operator*()
Dereference assignment operator. Returns the element that the current component_iterator2d_box i poin...
self & operator+=(const difference_type &d)
const_component_iterator2d_box addition.
friend bool operator<=(const self &i1, const self &i2)
<= operator.
Block::value_type value_type
int j() const
Access to the second index of the current const_component_iterator2d_box.
MultiComponentContainer2D::reverse_component_row_iterator row_rend(size_type row)
component_iterator2d_box row reverse iterator.
DPoint2d< int > difference_type