27 #ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
28 # define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
37 # include <mln/metal/bool.hh>
38 # include <mln/core/macros.hh>
39 # include <mln/core/trait/pixter.hh>
40 # include <mln/core/trait/qlf_value.hh>
41 # include <mln/core/internal/force_exact.hh>
54 template <
typename E,
typename B = metal::true_ >
70 offset_of_point(
const P&
p)
const;
78 struct image_fastest_< E, metal::
false_ >
84 # ifndef MLN_INCLUDE_ONLY
86 template <
typename E,
typename B>
88 image_fastest_<E,B>::image_fastest_()
90 typedef mln_site(E)
site;
91 typedef mln_psite(E)
psite;
92 typedef mln_delta(psite) dpsite;
95 typedef mln_fwd_pixter(E) fwd_pixter;
96 typedef mln_bkd_pixter(E) bkd_pixter;
98 int (E::*m1)(const dpsite&) const = & E::delta_offset;
100 site (E::*m2)(
unsigned) const = & E::point_at_offset;
102 unsigned (E::*m3)() const = & E::border;
105 typedef mln_value(E)
value;
107 mln_qlf_value(E)* (E::*m4)() = & E::buffer;
109 const value* (E::*m5)() const = & E::buffer;
112 typedef mln_rvalue(E) rvalue;
113 typedef mln_lvalue(E) lvalue;
115 rvalue (E::*m6)(
unsigned) const = & E::element;
117 lvalue (E::*m7)(
unsigned) = & E::element;
120 unsigned (E::*m8)() const = & E::nelements;
123 # if (defined(__GNUC__) && __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
124 unsigned (E::*m9)(
const psite&
p)
const = & E::offset_of_point;
131 template <
typename E,
typename B>
132 template <
typename P>
135 image_fastest_<E,B>::offset_of_point(
const P&
p)
const
137 const E* this_ = & internal::force_exact<E>(*this);
138 mln_precondition(this_->is_valid());
139 mln_precondition(this_->has(p));
141 unsigned i = & this_->operator()(
p) - this_->buffer();
142 mln_postcondition(p == this_->point_at_offset(i));
146 # endif // ! MLN_INCLUDE_ONLY
155 #endif // ! MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH