27 #ifndef MLN_CORE_DPOINTS_PIXTER_HH
28 # define MLN_CORE_DPOINTS_PIXTER_HH
40 # include <mln/core/concept/proxy.hh>
41 # include <mln/core/concept/pixel_iterator.hh>
42 # include <mln/core/internal/pixel_impl.hh>
43 # include <mln/metal/converts_to.hh>
59 :
public Pixel_Iterator< dpoints_fwd_pixter<I> >,
60 public internal::pixel_impl_< I, dpoints_fwd_pixter<I> >
62 typedef typename internal::pixel_impl_< I, dpoints_fwd_pixter<I> > super_;
72 template <
typename Dps,
typename Pref>
82 template <
typename Dps,
typename Pref>
107 template <
typename Dps>
108 void init_(
const Dps& dps);
116 std::vector<int> offset_;
118 typename std::vector<int>::const_iterator i_;
125 mln_qlf_value(I)** value_ref_;
127 const mln_psite(I)* p_ref_;
140 template <
typename I>
142 :
public Pixel_Iterator< dpoints_bkd_pixter<I> >,
143 public internal::pixel_impl_< I, dpoints_bkd_pixter<I> >
145 typedef typename internal::pixel_impl_< I, dpoints_bkd_pixter<I> > super_;
155 template <
typename Dps,
typename Pref>
165 template <
typename Dps,
typename Pref>
190 template <
typename Dps>
191 void init_(
const Dps& dps);
199 std::vector<int> offset_;
201 typename std::vector<int>::const_reverse_iterator i_;
208 mln_qlf_value(I)** value_ref_;
210 const mln_psite(I)* p_ref_;
216 #ifndef MLN_INCLUDE_ONLY
222 template <
typename I>
223 template <
typename Dps,
typename Pref>
230 mln_precondition(image.is_valid());
232 mlc_converts_to(Pref,
const mln_psite(I)&)::check();
233 p_ref_ = &
static_cast< const mln_psite(I)&
>(p_ref);
239 template <
typename I>
240 template <
typename Dps,
typename Pref>
244 : super_(internal::force_exact<Pref>(pxl_ref_).ima())
246 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
247 mln_precondition(pxl_ref.ima().is_valid());
250 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
254 template <
typename I>
259 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
261 return this->image_(*p_ref_);
266 template <
typename I>
267 template <
typename Dps>
272 for (
unsigned i = 0; i < dps.size(); ++i)
273 offset_.push_back(this->image_.delta_index(dps.dp(i)));
277 for (
unsigned i = dps.size() - 1; i > 0; --i)
278 offset_[i] -= offset_[i - 1];
282 template <
typename I>
290 this->value_ptr_ = & this->image_(*p_ref_) + *i_;
292 this->value_ptr_ = * value_ref_ + *i_;
296 template <
typename I>
301 i_ = offset_.begin();
305 template <
typename I>
312 this->value_ptr_ += *i_;
315 template <
typename I>
320 return i_ != offset_.end();
323 template <
typename I>
336 template <
typename I>
337 template <
typename Dps,
typename Pref>
344 mln_precondition(image.is_valid());
345 internal::get_adr(p_ref_, p_ref);
350 template <
typename I>
351 template <
typename Dps,
typename Pref>
355 : super_(internal::force_exact<Pref>(pxl_ref_).ima())
357 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
358 mln_precondition(pxl_ref.ima().is_valid());
361 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
365 template <
typename I>
370 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
372 return this->image_(*p_ref_);
377 template <
typename I>
378 template <
typename Dps>
383 for (
unsigned i = 0; i < dps.size(); ++i)
384 offset_.push_back(this->image_.delta_index(dps.dp(i)));
388 for (
unsigned i = 0; i < dps.size() - 1; ++i)
389 offset_[i] -= offset_[i + 1];
393 template <
typename I>
401 this->value_ptr_ = & this->image_(*p_ref_) + *i_;
403 this->value_ptr_ = * value_ref_ + *i_;
407 template <
typename I>
412 i_ = offset_.rbegin();
416 template <
typename I>
423 this->value_ptr_ += *i_;
426 template <
typename I>
431 return i_ != offset_.rend();
434 template <
typename I>
442 #endif // ! MLN_INCLUDE_ONLY
447 #endif // ! MLN_CORE_DPOINTS_PIXTER_HH