olena-2.0-186-g463e9a6 Add new v2v functions.

* mln/fun/v2v/ceil.hh, * mln/fun/v2v/floor.hh: New. --- milena/ChangeLog | 7 ++++++ milena/mln/fun/v2v/{abs.hh => ceil.hh} | 36 ++++++++++++++++++------------- milena/mln/fun/v2v/{abs.hh => floor.hh} | 35 ++++++++++++++++++------------ 3 files changed, 49 insertions(+), 29 deletions(-) copy milena/mln/fun/v2v/{abs.hh => ceil.hh} (76%) copy milena/mln/fun/v2v/{abs.hh => floor.hh} (75%) diff --git a/milena/ChangeLog b/milena/ChangeLog index d3e2f30..7a45b8b 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,12 @@ 2013-01-04 Guillaume Lazzara <z@lrde.epita.fr> + Add new v2v functions. + + * mln/fun/v2v/ceil.hh, + * mln/fun/v2v/floor.hh: New. + +2013-01-04 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes. * mln/border/get.hh: Add a new implementation for handling morphed diff --git a/milena/mln/fun/v2v/abs.hh b/milena/mln/fun/v2v/ceil.hh similarity index 76% copy from milena/mln/fun/v2v/abs.hh copy to milena/mln/fun/v2v/ceil.hh index c2b34b3..3d54a10 100644 --- a/milena/mln/fun/v2v/abs.hh +++ b/milena/mln/fun/v2v/ceil.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2007, 2009, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,17 +23,16 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_FUN_V2V_ABS_HH -# define MLN_FUN_V2V_ABS_HH +#ifndef MLN_FUN_V2V_CEIL_HH +# define MLN_FUN_V2V_CEIL_HH /*! \file * - * \brief FIXME. + * \brief Round up input value. */ # include <mln/core/concept/function.hh> -# include <mln/math/abs.hh> - +# include <cmath> namespace mln { @@ -45,15 +43,17 @@ namespace mln namespace v2v { - // FIXME: Doc! - template <typename V, typename R> - struct abs : public Function_v2v< abs<V,R> >, - private mlc_converts_to(R,V)::check_t + /// \brief Round up input value. + template <typename V, typename R = V> + struct ceil : public Function_v2v< ceil<V,R> > { + ceil(); + typedef R result; typedef V argument; - R operator()(const V& v) const; + + R operator()(const V& w) const; }; @@ -61,10 +61,16 @@ namespace mln template <typename V, typename R> inline + ceil<V,R>::ceil() + { + } + + template <typename V, typename R> + inline R - abs<V,R>::operator()(const V& v) const + ceil<V,R>::operator()(const V& v) const { - return R(mln::math::abs(v)); + return std::ceil(v); } # endif // ! MLN_INCLUDE_ONLY @@ -76,4 +82,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_FUN_V2V_ABS_HH +#endif // ! MLN_FUN_V2V_CEIL_HH diff --git a/milena/mln/fun/v2v/abs.hh b/milena/mln/fun/v2v/floor.hh similarity index 75% copy from milena/mln/fun/v2v/abs.hh copy to milena/mln/fun/v2v/floor.hh index c2b34b3..1bbdd5a 100644 --- a/milena/mln/fun/v2v/abs.hh +++ b/milena/mln/fun/v2v/floor.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2007, 2009, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,16 +23,16 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_FUN_V2V_ABS_HH -# define MLN_FUN_V2V_ABS_HH +#ifndef MLN_FUN_V2V_FLOOR_HH +# define MLN_FUN_V2V_FLOOR_HH /*! \file * - * \brief FIXME. + * \brief Round down input value. */ # include <mln/core/concept/function.hh> -# include <mln/math/abs.hh> +# include <cmath> namespace mln @@ -45,15 +44,17 @@ namespace mln namespace v2v { - // FIXME: Doc! - template <typename V, typename R> - struct abs : public Function_v2v< abs<V,R> >, - private mlc_converts_to(R,V)::check_t + /// \brief Round down input value. + template <typename V, typename R = V> + struct floor : public Function_v2v< floor<V,R> > { + floor(); + typedef R result; typedef V argument; - R operator()(const V& v) const; + + R operator()(const V& w) const; }; @@ -61,10 +62,16 @@ namespace mln template <typename V, typename R> inline + floor<V,R>::floor() + { + } + + template <typename V, typename R> + inline R - abs<V,R>::operator()(const V& v) const + floor<V,R>::operator()(const V& v) const { - return R(mln::math::abs(v)); + return std::floor(v); } # endif // ! MLN_INCLUDE_ONLY @@ -76,4 +83,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_FUN_V2V_ABS_HH +#endif // ! MLN_FUN_V2V_FLOOR_HH -- 1.7.2.5
participants (1)
-
Guillaume Lazzara