00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef MLN_DEBUG_IOTA_HH
00028 # define MLN_DEBUG_IOTA_HH
00029
00035 # include <mln/core/concept/image.hh>
00036
00037
00038 # include <mln/debug/iota.spe.hh>
00039
00040
00041 namespace mln
00042 {
00043
00044 namespace debug
00045 {
00046
00052 template <typename I>
00053 void iota(Image<I>& input, unsigned base_index);
00054
00055
00056 # ifndef MLN_INCLUDE_ONLY
00057
00058 namespace impl
00059 {
00060
00061 template <typename I>
00062 inline
00063 void
00064 iota(trait::image::speed::any, I& input, unsigned base_index)
00065 {
00066 unsigned i = base_index;
00067 mln_piter(I) p(input.domain());
00068 for_all(p)
00069 input(p) = ++i % mln_max(mln_value(I));
00070 }
00071
00072 }
00073
00074
00075
00076 template <typename I>
00077 inline
00078 void
00079 iota(Image<I>& input)
00080 {
00081 iota(input, 0);
00082 }
00083
00084
00085 template <typename I>
00086 inline
00087 void
00088 iota(Image<I>& input, unsigned base_index)
00089 {
00090 trace::entering("debug::iota");
00091 mln_precondition(exact(input).is_valid());
00092 impl::iota(mln_trait_image_speed(I)(), exact(input), base_index);
00093 trace::exiting("debug::iota");
00094 }
00095
00096
00097 # endif // ! MLN_INCLUDE_ONLY
00098
00099 }
00100
00101 }
00102
00103
00104 #endif // ! MLN_DEBUG_IOTA_HH