https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fetch accumulator properties from Fred's sandbox.
* mln/trait/accumulator: New directory.
* sandbox/fred/accuprops.cc: Copy to...
* mln/trait/accumulator/props.hh,
* mln/trait/accumulators.hh: ...these new files.
Rename entities to enforce consistency.
Remove leveling related code.
* mln/trait/accumulator/print.hh: New.
* mln/core/concept/accumulator.hh: Include props.
* tests/accu/max.cc: Upgrade file doc style.
mln/core/concept/accumulator.hh | 5
mln/trait/accumulator/print.hh | 92 ++++++++++
mln/trait/accumulator/props.hh | 338 +++++----------------------------------
mln/trait/accumulators.hh | 340 +++++-----------------------------------
tests/accu/max.cc | 12 -
5 files changed, 195 insertions(+), 592 deletions(-)
Index: mln/trait/accumulator/props.hh
--- mln/trait/accumulator/props.hh (revision 0)
+++ mln/trait/accumulator/props.hh (working copy)
@@ -1,331 +1,87 @@
-# include <iostream>
-# include <string>
-
-# include <mln/trait/undef.hh>
-# include <mln/trait/image/props.hh>
-# include <mln/trait/value_.hh>
-
-# include <mln/metal/bexpr.hh>
-# include <mln/metal/equal.hh>
-# include <mln/metal/if.hh>
-# include <mln/metal/is_const.hh>
-
-# include <mln/core/concept/image.hh>
-# include <mln/accu/all.hh>
-# include <mln/util/pix.hh>
-# include <mln/make/pix.hh>
-
-/// Shortcut to the accumulator property about untake method disponibility
-# define mln_trait_accu_has_untake(A) typename mln::trait::accu_< A >::has_untake
-
-/// Shortcut to the accumulator property about setvalue method disponibility
-# define mln_trait_accu_has_setvalue(A) typename mln::trait::accu_< A
>::has_setvalue
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TRAIT_ACCUMULATOR_PROPS_HH
+# define MLN_TRAIT_ACCUMULATOR_PROPS_HH
+
+/// \file mln/trait/accumulator/props.hh
+///
+/// Properties of accumulator classes.
-/// Shortcut to the accumulator property about stop method disponibility
-# define mln_trait_accu_has_stop(A) typename mln::trait::accu_< A >::has_stop
+# include <string>
-/// Shortcut to the accumulator property about behavior when pixel is given as take()
value
-/// Used for instance in mln::canvas::morpho::leveling
-# define mln_trait_accu_when_pix(A) typename mln::trait::accu_< A >::when_pix
-namespace mln {
+namespace mln
+{
- namespace trait {
+ namespace trait
+ {
- namespace accu {
+ namespace accumulator
+ {
- // Basic accumulators properties
+ // Basic accumulators properties.
struct has_untake
{
struct any { protected: any() {}; };
-
struct no : any { std::string name() const { return "has_untake::no"; }
};
-
struct yes : any { std::string name() const { return "has_untake::yes";
} };
};
struct has_stop
{
struct any { protected: any() {}; };
-
- struct no : any { std::string name() const { return "has_setvalue::no";
} };
-
+ struct no : any { std::string name() const { return "has_stop::no"; }
};
struct yes : any { std::string name() const { return "has_stop::yes"; }
};
};
- struct has_setvalue
+ struct has_set_value
{
struct any { protected: any() {}; };
-
- struct no : any { std::string name() const { return "has_setvalue::no";
} };
-
- struct yes : any { std::string name() const { return
"has_setvalue::yes"; } };
+ struct no : any { std::string name() const { return
"has_set_value::no"; } };
+ struct yes : any { std::string name() const { return
"has_set_value::yes"; } };
};
// Morphological accumulators properties
struct when_pix
{
struct any { protected: any() {}; };
-
struct use_v : any { std::string name() const { return
"when_pix::use_v"; } };
-
struct use_p : any { std::string name() const { return
"when_pix::use_p"; } };
-
struct use_pix : any { std::string name() const { return
"when_pix::use_pix"; } };
-
struct not_ok : any { std::string name() const { return
"when_pix::not_ok"; } };
};
- } // end of namespace mln::trait::accu
-
- template <typename A>
- struct undefined_accu_
- {
- // general
- typedef undef has_untake;
- typedef undef has_stop;
- typedef undef has_setvalue;
-
- // morpho
- typedef accu::when_pix::not_ok when_pix;
- // FIXME: should default be undef ?
- };
-
- template <typename A>
- struct accu_ : undefined_accu_<A>
- {
- };
-
- } // end of namespace mln::trait
-
- namespace canvas {
-
- namespace morpho {
-
- namespace impl {
-
- namespace generic {
-
- template <typename I, template <typename P> class A>
- inline
- void
- leveling(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- const I& ima = exact(input);
- A< util::pix<I> >& a = exact(acc);
-
- mln_piter(I) p(ima.domain());
-
- for_all(p)
- a.take(mln::make::pix(ima, p));
- }
-
- } // end of namespace mln::canvas::morpho::impl::generic
-
- // fast implementation (only on values from pixter)
- template <typename I, template <typename P> class A>
- inline
- void
- leveling_fastest(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- const I& ima = exact(input);
- A< util::pix<I> >& a = exact(acc);
-
- mln_pixter(const I) px(ima);
-
- for_all(px)
- a.take(px.val());
- }
-
- } // end of namespace mln::canvas::morpho::impl
-
- namespace internal {
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(metal::false_,
- const Image<I>& input,
- Accumulator<A>& acc)
- {
- impl::generic::leveling(input, acc);
- }
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(metal::true_,
- const Image<I>& input,
- Accumulator<A>& acc)
- {
- impl::leveling_fastest(input, acc);
- }
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(const Image<I>& input,
- Accumulator<A>& acc)
- {
- enum {
- test = mlc_equal(mln_trait_image_speed(I),
- trait::image::speed::fastest)::value
- &&
- mlc_equal(mln_trait_accu_when_pix(A),
- trait::accu::when_pix::use_v)::value
- };
- internal::leveling_dispatch(metal::bool_<test>(),
- input, acc);
- }
-
- } // end of namespace mln::canvas::morpho::internal
-
- // Facade.
- template <typename I, template <typename P> class A>
- inline
- void
- leveling(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- internal::leveling_dispatch(input, acc);
- }
-
- } // end of namespace mln::canvas::morpho
-
- } // end of namespace mln::canvas
-
- namespace morpho {
-
- namespace accu {
-
- namespace internal {
-
- template <typename V>
- struct sum_handling_pixels
- { typedef mln_sum(V) ret; };
-
- template <typename I>
- struct sum_handling_pixels< util::pix<I> >
- { typedef mln_sum(mln_value(I)) ret; };
-
- } // end of namespace mln::morpho::accu::internal
-
- template <typename T>
- /// Morphological (i.e. for pixel and pixel values) accumulator calculating mean.
- /// FIXME: is inclusion polyphormism really appliable ?
- struct mean : public mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
- public Accumulator< mean<T> >
- {
- typedef mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
- typedef typename super::result result;
-
- using super::operator result;
- using super::take;
-
- void take(const mean<T>& m);
- };
-
- template <typename I>
- struct mean< util::pix<I> > : public mean< mln_value(I) >,
- public Accumulator< mean< util::pix<I>
> >
- {
- typedef mean< mln_value(I) > super;
- typedef util::pix<I> argument;
- typedef typename super::result result;
-
- using super::operator result;
- using super::take;
-
- void take(const argument& t);
- void take(const mean< util::pix<I> >& m);
- };
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename T>
- inline
- void mean<T>::take(const mean<T>& m)
- {
- this->super::take(m);
- }
-
- template <typename I>
- inline
- void mean< util::pix<I> >::take(const mean< util::pix<I>
>::argument& t)
- {
- this->mean< mln_value(I) >::take(t.v());
- }
-
- template <typename I>
- inline
- void mean< util::pix<I> >::take(const mean< util::pix<I>
>& m)
- {
- this->super::take(m);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::morpho::accu
-
- } // end of namespace mln::morpho
-
- namespace trait {
-
- template <typename I>
- struct accu_< morpho::accu::mean< util::pix<I> > > :
- public undefined_accu_ < morpho::accu::mean< util::pix<I> > >
- {
- typedef accu::when_pix::use_v when_pix;
- };
+ } // end of namespace mln::trait::accumulator
} // end of namespace mln::trait
} // end of namespace mln
-# include <mln/accu/all.hh>
-# include <mln/core/image/image2d.hh>
-
-# include <mln/debug/iota.hh>
-# include <mln/debug/println.hh>
-# include <mln/core/var.hh>
-# include <mln/util/timer.hh>
-int main()
-{
- typedef mln::image2d<int> I;
-
- I ima(1000, 1000);
- mln::morpho::accu::mean< mln::util::pix<I> > acc;
-
- float elapsed;
- mln::util::timer chrono;
-
- mln::debug::iota(ima);
- std::cout << "50 mean of a 1000x1000 image2d<int>" <<
std::endl;
-
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::leveling(ima, acc);
- elapsed = chrono.stop();
-
- std::cout << "(auto) " << elapsed << "s : "
<< acc.to_result() << std::endl;
-
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::impl::generic::leveling(ima, acc);
- elapsed = chrono.stop();
-
- std::cout << "(generic) " << elapsed << "s : "
<< acc.to_result() << std::endl;
-
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::impl::leveling_fastest(ima, acc);
- elapsed = chrono.stop();
- std::cout << "(fast) " << elapsed << "s : "
<< acc.to_result() << std::endl;
-}
+#endif // ! MLN_TRAIT_ACCUMULATOR_PROPS_HH
Property changes on: mln/trait/accumulator/props.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/trait/accumulator/print.hh
--- mln/trait/accumulator/print.hh (revision 0)
+++ mln/trait/accumulator/print.hh (revision 0)
@@ -0,0 +1,92 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TRAIT_ACCUMULATOR_PRINT_HH
+# define MLN_TRAIT_ACCUMULATOR_PRINT_HH
+
+/// \file mln/trait/accumulator/print.hh
+///
+/// Print the collection of traits for an accumulator type.
+
+# include <iostream>
+# include <mln/trait/accumulators.hh>
+# include <mln/metal/is_a.hh>
+
+
+
+namespace mln
+{
+
+ // Forward declaration.
+ template <typename E> struct Accumulator;
+
+
+ namespace trait
+ {
+
+ namespace accumulator
+ {
+
+ template <typename A>
+ void print(std::ostream& ostr = std::cout);
+
+ template <typename A>
+ void print(const Accumulator<A>& ima, std::ostream& ostr =
std::cout);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename A>
+ inline
+ void print(std::ostream& ostr)
+ {
+ mlc_is_a(A, Accumulator)::check();
+ typedef mln::trait::accumulator_<A> the;
+ ostr << "{ "
+ << typename the::has_untake().name() << ", "
+ << typename the::has_stop().name() << ", "
+ << typename the::has_set_value().name() << ", "
+ << typename the::when_pix().name() << " }" <<
std::endl;
+ }
+
+ template <typename A>
+ inline
+ void print(const Accumulator<A>&, std::ostream& ostr)
+ {
+ print<A>(ostr);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::trait::accumulator
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_TRAIT_ACCUMULATOR_PRINT_HH
Index: mln/trait/accumulators.hh
--- mln/trait/accumulators.hh (revision 3329)
+++ mln/trait/accumulators.hh (working copy)
@@ -1,331 +1,83 @@
-# include <iostream>
-# include <string>
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TRAIT_ACCUMULATORS_HH
+# define MLN_TRAIT_ACCUMULATORS_HH
+
+/// \file mln/trait/accumulators.hh
+///
+/// Some base trait types for accumulators.
+# include <mln/trait/accumulator/props.hh>
# include <mln/trait/undef.hh>
-# include <mln/trait/image/props.hh>
-# include <mln/trait/value_.hh>
-# include <mln/metal/bexpr.hh>
-# include <mln/metal/equal.hh>
-# include <mln/metal/if.hh>
-# include <mln/metal/is_const.hh>
-
-# include <mln/core/concept/image.hh>
-# include <mln/accu/all.hh>
-# include <mln/util/pix.hh>
-# include <mln/make/pix.hh>
/// Shortcut to the accumulator property about untake method disponibility
-# define mln_trait_accu_has_untake(A) typename mln::trait::accu_< A >::has_untake
+# define mln_trait_accumulator_has_untake(A) typename mln::trait::accumulator_< A
>::has_untake
/// Shortcut to the accumulator property about setvalue method disponibility
-# define mln_trait_accu_has_setvalue(A) typename mln::trait::accu_< A
>::has_setvalue
+# define mln_trait_accumulator_has_setvalue(A) typename mln::trait::accumulator_< A
>::has_setvalue
/// Shortcut to the accumulator property about stop method disponibility
-# define mln_trait_accu_has_stop(A) typename mln::trait::accu_< A >::has_stop
+# define mln_trait_accumulator_has_stop(A) typename mln::trait::accumulator_< A
>::has_stop
/// Shortcut to the accumulator property about behavior when pixel is given as take()
value
/// Used for instance in mln::canvas::morpho::leveling
-# define mln_trait_accu_when_pix(A) typename mln::trait::accu_< A >::when_pix
+# define mln_trait_accumulator_when_pix(A) typename mln::trait::accumulator_< A
>::when_pix
-namespace mln {
- namespace trait {
- namespace accu {
-
- // Basic accumulators properties
-
- struct has_untake
+namespace mln
{
- struct any { protected: any() {}; };
-
- struct no : any { std::string name() const { return "has_untake::no"; }
};
- struct yes : any { std::string name() const { return "has_untake::yes";
} };
- };
-
- struct has_stop
+ namespace trait
{
- struct any { protected: any() {}; };
-
- struct no : any { std::string name() const { return "has_setvalue::no";
} };
-
- struct yes : any { std::string name() const { return "has_stop::yes"; }
};
- };
-
- struct has_setvalue
- {
- struct any { protected: any() {}; };
-
- struct no : any { std::string name() const { return "has_setvalue::no";
} };
-
- struct yes : any { std::string name() const { return
"has_setvalue::yes"; } };
- };
-
- // Morphological accumulators properties
- struct when_pix
- {
- struct any { protected: any() {}; };
-
- struct use_v : any { std::string name() const { return
"when_pix::use_v"; } };
-
- struct use_p : any { std::string name() const { return
"when_pix::use_p"; } };
-
- struct use_pix : any { std::string name() const { return
"when_pix::use_pix"; } };
-
- struct not_ok : any { std::string name() const { return
"when_pix::not_ok"; } };
- };
-
- } // end of namespace mln::trait::accu
template <typename A>
- struct undefined_accu_
+ struct undefined_accumulator_
{
- // general
typedef undef has_untake;
typedef undef has_stop;
- typedef undef has_setvalue;
-
- // morpho
- typedef accu::when_pix::not_ok when_pix;
- // FIXME: should default be undef ?
+ typedef undef has_set_value;
+ typedef accumulator::when_pix::not_ok when_pix;
};
template <typename A>
- struct accu_ : undefined_accu_<A>
- {
- };
-
- } // end of namespace mln::trait
-
- namespace canvas {
-
- namespace morpho {
-
- namespace impl {
-
- namespace generic {
-
- template <typename I, template <typename P> class A>
- inline
- void
- leveling(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- const I& ima = exact(input);
- A< util::pix<I> >& a = exact(acc);
-
- mln_piter(I) p(ima.domain());
-
- for_all(p)
- a.take(mln::make::pix(ima, p));
- }
-
- } // end of namespace mln::canvas::morpho::impl::generic
-
- // fast implementation (only on values from pixter)
- template <typename I, template <typename P> class A>
- inline
- void
- leveling_fastest(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- const I& ima = exact(input);
- A< util::pix<I> >& a = exact(acc);
-
- mln_pixter(const I) px(ima);
-
- for_all(px)
- a.take(px.val());
- }
-
- } // end of namespace mln::canvas::morpho::impl
-
- namespace internal {
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(metal::false_,
- const Image<I>& input,
- Accumulator<A>& acc)
- {
- impl::generic::leveling(input, acc);
- }
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(metal::true_,
- const Image<I>& input,
- Accumulator<A>& acc)
+ struct accumulator_ : undefined_accumulator_<A>
{
- impl::leveling_fastest(input, acc);
- }
-
- template <typename I, typename A>
- inline
- void
- leveling_dispatch(const Image<I>& input,
- Accumulator<A>& acc)
- {
- enum {
- test = mlc_equal(mln_trait_image_speed(I),
- trait::image::speed::fastest)::value
- &&
- mlc_equal(mln_trait_accu_when_pix(A),
- trait::accu::when_pix::use_v)::value
- };
- internal::leveling_dispatch(metal::bool_<test>(),
- input, acc);
- }
-
- } // end of namespace mln::canvas::morpho::internal
-
- // Facade.
- template <typename I, template <typename P> class A>
- inline
- void
- leveling(const Image<I>& input,
- Accumulator< A< util::pix<I> > >& acc)
- {
- internal::leveling_dispatch(input, acc);
- }
-
- } // end of namespace mln::canvas::morpho
-
- } // end of namespace mln::canvas
-
- namespace morpho {
-
- namespace accu {
-
- namespace internal {
-
- template <typename V>
- struct sum_handling_pixels
- { typedef mln_sum(V) ret; };
-
- template <typename I>
- struct sum_handling_pixels< util::pix<I> >
- { typedef mln_sum(mln_value(I)) ret; };
-
- } // end of namespace mln::morpho::accu::internal
-
- template <typename T>
- /// Morphological (i.e. for pixel and pixel values) accumulator calculating mean.
- /// FIXME: is inclusion polyphormism really appliable ?
- struct mean : public mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
- public Accumulator< mean<T> >
- {
- typedef mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
- typedef typename super::result result;
-
- using super::operator result;
- using super::take;
-
- void take(const mean<T>& m);
- };
-
- template <typename I>
- struct mean< util::pix<I> > : public mean< mln_value(I) >,
- public Accumulator< mean< util::pix<I>
> >
- {
- typedef mean< mln_value(I) > super;
- typedef util::pix<I> argument;
- typedef typename super::result result;
-
- using super::operator result;
- using super::take;
-
- void take(const argument& t);
- void take(const mean< util::pix<I> >& m);
};
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename T>
- inline
- void mean<T>::take(const mean<T>& m)
- {
- this->super::take(m);
- }
-
- template <typename I>
- inline
- void mean< util::pix<I> >::take(const mean< util::pix<I>
>::argument& t)
- {
- this->mean< mln_value(I) >::take(t.v());
- }
-
- template <typename I>
- inline
- void mean< util::pix<I> >::take(const mean< util::pix<I>
>& m)
- {
- this->super::take(m);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::morpho::accu
-
- } // end of namespace mln::morpho
-
- namespace trait {
-
- template <typename I>
- struct accu_< morpho::accu::mean< util::pix<I> > > :
- public undefined_accu_ < morpho::accu::mean< util::pix<I> > >
- {
- typedef accu::when_pix::use_v when_pix;
- };
} // end of namespace mln::trait
} // end of namespace mln
-# include <mln/accu/all.hh>
-# include <mln/core/image/image2d.hh>
-
-# include <mln/debug/iota.hh>
-# include <mln/debug/println.hh>
-# include <mln/core/var.hh>
-# include <mln/util/timer.hh>
-int main()
-{
- typedef mln::image2d<int> I;
-
- I ima(1000, 1000);
- mln::morpho::accu::mean< mln::util::pix<I> > acc;
-
- float elapsed;
- mln::util::timer chrono;
-
- mln::debug::iota(ima);
- std::cout << "50 mean of a 1000x1000 image2d<int>" <<
std::endl;
-
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::leveling(ima, acc);
- elapsed = chrono.stop();
-
- std::cout << "(auto) " << elapsed << "s : "
<< acc.to_result() << std::endl;
-
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::impl::generic::leveling(ima, acc);
- elapsed = chrono.stop();
- std::cout << "(generic) " << elapsed << "s : "
<< acc.to_result() << std::endl;
+# include <mln/trait/accumulator/print.hh>
- acc.init();
- chrono.start();
- for (int i = 0; i < 50; i++)
- mln::canvas::morpho::impl::leveling_fastest(ima, acc);
- elapsed = chrono.stop();
- std::cout << "(fast) " << elapsed << "s : "
<< acc.to_result() << std::endl;
-}
+#endif // ! MLN_TRAIT_ACCUMULATORS_HH
Property changes on: mln/trait/accumulators.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/core/concept/accumulator.hh
--- mln/core/concept/accumulator.hh (revision 3329)
+++ mln/core/concept/accumulator.hh (working copy)
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -36,6 +36,7 @@
# include <mln/core/concept/proxy.hh>
# include <mln/metal/fix_return.hh>
# include <mln/metal/const.hh>
+# include <mln/trait/accumulators.hh>
namespace mln
Index: tests/accu/max.cc
--- tests/accu/max.cc (revision 3329)
+++ tests/accu/max.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/accu/max.cc
- *
- * \brief Tests on mln::accu::max.
- */
+/// \file tests/accu/max.cc
+///
+/// Tests on mln::accu::max.
#include <mln/core/image/image2d.hh>
#include <mln/debug/iota.hh>
@@ -50,4 +50,6 @@
mln_assertion(level::compute(accu::meta::max(), ima) == 9);
accu::max<int> M;
mln_assertion(level::compute(M, ima) == 9);
+
+ // mln::trait::accumulator::print(M);
}