26 #ifndef MLN_CORE_SITE_SET_BOX_PITER_HH
27 # define MLN_CORE_SITE_SET_BOX_PITER_HH
33 # include <mln/core/internal/site_set_iterator_base.hh>
34 # include <mln/core/concept/box.hh>
35 # include <mln/core/site_set/box.hh>
48 class box_fwd_piter_ :
public internal::site_set_iterator_base< box<P>,
51 typedef box_fwd_piter_<P> self_;
52 typedef internal::site_set_iterator_base< box<P>, self_ > super_;
57 enum { dim = P::dim };
69 bool is_valid_()
const;
94 class box_bkd_piter_ :
public internal::site_set_iterator_base< box<P>,
97 typedef box_bkd_piter_<P> self_;
98 typedef internal::site_set_iterator_base< box<P>, self_ > super_;
103 enum { dim = P::dim };
112 box_bkd_piter_(
const box<P>& b);
115 bool is_valid_()
const;
134 # ifndef MLN_INCLUDE_ONLY
139 template <
typename P>
141 box_fwd_piter_<P>::box_fwd_piter_()
145 template <
typename P>
147 box_fwd_piter_<P>::box_fwd_piter_(
const mln::box<P>& b)
149 this->change_target(b);
152 template <
typename P>
155 box_fwd_piter_<P>::is_valid_()
const
157 return p_[0] != s_->pmax()[0] + 1;
160 template <
typename P>
163 box_fwd_piter_<P>::invalidate_()
165 p_[0] =
static_cast<def::coord>(s_->pmax()[0] + 1);
168 template <
typename P>
171 box_fwd_piter_<P>::start_()
176 template <
typename P>
179 box_fwd_piter_<P>::next_()
181 for (
int i = dim - 1; i >= 0; --i)
182 if (p_[i] != s_->pmax()[i])
189 p_[i] = s_->pmin()[i];
211 template <
typename P>
213 box_bkd_piter_<P>::box_bkd_piter_()
217 template <
typename P>
219 box_bkd_piter_<P>::box_bkd_piter_(
const box<P>& b)
221 this->change_target(b);
224 template <
typename P>
227 box_bkd_piter_<P>::is_valid_()
const
229 return p_[0] != s_->pmin()[0] - 1;
232 template <
typename P>
235 box_bkd_piter_<P>::invalidate_()
237 p_[0] = mln_coord(P)(s_->pmin()[0] - 1);
240 template <
typename P>
243 box_bkd_piter_<P>::start_()
248 template <
typename P>
251 box_bkd_piter_<P>::next_()
253 for (
int i = dim - 1; i >= 0; --i)
254 if (p_[i] == s_->pmin()[i])
255 p_[i] = s_->pmax()[i];
261 if (p_ == s_->pmax())
265 # endif // ! MLN_INCLUDE_ONLY
270 #endif // ! MLN_CORE_SITE_SET_BOX_PITER_HH