26 #ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
27 # define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
36 # include <mln/metal/bool.hh>
37 # include <mln/core/macros.hh>
38 # include <mln/core/trait/pixter.hh>
39 # include <mln/core/trait/qlf_value.hh>
40 # include <mln/core/internal/force_exact.hh>
53 template <
typename E,
typename B = metal::true_ >
68 index_of_point(
const P& p)
const;
76 struct image_fastest_< E, metal::false_ >
82 # ifndef MLN_INCLUDE_ONLY
84 template <
typename E,
typename B>
86 image_fastest_<E,B>::image_fastest_()
88 typedef mln_site(E) site;
89 typedef mln_psite(E) psite;
90 typedef mln_delta(psite) dpsite;
93 typedef mln_fwd_pixter(E) fwd_pixter;
94 typedef mln_bkd_pixter(E) bkd_pixter;
96 int (E::*m1)(const dpsite&) const = & E::delta_index;
98 site (E::*m2)(
unsigned) const = & E::point_at_index;
100 unsigned (E::*m3)() const = & E::border;
103 typedef mln_value(E) value;
105 mln_qlf_value(E)* (E::*m4)() = & E::buffer;
107 const value* (E::*m5)() const = & E::buffer;
110 typedef mln_rvalue(E) rvalue;
111 typedef mln_lvalue(E) lvalue;
113 rvalue (E::*m6)(
unsigned) const = & E::element;
115 lvalue (E::*m7)(
unsigned) = & E::element;
118 unsigned (E::*m8)() const = & E::nelements;
121 # if (defined(__GNUC__) && __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
122 unsigned (E::*m9)(
const psite& p)
const = & E::index_of_point;
129 template <
typename E,
typename B>
130 template <
typename P>
133 image_fastest_<E,B>::index_of_point(
const P& p)
const
135 const E* this_ = & internal::force_exact<E>(*this);
136 mln_precondition(this_->is_valid());
137 mln_precondition(this_->has(p));
139 unsigned i = & this_->operator()(p) - this_->buffer();
140 mln_postcondition(p == this_->point_at_index(i));
144 # endif // ! MLN_INCLUDE_ONLY
153 #endif // ! MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH