last-svn-commit-767-gc027c16 Add an optional base index for debug::iota.

* mln/debug/iota.hh, * mln/debug/iota.spe.hh: Here. --- milena/ChangeLog | 7 +++++++ milena/mln/debug/iota.hh | 22 +++++++++++++++++----- milena/mln/debug/iota.spe.hh | 9 +++++---- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 7a28158..e03d35c 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,10 @@ +2011-02-17 Guillaume Lazzara <z@lrde.epita.fr> + + Add an optional base index for debug::iota. + + * mln/debug/iota.hh, + * mln/debug/iota.spe.hh: Here. + 2011-01-27 Guillaume Lazzara <z@lrde.epita.fr> * tests/convert/to_qimage_nocopy.cc: Fix a warning. diff --git a/milena/mln/debug/iota.hh b/milena/mln/debug/iota.hh index cfc3ae9..3e569b9 100644 --- a/milena/mln/debug/iota.hh +++ b/milena/mln/debug/iota.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -49,7 +50,7 @@ namespace mln * assigned. */ template <typename I> - void iota(Image<I>& input); + void iota(Image<I>& input, unsigned base_index); # ifndef MLN_INCLUDE_ONLY @@ -60,9 +61,9 @@ namespace mln template <typename I> inline void - iota(trait::image::speed::any, I& input) + iota(trait::image::speed::any, I& input, unsigned base_index) { - unsigned i = 0; + unsigned i = base_index; mln_piter(I) p(input.domain()); for_all(p) input(p) = ++i % mln_max(mln_value(I)); @@ -71,17 +72,28 @@ namespace mln } // end of namespace mln::debug::impl + template <typename I> inline void iota(Image<I>& input) { + iota(input, 0); + } + + + template <typename I> + inline + void + iota(Image<I>& input, unsigned base_index) + { trace::entering("debug::iota"); mln_precondition(exact(input).is_valid()); - impl::iota(mln_trait_image_speed(I)(), exact(input)); + impl::iota(mln_trait_image_speed(I)(), exact(input), base_index); trace::exiting("debug::iota"); } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::debug diff --git a/milena/mln/debug/iota.spe.hh b/milena/mln/debug/iota.spe.hh index 9a22bca..37e17d9 100644 --- a/milena/mln/debug/iota.spe.hh +++ b/milena/mln/debug/iota.spe.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -48,16 +49,16 @@ namespace mln { template <typename I> - void iota(trait::image::speed::fastest, I& input); + void iota(trait::image::speed::fastest, I& input, unsigned base_index); # ifndef MLN_INCLUDE_ONLY template <typename I> inline void - iota(trait::image::speed::fastest, I& input) + iota(trait::image::speed::fastest, I& input, unsigned base_index) { - unsigned i = 0; + unsigned i = base_index; mln_pixter(I) p(input); for_all(p) p.val() = static_cast<mln_value(I)>(++i % mln_max(mln_value(I))); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara