27 #ifndef MLN_PW_INTERNAL_IMAGE_BASE_HH
28 # define MLN_PW_INTERNAL_IMAGE_BASE_HH
34 # include <mln/core/internal/image_primary.hh>
35 # include <mln/core/routine/init.hh>
36 # include <mln/metal/unqualif.hh>
37 # include <mln/metal/not_equal.hh>
38 # include <mln/value/set.hh>
52 template <
typename F,
typename S,
typename E>
64 template <
typename F,
typename S,
typename E>
69 typedef typename F::mutable_result mutable_result;
70 typedef mlc_not_equal(mutable_result,
void) is_mutable;
74 typedef trait::image::category::primary
category;
75 typedef trait::image::speed::fast
speed;
76 typedef trait::image::size::regular
size;
79 typedef trait::image::vw_io::none
vw_io;
80 typedef trait::image::vw_set::none
vw_set;
86 trait::image::value_io::read_write,
87 trait::image::value_io::read_only)
value_io;
91 trait::image::
pw_io::read_write,
118 template <
typename F,
typename S,
typename E>
122 typedef typename F::mutable_result mutable_result;
123 typedef mlc_not_equal(mutable_result,
void) is_mutable;
136 typedef
mlc_if(is_mutable, mutable_result, mln_result(F)) lvalue;
142 const S& domain() const;
148 rvalue operator()(const mln_psite(S)&
p) const;
152 lvalue operator()(const mln_psite(S)&
p);
166 template <typename F, typename S, typename E>
167 void init_(tag::
function_t, F& f, const pw::internal::image_base<F,S,E>& model);
169 template <typename F1, typename F2, typename S, typename E>
170 void init_(tag::function_t, F1& f, const pw::internal::image_base<F2,S,E>& model);
173 # ifndef MLN_INCLUDE_ONLY
177 template <
typename F,
typename S,
typename E>
183 template <
typename F1,
typename F2,
typename S,
typename E>
196 template <
typename F,
typename S,
typename E>
198 image_base<F,S,E>::image_base()
202 template <
typename F,
typename S,
typename E>
206 this->data_ =
new mln::internal::data<E>(
exact(f),
exact(ps));
209 template <
typename F,
typename S,
typename E>
214 this->data_ =
new mln::internal::data<E>(
exact(f),
exact(ps));
217 template <
typename F,
typename S,
typename E>
220 image_base<F,S,E>::domain()
const
222 return this->data_->domain_;
225 template <
typename F,
typename S,
typename E>
228 image_base<F,S,E>:: function()
const
230 return this->data_->f_;
234 template <
typename F,
typename S,
typename E>
236 typename image_base<F,S,E>::rvalue
237 image_base<F,S,E>::operator()(
const mln_psite(S)& p)
const
239 mln_precondition(this->data_->domain_.has(p));
240 return this->data_->f_(p);
243 template <
typename F,
typename S,
typename E>
245 typename image_base<F,S,E>::lvalue
246 image_base<F,S,E>::operator()(
const mln_psite(S)& p)
248 mln_precondition(this->data_->domain_.has(p));
249 return this->data_->f_(p);
256 # endif // ! MLN_INCLUDE_ONLY
261 #endif // ! MLN_PW_INTERNAL_IMAGE_BASE_HH