3201: Revamp fun::meta::*

* mln/fun/meta/blue.hh, * mln/fun/meta/green.hh, * mln/fun/meta/hue.hh, * mln/fun/meta/inty.hh, * mln/fun/meta/red.hh, * mln/fun/meta/sat.hh, * mln/fun/meta/to_enc.hh: Split declaration and implementation and improve code layout. --- milena/ChangeLog | 13 +++++++++ milena/mln/fun/meta/blue.hh | 56 +++++++++++++++++++++++++++++--------- milena/mln/fun/meta/green.hh | 56 +++++++++++++++++++++++++++++--------- milena/mln/fun/meta/hue.hh | 48 ++++++++++++++++++++++++++++----- milena/mln/fun/meta/inty.hh | 58 +++++++++++++++++++++++++++++----------- milena/mln/fun/meta/red.hh | 59 ++++++++++++++++++++++++++++++---------- milena/mln/fun/meta/sat.hh | 59 ++++++++++++++++++++++++++++++---------- milena/mln/fun/meta/to_enc.hh | 47 ++++++++++++++++++++++++-------- 8 files changed, 303 insertions(+), 93 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 69fa4f7..8ed026b 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,18 @@ 2009-01-23 Guillaume Lazzara <z@lrde.epita.fr> + Revamp fun::meta::* + + * mln/fun/meta/blue.hh, + * mln/fun/meta/green.hh, + * mln/fun/meta/hue.hh, + * mln/fun/meta/inty.hh, + * mln/fun/meta/red.hh, + * mln/fun/meta/sat.hh, + * mln/fun/meta/to_enc.hh: Split declaration and implementation and + improve code layout. + +2009-01-23 Guillaume Lazzara <z@lrde.epita.fr> + Fix tutorial ref files. * doc/tutorial/figures/tuto3_rw_image-1.ppm, diff --git a/milena/mln/fun/meta/blue.hh b/milena/mln/fun/meta/blue.hh index 4c5a64d..2a4f175 100644 --- a/milena/mln/fun/meta/blue.hh +++ b/milena/mln/fun/meta/blue.hh @@ -28,37 +28,65 @@ #ifndef MLN_FUN_META_BLUE_HH # define MLN_FUN_META_BLUE_HH +/// \file mln/fun/meta/blue.hh +/// +/// Meta function to retrieve/modify the blue component. + # include <mln/core/concept/meta_fun.hh> # include <mln/value/rgb.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class T> - struct blue : impl< blue<T> > { typedef T value; }; + struct blue : impl< blue<T> > + { + typedef T value; + }; + + } // end of namespace mln::meta - } template <unsigned n> - struct function< meta::blue< value::rgb<n> > > : public Function_v2w_w2v<function< meta::blue < value::rgb<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(); - } + result read(const value& c); typedef result& lresult; - lresult write(value& c) - { - return c.blue(); - } + lresult write(value& c); }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <unsigned n> + inline + typename function< meta::blue< value::rgb<n> > >::result + function< meta::blue< value::rgb<n> > >::read(const value& c) + { + return c.blue(); + } + + template <unsigned n> + inline + typename function< meta::blue< value::rgb<n> > >::lresult + function< meta::blue< value::rgb<n> > >::write(value& c) + { + return c.blue(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_BLUE_HH diff --git a/milena/mln/fun/meta/green.hh b/milena/mln/fun/meta/green.hh index 6cce043..14cf080 100644 --- a/milena/mln/fun/meta/green.hh +++ b/milena/mln/fun/meta/green.hh @@ -28,37 +28,65 @@ #ifndef MLN_FUN_META_GREEN_HH # define MLN_FUN_META_GREEN_HH +/// \file mln/fun/meta/green.hh +/// +/// Meta function to retrieve/modify the green component. + # include <mln/core/concept/meta_fun.hh> # include <mln/value/rgb.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class T> - struct green : impl< green<T> > { typedef T value; }; + struct green : impl< green<T> > + { + typedef T value; + }; + + } // end of namespace mln::meta - } template <unsigned n> - struct function< meta::green< value::rgb<n> > > : public Function_v2w_w2v<function< meta::green < value::rgb<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(); - } + result read(const value& c); typedef result& lresult; - lresult write(value& c) - { - return c.green(); - } + lresult write(value& c); }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <unsigned n> + inline + typename function< meta::green< value::rgb<n> > >::result + function< meta::green< value::rgb<n> > >::read(const value& c) + { + return c.green(); + } + + template <unsigned n> + inline + typename function< meta::green< value::rgb<n> > >::lresult + function< meta::green< value::rgb<n> > >::write(value& c) + { + return c.green(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_GREEN_HH diff --git a/milena/mln/fun/meta/hue.hh b/milena/mln/fun/meta/hue.hh index c7a2a9c..1d0ae28 100644 --- a/milena/mln/fun/meta/hue.hh +++ b/milena/mln/fun/meta/hue.hh @@ -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 @@ -28,20 +29,30 @@ #ifndef MLN_FUN_META_HUE_HH # define MLN_FUN_META_HUE_HH +/// \file mln/fun/meta/hue.hh +/// +/// Meta function to retrieve/modify the color hue. + # include <mln/value/hsi.hh> # include <mln/core/concept/meta_fun.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class H> - struct hue : impl< hue<H> > { typedef H value; }; + struct hue : impl< hue<H> > + { + typedef H value; + }; - } + } // end of namespace mln::meta template <class H, class S, class I> - struct function< meta::hue< value::hsi_<H, S, I> > > : public Function_v2w_w2v<function< meta::hue < value::hsi_<H, S, I> > > > + struct function< meta::hue< value::hsi_<H, S, I> > > + : public Function_v2w_w2v<function< meta::hue < value::hsi_<H, S, I> > > > { typedef value::hsi_<H, S, I> value; @@ -59,6 +70,29 @@ namespace mln { }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <class H, class S, class I> + inline + H + function< meta::hue< value::hsi_<H, S, I> > >::read(const value& h) + { + return h.hue(); + } + + template <class H, class S, class I> + inline + H& + function< meta::hue< value::hsi_<H, S, I> > >::write(value& h) + { + return h.hue(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_HUE_HH diff --git a/milena/mln/fun/meta/inty.hh b/milena/mln/fun/meta/inty.hh index a6b78e9..100641d 100644 --- a/milena/mln/fun/meta/inty.hh +++ b/milena/mln/fun/meta/inty.hh @@ -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 @@ -28,38 +29,63 @@ #ifndef MLN_FUN_META_INTY_HH # define MLN_FUN_META_INTY_HH +/// \file mln/fun/meta/infy.hh +/// +/// Meta function to retrieve/modify the color intensity. + # include <mln/value/hsi.hh> # include <mln/core/concept/meta_fun.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class H> - struct inty : impl< inty<H> > { typedef H value; }; + struct inty : impl< inty<H> > + { + typedef H value; + }; + + } // end of namespace mln::meta - } template <class H, class S, class I> - struct function< meta::inty< value::hsi_<H, S, I> > > : - public Function_v2w_w2v<function< meta::inty < value::hsi_<H, S, I> > > > + struct function< meta::inty< value::hsi_<H, S, I> > > + : public Function_v2w_w2v<function< meta::inty < value::hsi_<H, S, I> > > > { typedef value::hsi_<H, S, I> value; typedef H result; - H read(const value& h) - { - return h.inty(); - } + H read(const value& h); typedef H& lresult; - H& write(value& h) - { - return h.inty(); - } + H& write(value& h); }; -} +# ifndef MLN_INCLUDE_ONLY + + template <class H, class S, class I> + inline + H + function< meta::inty< value::hsi_<H, S, I> > >::read(const value& h) + { + return h.inty(); + } + + template <class H, class S, class I> + inline + H& + function< meta::inty< value::hsi_<H, S, I> > >::write(value& h) + { + return h.inty(); + } + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_INTY_HH diff --git a/milena/mln/fun/meta/red.hh b/milena/mln/fun/meta/red.hh index 1e3fcb4..2e97080 100644 --- a/milena/mln/fun/meta/red.hh +++ b/milena/mln/fun/meta/red.hh @@ -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 @@ -28,37 +29,65 @@ #ifndef MLN_FUN_META_RED_HH # define MLN_FUN_META_RED_HH +/// \file mln/fun/meta/red.hh +/// +/// Meta function to retrieve/modify the red component. + # include <mln/core/concept/meta_fun.hh> # include <mln/value/rgb.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class T> - struct red : impl< red<T> > { typedef T value; }; + struct red : impl< red<T> > + { + typedef T value; + }; + + } // end of namespace mln::meta - } template <unsigned n> - struct function< meta::red< value::rgb<n> > > : public Function_v2w_w2v<function< meta::red < value::rgb<n> > > > + struct function< meta::red< value::rgb<n> > > + : public Function_v2w_w2v<function< meta::red < value::rgb<n> > > > { typedef value::rgb<n> value; typedef typename value::red_t result; - result read(const value& c) - { - return c.red(); - } + result read(const value& c); typedef result& lresult; - lresult write(value& c) - { - return c.red(); - } + lresult write(value& c); }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <unsigned n> + inline + typename function< meta::red< value::rgb<n> > >::result + function< meta::red< value::rgb<n> > >::read(const value& c) + { + return c.red(); + } + + template <unsigned n> + inline + typename function< meta::red< value::rgb<n> > >::lresult + function< meta::red< value::rgb<n> > >::write(value& c) + { + return c.red(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_RED_HH diff --git a/milena/mln/fun/meta/sat.hh b/milena/mln/fun/meta/sat.hh index 9b8d1f4..bf4c74a 100644 --- a/milena/mln/fun/meta/sat.hh +++ b/milena/mln/fun/meta/sat.hh @@ -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 @@ -28,37 +29,65 @@ #ifndef MLN_FUN_META_SAT_HH # define MLN_FUN_META_SAT_HH +/// \file mln/fun/meta/sat.hh +/// +/// Meta function to retrieve/modify the color saturation. + # include <mln/value/hsi.hh> # include <mln/core/concept/meta_fun.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class H> - struct sat : impl< sat<H> > { typedef H value; }; + struct sat : impl< sat<H> > + { + typedef H value; + }; + + } // end of namespace mln::meta - } template <class H, class S, class I> - struct function< meta::sat< value::hsi_<H, S, I> > > : public Function_v2w_w2v<function< meta::sat < value::hsi_<H, S, I> > > > + struct function< meta::sat< value::hsi_<H, S, I> > > + : public Function_v2w_w2v<function< meta::sat < value::hsi_<H, S, I> > > > { typedef value::hsi_<H, S, I> value; typedef H result; - H read(const value& h) - { - return h.sat(); - } + H read(const value& h); typedef H& lresult; - H& write(value& h) - { - return h.sat(); - } + H& write(value& h); }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <class H, class S, class I> + inline + H + function< meta::sat< value::hsi_<H, S, I> > >::read(const value& h) + { + return h.sat(); + } + + template <class H, class S, class I> + inline + H& + function< meta::sat< value::hsi_<H, S, I> > >::write(value& h) + { + return h.sat(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_SAT_HH diff --git a/milena/mln/fun/meta/to_enc.hh b/milena/mln/fun/meta/to_enc.hh index 6180b4e..37299ff 100644 --- a/milena/mln/fun/meta/to_enc.hh +++ b/milena/mln/fun/meta/to_enc.hh @@ -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 @@ -28,30 +29,52 @@ #ifndef MLN_FUN_META_RED_HH # define MLN_FUN_META_RED_HH +/// \file mln/fun/meta/to_enc.hh +/// +/// FIXME: doc + # include <mln/core/concept/meta_fun.hh> -namespace mln { +namespace mln +{ - namespace meta { + namespace meta + { template <class T> - struct to_enc : impl< to_enc<T> > { typedef typename T::enc value; }; + struct to_enc : impl< to_enc<T> > + { + typedef typename T::enc value; + }; + + } // end of namespace mln::meta - } template <typename T> - struct function< meta::to_enc<T> > : public Function_v2v<function< meta::to_enc<T> > > + struct function< meta::to_enc<T> > + : public Function_v2v<function< meta::to_enc<T> > > { typedef typename T::enc value; - value read(const T& t) - { - return t.to_enc(); - } - + value read(const T& t); }; -} +# ifndef MLN_INCLUDE_ONLY + + + template <typename T> + inline + typename T::enc + function< meta::to_enc<T> >::read(const T& t) + { + return t.to_enc(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + +} // end of namespace mln #endif // MLN_FUN_META_RED_HH -- 1.5.6.5
participants (1)
-
Guillaume Lazzara