
* doc/examples/Makefile.am: Fix invalid source filename. * mln/fun/from_accu.hh: Fix guard. * mln/linear/gaussian_directional_2d.hh: Fix a warning. * tests/accu/pair.cc: revamp header. --- milena/ChangeLog | 14 ++++- milena/doc/examples/Makefile.am | 4 +- milena/mln/fun/from_accu.hh | 83 ++++++++++++++++++++++---- milena/mln/linear/gaussian_directional_2d.hh | 2 +- milena/tests/accu/pair.cc | 5 +- 5 files changed, 91 insertions(+), 17 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index e205a6c..1881b78 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,15 @@ +2009-09-25 Guillaume Lazzara <lazzara@lrde.epita.fr> + + Small fixes. + + * doc/examples/Makefile.am: Fix invalid source filename. + + * mln/fun/from_accu.hh: Fix guard. + + * mln/linear/gaussian_directional_2d.hh: Fix a warning. + + * tests/accu/pair.cc: revamp header. + 2009-09-24 Fabien Freling <fabien.freling@lrde.epita.fr> Add correct reference for HSL to RGB conversion. @@ -324,7 +336,7 @@ Fix ISO C++ compilation problem : L101. * mln/io/plot/load.hh (load) : Update source file. - + 2009-09-14 Fabien Freling <fabien.freling@lrde.epita.fr> Disable tiled2d image support (still experimental). diff --git a/milena/doc/examples/Makefile.am b/milena/doc/examples/Makefile.am index 843c6b3..e6c3cd6 100644 --- a/milena/doc/examples/Makefile.am +++ b/milena/doc/examples/Makefile.am @@ -33,7 +33,7 @@ EXTRA_PROGRAMS = \ fill-part-image \ fill-subdomain \ fill-subdomain-shorter \ - fill-subimage-cfun \ + fill-imageif-cfun \ first_routine \ forall-piter \ fun-p2v-1 \ @@ -94,7 +94,7 @@ fill_call_1_SOURCES = fill-call-1.cc fill_part_image_SOURCES = fill-part-image.cc fill_subdomain_SOURCES = fill-subdomain.cc fill_subdomain_shorter_SOURCES = fill-subdomain-shorter.cc -fill_subimage_cfun_SOURCES = fill-subimage-cfun.cc +fill_imageif_cfun_SOURCES = fill-imageif-cfun.cc first_routine_SOURCES = tuto3/first_routine.cc forall_piter_SOURCES = forall-piter.cc fun_p2v_1_SOURCES = fun-p2v-1.cc diff --git a/milena/mln/fun/from_accu.hh b/milena/mln/fun/from_accu.hh index 9228a30..f01a93d 100644 --- a/milena/mln/fun/from_accu.hh +++ b/milena/mln/fun/from_accu.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. // @@ -23,24 +24,32 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file +/// +/// Wrap an accumulator into a function. + + #ifndef MLN_FUN_FROM_ACCU_HH # define MLN_FUN_FROM_ACCU_HH # include <mln/fun/unary_param.hh> # include <mln/core/concept/accumulator.hh> + namespace mln { - // from_accu: wrap an accumulator into a function namespace fun { + + /*! \brief Wrap an accumulator into a function. + */ template <typename A> struct from_accu : unary_param<from_accu<A>, A*> { - from_accu() : unary_param<from_accu<A>, A*>() {}; - from_accu(A* a) : unary_param<from_accu<A>, A*>(a) {}; + from_accu(); + from_accu(A* a); }; } // end of namespace mln::fun @@ -58,20 +67,70 @@ namespace mln typedef typename A::argument argument; typedef A* param_t; - static inline - result read(const param_t& accu_, const argument& x) - { - mln_precondition(accu_ != 0); + static result read(const param_t& accu_, const argument& x); - accu_->take(x); - return accu_->to_result (); - } }; } // end of namespace mln::trait::next } // end of namespace mln::trait + + +# ifndef MLN_INCLUDE_ONLY + + + namespace fun + { + + template <typename A> + inline + from_accu<A>::from_accu() + : unary_param<from_accu<A>, A*>() + { + + } + + + template <typename A> + inline + from_accu<A>::from_accu(A* a) + : unary_param<from_accu<A>, A*>(a) + { + + } + + } // end of namespace mln::fun + + + + namespace trait + { + + namespace next + { + + template <typename A, typename T> + inline + typename set_unary_<mln::fun::from_accu<A>, mln::Object, T>::result + set_unary_<mln::fun::from_accu<A>, + mln::Object, T>::read(const param_t& accu_, + const argument& x) + { + mln_precondition(accu_ != 0); + + accu_->take(x); + return accu_->to_result (); + } + + } // end of namespace mln::trait::next + + } // end of namespace mln::trait + + + +# endif // ! MLN_INCLUDE_ONLY + } // end of namespace mln -#endif /* ! MLN_FUN_FROM_ACCU_HH */ +#endif // ! MLN_FUN_FROM_ACCU_HH diff --git a/milena/mln/linear/gaussian_directional_2d.hh b/milena/mln/linear/gaussian_directional_2d.hh index 37a8449..bda0eda 100644 --- a/milena/mln/linear/gaussian_directional_2d.hh +++ b/milena/mln/linear/gaussian_directional_2d.hh @@ -453,7 +453,7 @@ namespace mln o_current = o_start; for (int i = 0; i < len; ++i) { - ima.element(o_current) = (tmp1[i] + tmp2[i]); + ima.element(o_current) = static_cast<mln_value(I)>(tmp1[i] + tmp2[i]); o_current += delta_offset; } } diff --git a/milena/tests/accu/pair.cc b/milena/tests/accu/pair.cc index 83667da..de03b7d 100644 --- a/milena/tests/accu/pair.cc +++ b/milena/tests/accu/pair.cc @@ -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. // @@ -23,6 +24,8 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file + #include <mln/core/image/image2d.hh> #include <mln/value/int_u8.hh> -- 1.5.6.5