27 #ifndef MLN_CORE_CONCEPT_IMAGE_HH
28 # define MLN_CORE_CONCEPT_IMAGE_HH
34 # include <mln/core/concept/site_set.hh>
35 # include <mln/core/concept/mesh.hh>
37 # include <mln/core/trait/all.hh>
38 # include <mln/core/macros.hh>
39 # include <mln/core/site_set/box.hh>
41 # include <mln/trait/concrete.hh>
42 # include <mln/trait/images.hh>
44 # include <mln/metal/abort.hh>
45 # include <mln/metal/is_a.hh>
46 # include <mln/metal/equal.hh>
48 # include <mln/tag/init.hh>
56 template <
typename E>
struct Image;
57 template <
typename E>
struct Literal;
64 typedef Object<void> super;
130 template <
typename V,
unsigned S,
typename I>
140 # ifndef MLN_INCLUDE_ONLY
146 template <
typename values_browsing_trait,
typename E>
147 struct image_values_interface_check
149 static void run() { }
152 template <
typename E>
153 struct image_values_interface_check<
154 mln::trait::image::value_browsing::value_wise,
165 template <
typename E,
167 int check_init(
void (E::*)(A))
172 template <
typename E,
173 typename A1,
typename A2 >
174 int check_init(
void (E::*)(A1, A2))
179 template <
typename E,
180 typename A1,
typename A2,
typename A3 >
181 int check_init(
void (E::*)(A1, A2, A3))
189 template <
typename E>
190 template <
typename J>
193 Image<E>::operator=(
const J&)
199 mlc_abort(E)::check();
204 template <
typename E>
210 typedef mln_domain(E) domain_t;
211 typedef mln_site(E) site;
212 typedef mln_psite(E) psite;
214 typedef mln_piter(E) piter;
215 typedef mln_fwd_piter(E) fwd_piter;
216 typedef mln_bkd_piter(E) bkd_piter;
218 bool (E::*m1)(const psite& p) const = & E::has;
225 bool (E::*m3)() const = & E::is_valid;
228 typedef typename E::t_eligible_values_set t_eligible_values_set;
230 const t_eligible_values_set& (E::*m4)() const = & E::values_eligible;
233 typedef typename E::t_values_space t_values_space;
235 const t_values_space& (E::*m5)() const = & E::values_space;
240 typedef mln_value(E) value;
241 typedef mln_rvalue(E) rvalue;
242 typedef mln_lvalue(E) lvalue;
244 mlc_is_not_a(value, Literal)::check();
251 rvalue (E::*m6)(const psite& p) const = & E::operator();
253 lvalue (E::*m7)(const psite& p) = & E::operator();
256 const domain_t& (E::*m8)() const = & E::domain;
259 typedef typename E::skeleton skeleton;
263 internal::check_init(& E::init_);
266 internal::image_values_interface_check<mln_trait_image_value_browsing(E),
277 template <
typename V,
unsigned S,
typename I>
279 from_to_(
const V (&values)[S], Image<I>& to_)
281 mlc_bool(S != 0)::check();
282 mlc_converts_to(V, mln_value(I))::check();
283 typedef mln_site(I) P;
285 s = mlc_root(d, S)::value };
286 metal::bool_<(mlc_pow_int(s, d) == S)>::check();
289 mln_precondition(! to.is_valid());
291 box<P> b(all_to(0), all_to(s - 1));
293 mln_fwd_piter(box<P>) p(b);
303 # endif // ! MLN_INCLUDE_ONLY
308 # include <mln/core/routine/initialize.hh>
311 #endif // ! MLN_CORE_CONCEPT_IMAGE_HH