27 #ifndef MLN_CONVERT_IMPL_FROM_IMAGE_TO_SITE_SET_HH
28 # define MLN_CONVERT_IMPL_FROM_IMAGE_TO_SITE_SET_HH
39 # include <mln/core/site_set/p_run.hh>
40 # include <mln/core/site_set/p_array.hh>
41 # include <mln/metal/converts_to.hh>
49 template <
typename E>
struct Site_Set;
50 template <
typename E>
struct Image;
51 template <
typename E>
struct Gpoint;
60 template <
typename I,
typename S>
62 from_image_to_site_set(
const Image<I>& from, Site_Set<S>&
to);
66 # ifndef MLN_INCLUDE_ONLY
73 template <
typename I,
typename P,
typename S>
75 from_image_to_site_set(
const I& input,
const Gpoint<P>&,
79 mln_fwd_piter(I) p(input.domain());
84 while (p.is_valid() && input(p) ==
false)
88 mln_invariant(input(p) ==
true);
96 while (p.is_valid() && input(p) ==
true &&
98 cut_(p.to_site()) == cut_(q) && p.last_coord() == q.last_coord() + 1);
99 s.insert(p_run<P>(start, q));
104 template <
typename I,
typename P,
typename S>
106 from_image_to_site_set(
const I& input,
const Gpoint<P>&,
108 const std::pair< mln_value(I), p_run<P> >&)
111 mln_fwd_piter(I) p(input.domain());
117 mln_value(I) v = input(p);
125 while (p.is_valid() && input(p) == v &&
126 cut_(p.to_site()) == cut_(q) && p.last_coord() == q.last_coord() + 1);
127 s.insert(v, p_run<P>(start, q));
132 template <
typename I,
typename P,
typename S>
134 from_image_to_site_set(
const I& input,
const Gpoint<P>&,
136 const std::pair< mln_value(I), P >&)
139 mln_fwd_piter(I) p(input.domain());
141 s.insert(input(p), p);
145 template <typename I, typename S>
148 from_image_to_site_set(const Image<I>& from, Site_Set<S>&
to)
150 from_image_to_site_set(exact(from), mln_deduce(I, domain_t, element)(),
151 exact(to), mln_i_element(S)());
154 template <
typename I>
157 from_image_to_site_set(
const Image<I>& from_, p_array<mln_psite(I)>& to)
159 const I& from = exact(from_);
161 mln_piter(I) p(from.domain());
173 template <typename I, typename S>
176 from_image_to_site_set(const Image<I>& from, Site_Set<S>& to)
178 internal::from_image_to_site_set(exact(from), exact(to));
181 # endif // ! MLN_INCLUDE_ONLY
190 #endif // ! MLN_CONVERT_IMPL_FROM_IMAGE_TO_SITE_SET_HH