Commit 5717b0cf authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add an optional base index for debug::iota.

	* mln/debug/iota.hh,
	* mln/debug/iota.spe.hh: Here.
parent 6e51a343
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.
// 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
......
// 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)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment