4360: mln/data/compute.hh: Add an overload with non const accumulators.

--- milena/ChangeLog | 5 +++++ milena/mln/data/compute.hh | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 24e679a..8ee6e28 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,10 @@ 2009-08-17 Guillaume Lazzara <lazzara@lrde.epita.fr> + * mln/data/compute.hh: Add an overload with non const + accumulators. + +2009-08-17 Guillaume Lazzara <lazzara@lrde.epita.fr> + * headers.mk: Regen. 2009-08-15 Thierry Geraud <thierry.geraud@lrde.epita.fr> diff --git a/milena/mln/data/compute.hh b/milena/mln/data/compute.hh index c0d87cc..6a234a9 100644 --- a/milena/mln/data/compute.hh +++ b/milena/mln/data/compute.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -42,6 +43,8 @@ namespace mln { /// Compute an accumulator onto the pixel values of the image \p input. + /// Be ware that the given accumulator won't be modified and won't + /// store any result. /// /// \param[in] a An accumulator. /// \param[in] input The input image. @@ -56,6 +59,19 @@ namespace mln /// Compute an accumulator onto the pixel values of the image \p input. /// + /// \param[in, out] a An accumulator. + /// \param[in] input The input image. + /// \return The accumulator result. + /// + /// It fully relies on data::update. + // + template <typename A, typename I> + mln_result(A) + compute(Accumulator<A>& a, const Image<I>& input); + + + /// Compute an accumulator onto the pixel values of the image \p input. + /// /// \param[in] a A meta-accumulator. /// \param[in] input The input image. /// \return The accumulator result. @@ -76,6 +92,16 @@ namespace mln mln_result(A) compute(const Accumulator<A>& a_, const Image<I>& input) { + A a; + return compute(a, input); + } + + + template <typename A, typename I> + inline + mln_result(A) + compute(Accumulator<A>& a_, const Image<I>& input) + { trace::entering("data::compute"); A a = exact(a_); @@ -88,6 +114,7 @@ namespace mln return a; } + template <typename A, typename I> inline mln_meta_accu_result(A, mln_value(I)) -- 1.5.6.5
participants (1)
-
Guillaume Lazzara