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>
75 template <
typename Dps,
typename Pref>
85 template <
typename Dps,
typename Pref>
114 template <
typename Dps>
115 void init_(
const Dps& dps);
123 std::vector<int> offset_;
125 typename std::vector<int>::const_iterator i_;
132 mln_qlf_value(I)** value_ref_;
134 const mln_psite(I)* p_ref_;
153 template <
typename I>
168 template <
typename Dps,
typename Pref>
178 template <
typename Dps,
typename Pref>
208 template <
typename Dps>
209 void init_(
const Dps& dps);
217 std::vector<int> offset_;
219 typename std::vector<int>::const_reverse_iterator i_;
226 mln_qlf_value(I)** value_ref_;
228 const mln_psite(I)* p_ref_;
236 #ifndef MLN_INCLUDE_ONLY
242 template <
typename I>
243 template <
typename Dps,
typename Pref>
250 mln_precondition(image.is_valid());
252 mlc_converts_to(Pref,
const mln_psite(I)&)::check();
253 p_ref_ = &
static_cast< const mln_psite(I)&
>(p_ref);
259 template <
typename I>
260 template <
typename Dps,
typename Pref>
264 : super_(internal::force_exact<Pref>(pxl_ref_).ima())
266 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
267 mln_precondition(pxl_ref.ima().is_valid());
270 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
274 template <
typename I>
279 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
281 return this->image_(*p_ref_);
286 template <
typename I>
287 template <
typename Dps>
292 for (
unsigned i = 0; i < dps.size(); ++i)
293 offset_.push_back(this->image_.delta_offset(dps.dp(i)));
297 for (
unsigned i = dps.size() - 1; i > 0; --i)
298 offset_[i] -= offset_[i - 1];
302 template <
typename I>
310 this->value_ptr_ = & this->image_(*p_ref_) + *i_;
312 this->value_ptr_ = * value_ref_ + *i_;
316 template <
typename I>
321 i_ = offset_.begin();
325 template <
typename I>
332 this->value_ptr_ += *i_;
335 template <
typename I>
340 return i_ != offset_.end();
343 template <
typename I>
356 template <
typename I>
357 template <
typename Dps,
typename Pref>
364 mln_precondition(image.is_valid());
365 internal::get_adr(p_ref_, p_ref);
370 template <
typename I>
371 template <
typename Dps,
typename Pref>
375 : super_(internal::
force_exact<Pref>(pxl_ref_).ima())
377 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
378 mln_precondition(pxl_ref.ima().is_valid());
381 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
385 template <
typename I>
390 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
392 return this->image_(*p_ref_);
397 template <
typename I>
398 template <
typename Dps>
403 for (
unsigned i = 0; i < dps.size(); ++i)
404 offset_.push_back(this->image_.delta_offset(dps.dp(i)));
408 for (
unsigned i = 0; i < dps.size() - 1; ++i)
409 offset_[i] -= offset_[i + 1];
413 template <
typename I>
421 this->value_ptr_ = & this->image_(*p_ref_) + *i_;
423 this->value_ptr_ = * value_ref_ + *i_;
427 template <
typename I>
432 i_ = offset_.rbegin();
436 template <
typename I>
443 this->value_ptr_ += *i_;
446 template <
typename I>
451 return i_ != offset_.rend();
454 template <
typename I>
462 #endif // ! MLN_INCLUDE_ONLY
467 #endif // ! MLN_CORE_DPOINTS_PIXTER_HH