27 #ifndef MLN_TRAIT_CH_VALUE_HH
28 # define MLN_TRAIT_CH_VALUE_HH
34 # include <mln/tag/skeleton.hh>
35 # include <mln/trait/image_from_grid.hh>
36 # include <mln/trait/ch_function_value.hh>
39 # define mln_ch_value(I, V) typename mln::trait::ch_value< I, V >::ret
40 # define mln_ch_value_(I, V) mln::trait::ch_value< I, V >::ret
48 namespace algebra {
template <
unsigned n,
typename T>
class vec; }
49 template <
typename G,
typename F>
class p_edges;
50 template <
typename G,
typename F>
class p_vertices;
51 template <
typename P,
typename V,
typename G>
class vertex_image;
52 template <
typename P,
typename V,
typename G>
class edge_image;
53 template <
typename I>
class labeled_image;
54 namespace pw {
template <
typename F,
typename S>
class image; }
62 template <
typename I,
typename V>
struct ch_value;
69 template <
typename I,
typename V>
struct ch_value_;
71 template <
typename I,
typename V>
72 struct ch_value_< tag::image_<I>, V >
74 typedef mln_ch_value(I, V) ret;
77 template < template <class> class M, typename T,
79 struct ch_value_< M< tag::value_<T> >, V >
84 template <
template <
class>
class M,
typename I,
86 struct ch_value_< M< tag::image_<I> >, V >
88 typedef M< mln_ch_value(I, V) > ret;
91 template <
template <
class,
class>
class M,
typename T,
typename I,
93 struct ch_value_< M< tag::value_<T>, tag::image_<I> >, V >
95 typedef mln_ch_value(I, V) ret;
98 template < template <class, class> class M, typename P, typename T,
100 struct ch_value_< M< tag::psite_<P>, tag::value_<T> >, V >
102 typedef M< P, V > ret;
105 template <
template <
class,
class>
class M,
typename I1,
typename I2,
107 struct ch_value_< M< tag::image_<I1>, tag::image_<I2> >, V >
109 typedef M< mln_ch_value(I1, V), mln_ch_value(I2, V) > ret;
112 template <
template <
class,
class>
class M,
typename I,
typename E,
114 struct ch_value_< M< tag::image_<I>, tag::ext_<E> >, V >
116 typedef M< mln_ch_value(I, V), E > ret;
121 template <
template <
unsigned,
class>
class M,
unsigned n,
typename I,
123 struct ch_value_< M< n, tag::image_<I> >, V >
134 typedef mln_ch_value(I, V) ret;
139 template < template <
unsigned, class, class> class M,
140 unsigned D, typename G, typename T, typename V >
141 struct ch_value_< M< D, tag::psite_<G>, tag::value_<T> >, V >
143 typedef M< D, G, V > ret;
147 template <
template <
class,
class>
class M,
typename I,
typename N,
149 struct ch_value_< M< tag::image_<I>, tag::neighb_<N> >, V >
151 typedef M < mln_ch_value(I, V), N > ret;
154 template <
template <
class,
class>
class M,
typename I,
typename S,
156 struct ch_value_< M< tag::image_<I>, tag::domain_<S> >, V >
158 typedef M< mln_ch_value(I, V), S > ret;
161 template <
template <
class,
class>
class M,
typename F,
typename S,
163 struct ch_value_< M< tag::function_<F>, tag::domain_<S> >, V >
166 typedef mln_deduce(S, site, grid) grid;
167 typedef typename image_from_grid< grid, V >::ret ret;
172 template < typename F,
173 typename G, typename FP,
175 struct ch_value_< pw::image< tag::function_<F>, tag::domain_<p_edges<G, FP> > >, V >
177 typedef pw::image< mln_ch_function_value(F, V), p_edges<G, FP> > ret;
181 template <
typename F,
182 typename G,
typename FP,
184 struct ch_value_< pw::image< tag::function_<F>, tag::domain_<p_vertices<G, FP> > >, V >
187 typedef pw::image< mln_ch_function_value(F, V), p_vertices<G, FP> > ret;
191 template <
typename P,
typename V1,
typename G,
typename V2>
197 typedef vertex_image< P, V2, G > ret;
201 template <
typename P,
typename V1,
typename G,
typename V2>
207 typedef edge_image< P, V2, G > ret;
211 template <
typename I,
typename V>
212 struct ch_value_< labeled_image< tag::image_<I> >,
215 typedef mln_ch_value(I,V) ret;
219 template < template <class, class> class M, typename T, typename S,
221 struct ch_value_< M< tag::value_<T>, tag::domain_<S> >, V >
224 typedef mln_deduce(S, site, grid) grid;
225 typedef typename image_from_grid< grid, V >::ret ret;
229 template < template <class, class> class M, typename I, typename F,
231 struct ch_value_< M< tag::image_<I>, tag::function_<F> >, V >
233 typedef M< mln_ch_value(I, V), F > ret;
239 template <
typename I,
typename V>
242 typedef typename I::skeleton skeleton;
243 typedef typename impl::ch_value_<skeleton, V>::ret ret;
251 #endif // ! MLN_TRAIT_CH_VALUE_HH