26 #ifndef MLN_CORE_INTERNAL_IMAGE_IDENTITY_HH
27 # define MLN_CORE_INTERNAL_IMAGE_IDENTITY_HH
36 # include <mln/core/internal/image_morpher.hh>
48 template <
typename trait_speed,
typename I,
typename E>
49 struct image_identity_impl__fastest
54 template <
typename I,
typename E>
55 struct image_identity_impl__fastest< mln::trait::image::speed::fastest, I, E >
59 mlc_const(I)& del_()
const
61 return * internal::force_exact<const E>(*this).delegatee_();
66 return * internal::force_exact<E>(*this).delegatee_();
71 int delta_index(
const mln_deduce(I, psite, delta)& dp)
const
73 return del_().delta_index(dp);
76 mln_site(I) point_at_index(
unsigned i)
const
78 return del_().point_at_index(i);
81 unsigned border()
const
83 return del_().border();
86 mln_qlf_value(I)* buffer()
88 return del_().buffer();
91 const mln_value(I)* buffer()
const
93 return del_().buffer();
96 mln_rvalue(I) element(
unsigned i)
const
98 return del_().element(i);
101 mln_lvalue(I) element(
unsigned i)
103 return del_().element(i);
106 unsigned nelements()
const
108 return del_().nelements();
114 template <
typename I,
typename E>
115 struct image_identity_impl
116 : image_identity_impl__fastest< mln_trait_image_speed(E), I, E >
126 template <
typename I,
typename S,
typename E>
128 :
public image_identity_impl<I, E>,
129 public image_morpher<I, mln_value(I), S, E>
134 typedef mln_value(I) value;
137 typedef mln_rvalue(I) rvalue;
140 typedef mln_morpher_lvalue(I) lvalue;
143 rvalue operator()(const mln_psite(S)& p) const;
146 lvalue operator()(const mln_psite(S)& p);
149 const mln_domain(I)& domain() const;
150 bool has(const mln_psite(I)& p) const;
160 # ifndef MLN_INCLUDE_ONLY
162 template <
typename I,
typename S,
typename E>
164 image_identity<I, S, E>::image_identity()
168 template <
typename I,
typename S,
typename E>
171 image_identity<I, S, E>::operator()(const mln_psite(S)& p)
const
173 mln_precondition(this->delegatee_() != 0);
174 return this->delegatee_()->operator()(p);
177 template <
typename I,
typename S,
typename E>
179 typename image_identity<I, S, E>::lvalue
180 image_identity<I, S, E>::operator()(
const mln_psite(S)& p)
182 mln_precondition(this->delegatee_() != 0);
183 return this->delegatee_()->operator()(p);
186 template <
typename I,
typename S,
typename E>
189 image_identity<I, S, E>::domain()
const
191 mln_precondition(this->delegatee_() != 0);
192 return this->delegatee_()->domain();
195 template <
typename I,
typename S,
typename E>
198 image_identity<I, S, E>::has(
const mln_psite(I)& p)
const
200 mln_precondition(this->delegatee_() != 0);
201 return this->delegatee_()->has(p);
204 # endif // ! MLN_INCLUDE_ONLY
211 #endif // ! MLN_CORE_INTERNAL_IMAGE_IDENTITY_HH