3138: Add fun::meta::green and fun::meta::blue.

* mln/fun/meta/blue.hh, * mln/fun/meta/green.hh: add new meta functions to use with fun_image. * headers.mk: Add new headers to distribution. * tests/unit_test/Makefile.am, * tests/unit_test/mln_fun_meta_blue.cc, * tests/unit_test/mln_fun_meta_green.cc: Add new unit tests. --- milena/ChangeLog | 13 +++++ milena/headers.mk | 2 + milena/mln/fun/meta/blue.hh | 64 ++++++++++++++++++++++++++ milena/mln/fun/meta/green.hh | 64 ++++++++++++++++++++++++++ milena/tests/unit_test/Makefile.am | 4 ++ milena/tests/unit_test/mln_fun_meta_blue.cc | 11 ++++ milena/tests/unit_test/mln_fun_meta_green.cc | 11 ++++ 7 files changed, 169 insertions(+), 0 deletions(-) create mode 100644 milena/mln/fun/meta/blue.hh create mode 100644 milena/mln/fun/meta/green.hh create mode 100644 milena/tests/unit_test/mln_fun_meta_blue.cc create mode 100644 milena/tests/unit_test/mln_fun_meta_green.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index b2b7dd9..9472f63 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,18 @@ 2009-01-06 Guillaume Lazzara <z@lrde.epita.fr> + Add fun::meta::green and fun::meta::blue. + + * mln/fun/meta/blue.hh, + * mln/fun/meta/green.hh: Add new meta functions to use with fun_image. + + * headers.mk: Add new headers to distribution. + + * tests/unit_test/Makefile.am, + * tests/unit_test/mln_fun_meta_blue.cc, + * tests/unit_test/mln_fun_meta_green.cc: Add new unit tests. + +2009-01-06 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes. * mln/binarization/binarization.hh: remove a non-valid static test. diff --git a/milena/headers.mk b/milena/headers.mk index 3365173..fc78f90 100644 --- a/milena/headers.mk +++ b/milena/headers.mk @@ -239,7 +239,9 @@ mln/fun/x2x/rotation.hh \ mln/fun/x2x/essential.hh \ mln/fun/meta/red.hh \ mln/fun/meta/hue.hh \ +mln/fun/meta/green.hh \ mln/fun/meta/inty.hh \ +mln/fun/meta/blue.hh \ mln/fun/meta/sat.hh \ mln/fun/meta/to_enc.hh \ mln/fun/x2v/linear.hh \ diff --git a/milena/mln/fun/meta/blue.hh b/milena/mln/fun/meta/blue.hh new file mode 100644 index 0000000..4c5a64d --- /dev/null +++ b/milena/mln/fun/meta/blue.hh @@ -0,0 +1,64 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can blueistribute 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 coveblue by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be coveblue by the GNU General +// Public License. + +#ifndef MLN_FUN_META_BLUE_HH +# define MLN_FUN_META_BLUE_HH + +# include <mln/core/concept/meta_fun.hh> +# include <mln/value/rgb.hh> + +namespace mln { + + namespace meta { + + template <class T> + struct blue : impl< blue<T> > { typedef T value; }; + + } + + template <unsigned n> + struct function< meta::blue< value::rgb<n> > > : public Function_v2w_w2v<function< meta::blue < value::rgb<n> > > > + { + typedef value::rgb<n> value; + + typedef typename value::blue_t result; + result read(const value& c) + { + return c.blue(); + } + + typedef result& lresult; + lresult write(value& c) + { + return c.blue(); + } + }; + + +} + +#endif // MLN_FUN_META_BLUE_HH diff --git a/milena/mln/fun/meta/green.hh b/milena/mln/fun/meta/green.hh new file mode 100644 index 0000000..6cce043 --- /dev/null +++ b/milena/mln/fun/meta/green.hh @@ -0,0 +1,64 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can greenistribute 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 covegreen by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covegreen by the GNU General +// Public License. + +#ifndef MLN_FUN_META_GREEN_HH +# define MLN_FUN_META_GREEN_HH + +# include <mln/core/concept/meta_fun.hh> +# include <mln/value/rgb.hh> + +namespace mln { + + namespace meta { + + template <class T> + struct green : impl< green<T> > { typedef T value; }; + + } + + template <unsigned n> + struct function< meta::green< value::rgb<n> > > : public Function_v2w_w2v<function< meta::green < value::rgb<n> > > > + { + typedef value::rgb<n> value; + + typedef typename value::green_t result; + result read(const value& c) + { + return c.green(); + } + + typedef result& lresult; + lresult write(value& c) + { + return c.green(); + } + }; + + +} + +#endif // MLN_FUN_META_GREEN_HH diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am index 168c709..e055ee3 100644 --- a/milena/tests/unit_test/Makefile.am +++ b/milena/tests/unit_test/Makefile.am @@ -236,7 +236,9 @@ mln_fun_x2x_rotation \ mln_fun_x2x_essential \ mln_fun_meta_red \ mln_fun_meta_hue \ +mln_fun_meta_green \ mln_fun_meta_inty \ +mln_fun_meta_blue \ mln_fun_meta_sat \ mln_fun_meta_to_enc \ mln_fun_x2v_linear \ @@ -1244,7 +1246,9 @@ mln_fun_x2x_rotation_SOURCES = mln_fun_x2x_rotation.cc mln_fun_x2x_essential_SOURCES = mln_fun_x2x_essential.cc mln_fun_meta_red_SOURCES = mln_fun_meta_red.cc mln_fun_meta_hue_SOURCES = mln_fun_meta_hue.cc +mln_fun_meta_green_SOURCES = mln_fun_meta_green.cc mln_fun_meta_inty_SOURCES = mln_fun_meta_inty.cc +mln_fun_meta_blue_SOURCES = mln_fun_meta_blue.cc mln_fun_meta_sat_SOURCES = mln_fun_meta_sat.cc mln_fun_meta_to_enc_SOURCES = mln_fun_meta_to_enc.cc mln_fun_x2v_linear_SOURCES = mln_fun_x2v_linear.cc diff --git a/milena/tests/unit_test/mln_fun_meta_blue.cc b/milena/tests/unit_test/mln_fun_meta_blue.cc new file mode 100644 index 0000000..790ecc7 --- /dev/null +++ b/milena/tests/unit_test/mln_fun_meta_blue.cc @@ -0,0 +1,11 @@ +// Unit test for mln/fun/meta/blue.hh. +// Generated by ./build_unit_test.sh, do not modify. + +// Include the file twice, so we detect missing inclusion guards. +#include <mln/fun/meta/blue.hh> +#include <mln/fun/meta/blue.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_fun_meta_green.cc b/milena/tests/unit_test/mln_fun_meta_green.cc new file mode 100644 index 0000000..b302776 --- /dev/null +++ b/milena/tests/unit_test/mln_fun_meta_green.cc @@ -0,0 +1,11 @@ +// Unit test for mln/fun/meta/green.hh. +// Generated by ./build_unit_test.sh, do not modify. + +// Include the file twice, so we detect missing inclusion guards. +#include <mln/fun/meta/green.hh> +#include <mln/fun/meta/green.hh> + +int main() +{ + // Nothing. +} -- 1.5.6.5
participants (1)
-
Guillaume Lazzara