26 #ifndef MLN_CORE_BOX_RUNEND_PITER_HH
27 # define MLN_CORE_BOX_RUNEND_PITER_HH
33 # include <mln/core/internal/site_iterator_base.hh>
34 # include <mln/core/site_set/box.hh>
37 #define mln_box_runend_piter(I) typename mln::box_runend_piter<mln_psite(I)>
38 #define mln_box_runend_piter_(I) mln::box_runend_piter<mln_psite_(I)>
50 public internal::site_set_iterator_base< box<P>,
54 typedef internal::site_set_iterator_base< box<P>,
self_ > super_;
58 enum { dim = super_::dim };
67 void init_(
const box<P>& b);
72 bool is_valid_()
const;
92 # ifndef MLN_INCLUDE_ONLY
103 template <
typename P>
105 box_runend_piter<P>::box_runend_piter(
const box<P>& b)
110 template <
typename P>
113 box_runend_piter<P>::init_(
const box<P>& b)
115 this->change_target(b);
119 template <
typename P>
122 box_runend_piter<P>::is_valid_()
const
124 return p_[0] !=
static_cast<mln_coord(P)
>(s_->pmin()[0] - 1);
127 template <
typename P>
130 box_runend_piter<P>::invalidate_()
132 p_[0] =
static_cast<mln_coord(P)
>(s_->pmin()[0] - 1);
135 template <
typename P>
138 box_runend_piter<P>::start_()
143 template <
typename P>
146 box_runend_piter<P>::next_()
149 for (
int c = dim - 2; c >= 0; --c)
151 if (p_[c] != s_->pmin()[c])
157 p_[c] = s_->pmax()[c];
160 if (p_ == s_->pmax())
164 template <
typename P>
169 return s_->len(dim - 1);
173 # endif // ! MLN_INCLUDE_ONLY
178 #endif // ! MLN_CORE_BOX_RUNEND_PITER_HH