
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-10-05 Matthieu Garrigues <garrigues@lrde.epita.fr> Fix on accumulators. * mln/accu/min.hh, * mln/accu/p.hh: Fix. New hierachy on value types in order to factorise the traits declarations. Value ^ | --------------------------- | | | | Scalar Vectoriel Symbolic Structured ^ | -------- | | Integer Floating * mln/value/internal/floating.hh: New. * mln/value/internal/integer.hh: New. * mln/value/internal/scalar.hh: New. * mln/value/internal/structured.hh: New. * mln/value/internal/symbolic.hh: New. * mln/value/internal/value_like.hh, * mln/value/internal/vectoriel.hh: New. Update value types inheritance. * mln/value/float01_.hh, * mln/value/gray.hh, * mln/value/graylevel.hh, * mln/value/int_s.hh, * mln/value/int_u.hh, * mln/value/int_u_sat.hh, * mln/value/label.hh, * mln/value/quat.hh, * mln/value/rgb.hh: Update. --- accu/min.hh | 15 --------- accu/p.hh | 2 - value/float01_.hh | 4 +- value/gray.hh | 6 +-- value/graylevel.hh | 8 +++-- value/int_s.hh | 4 +- value/int_u.hh | 4 +- value/int_u_sat.hh | 8 +++-- value/internal/floating.hh | 64 +++++++++++++++++++++++++++++++++++++++++ value/internal/integer.hh | 64 +++++++++++++++++++++++++++++++++++++++++ value/internal/scalar.hh | 64 +++++++++++++++++++++++++++++++++++++++++ value/internal/structured.hh | 66 +++++++++++++++++++++++++++++++++++++++++++ value/internal/symbolic.hh | 66 +++++++++++++++++++++++++++++++++++++++++++ value/internal/value_like.hh | 2 - value/internal/vectoriel.hh | 66 +++++++++++++++++++++++++++++++++++++++++++ value/label.hh | 6 +++ value/quat.hh | 11 ++++++- value/rgb.hh | 4 +- 18 files changed, 430 insertions(+), 34 deletions(-) Index: trunk/milena/mln/accu/min.hh =================================================================== --- trunk/milena/mln/accu/min.hh (revision 1250) +++ trunk/milena/mln/accu/min.hh (revision 1251) @@ -86,21 +86,6 @@ -// // FIXME: Sample code. - -// template <typename T> -// struct p_min_ : public p_< min_<T> > -// { -// }; - -// struct p_min : public Meta_Accumulator< p_min > -// { -// template <typename T> -// struct with -// { -// typedef p_min_<T> ret; -// }; -// }; Index: trunk/milena/mln/accu/p.hh =================================================================== --- trunk/milena/mln/accu/p.hh (revision 1250) +++ trunk/milena/mln/accu/p.hh (revision 1251) @@ -53,7 +53,7 @@ template <typename A> struct p_ : public mln::accu::internal::base_< mln_result(A) , p_<A> > { - typedef mln_value(A) argument; + typedef mln_argument(A) argument; typedef mln_result(A) result; Index: trunk/milena/mln/value/int_u_sat.hh =================================================================== --- trunk/milena/mln/value/int_u_sat.hh (revision 1250) +++ trunk/milena/mln/value/int_u_sat.hh (revision 1251) @@ -36,6 +36,7 @@ # include <mln/metal/math.hh> # include <mln/value/internal/value_like.hh> +# include <mln/value/internal/integer.hh> # include <mln/value/internal/encoding.hh> # include <mln/value/props.hh> # include <mln/debug/format.hh> @@ -54,17 +55,18 @@ */ template <unsigned n> struct int_u_sat - : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, + : public internal::Integer< int_u_sat<n> >, + public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, int_u_sat<n> > { protected: typedef internal::value_like_< typename internal::encoding_unsigned_<n>::ret, - int_u_sat<n> > super; + int_u_sat<n> > like; public: /// Encoding associated type. - typedef typename super::enc enc; + typedef typename like::enc enc; /// Constructor without argument. int_u_sat(); Index: trunk/milena/mln/value/graylevel.hh =================================================================== --- trunk/milena/mln/value/graylevel.hh (revision 1250) +++ trunk/milena/mln/value/graylevel.hh (revision 1251) @@ -33,6 +33,7 @@ # include <mln/metal/math.hh> # include <mln/metal/bexpr.hh> # include <mln/value/internal/value_like.hh> +# include <mln/value/internal/integer.hh> # include <mln/value/internal/encoding.hh> # include <mln/value/gray.hh> # include <mln/value/props.hh> @@ -50,17 +51,18 @@ /// General gray-level class on n bits. template <unsigned n> class graylevel - : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, + : public internal::Integer< graylevel<n> >, + public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, graylevel<n> > { protected: typedef internal::value_like_< typename internal::encoding_unsigned_<n>::ret, - graylevel<n> > super; + graylevel<n> > like; public: /// Encoding associated type. - typedef typename super::enc enc; + typedef typename like::enc enc; /// Ctor. graylevel(); Index: trunk/milena/mln/value/gray.hh =================================================================== --- trunk/milena/mln/value/gray.hh (revision 1250) +++ trunk/milena/mln/value/gray.hh (revision 1251) @@ -30,9 +30,8 @@ # include <iostream> -# include <mln/core/concept/value.hh> # include <mln/value/graylevel.hh> - +# include <mln/value/internal/integer.hh> namespace mln @@ -47,7 +46,7 @@ /// General gray-level class where n bits is not know at compile-time. /// This class is used for exchange between gray-level types purpose. - class gray : public Value<gray> + class gray : public internal::Integer< gray > { public: @@ -142,7 +141,6 @@ template <unsigned N> gray operator/(const graylevel<N>& lhs, int s) { - std::cout << "div div " << s << std::endl; mln_precondition(s > 0); gray tmp(N, lhs.value() / s); return tmp; Index: trunk/milena/mln/value/float01_.hh =================================================================== --- trunk/milena/mln/value/float01_.hh (revision 1250) +++ trunk/milena/mln/value/float01_.hh (revision 1251) @@ -33,6 +33,7 @@ # include <mln/metal/math.hh> # include <mln/metal/bexpr.hh> # include <mln/value/internal/value_like.hh> +# include <mln/value/internal/floating.hh> # include <mln/value/internal/encoding.hh> # include <mln/value/float01.hh> # include <mln/value/props.hh> @@ -50,7 +51,8 @@ /// General float01-level class on n bits. template <unsigned n> class float01_ - : public internal::value_like_< float, + : public internal::Floating< float01_<n> >, + public internal::value_like_< float, float01_<n> > { public: Index: trunk/milena/mln/value/rgb.hh =================================================================== --- trunk/milena/mln/value/rgb.hh (revision 1250) +++ trunk/milena/mln/value/rgb.hh (revision 1251) @@ -34,7 +34,7 @@ * 8-bit encoded. */ -# include <mln/core/concept/value.hh> +# include <mln/value/internal/structured.hh> # include <mln/value/int_u8.hh> @@ -54,7 +54,7 @@ * 8-bit encoded. */ template <unsigned n> - struct rgb : public Value< rgb<n> > + struct rgb : public internal::Structured< rgb<n> > { public: Index: trunk/milena/mln/value/quat.hh =================================================================== --- trunk/milena/mln/value/quat.hh (revision 1250) +++ trunk/milena/mln/value/quat.hh (revision 1251) @@ -33,6 +33,7 @@ # include <mln/metal/vec.hh> # include <mln/norm/l2.hh> # include <mln/value/props.hh> +# include <mln/value/internal/vectoriel.hh> namespace mln { @@ -40,13 +41,21 @@ namespace value { - class quat : public metal::vec<4, float> + //FIXME doesn't compile + class quat :// public internal::Vectoriel< quat >, + public metal::vec<4, float> { typedef metal::vec<4, float> super_; using super_::data_; public: + /// Encoding associated type. + typedef float enc; + + /// Equivalent associated type. + typedef float equiv[4]; + // ctors quat(); Index: trunk/milena/mln/value/int_s.hh =================================================================== --- trunk/milena/mln/value/int_s.hh (revision 1250) +++ trunk/milena/mln/value/int_s.hh (revision 1251) @@ -35,6 +35,7 @@ # include <mln/metal/math.hh> # include <mln/value/internal/value_like.hh> +# include <mln/value/internal/integer.hh> # include <mln/value/internal/encoding.hh> # include <mln/value/props.hh> # include <mln/trait/all.hh> @@ -95,7 +96,8 @@ */ template <unsigned n> struct int_s - : public internal::value_like_< typename internal::encoding_signed_<n>::ret, + : public internal::Integer< int_s<n> >, + public internal::value_like_< typename internal::encoding_signed_<n>::ret, int_s<n> > { protected: Index: trunk/milena/mln/value/internal/symbolic.hh =================================================================== --- trunk/milena/mln/value/internal/symbolic.hh (revision 0) +++ trunk/milena/mln/value/internal/symbolic.hh (revision 1251) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_SYMBOLIC_HH +# define MLN_VALUE_SYMBOLIC_HH + +/*! \file mln/value/symbolic.hh + * + * \brief Define a generic class for symbolic values. + */ + +# include <mln/core/concept/value.hh> + +namespace mln +{ + + namespace trait + { + + // FIXME + + } // end of namespace mln::trait + + namespace value + { + + namespace internal + { + + template <typename E> + struct Symbolic : public Value<E> + { + }; + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_SYMBOLIC_HH Index: trunk/milena/mln/value/internal/floating.hh =================================================================== --- trunk/milena/mln/value/internal/floating.hh (revision 0) +++ trunk/milena/mln/value/internal/floating.hh (revision 1251) @@ -0,0 +1,64 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_FLOATING_HH +# define MLN_VALUE_FLOATING_HH + +/*! \file mln/value/floating.hh + * + * \brief Define a generic class for float values. + */ + +# include <mln/value/internal/scalar.hh> + +namespace mln +{ + + namespace trait + { + // FIXME + } // end of namespace mln::trait + + namespace value + { + + namespace internal + { + + template <typename E> + struct Floating : public Scalar<E> + { + }; + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_FLOATING_HH Index: trunk/milena/mln/value/internal/structured.hh =================================================================== --- trunk/milena/mln/value/internal/structured.hh (revision 0) +++ trunk/milena/mln/value/internal/structured.hh (revision 1251) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_STRUCTURED_HH +# define MLN_VALUE_STRUCTURED_HH + +/*! \file mln/value/structured.hh + * + * \brief Define a generic class for structured values. + */ + +# include <mln/core/concept/value.hh> + +namespace mln +{ + + namespace trait + { + // FIXME + } // end of namespace mln::trait + + namespace value + { + + + namespace internal + { + + template <typename E> + struct Structured : public Value<E> + { + }; + + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_STRUCTURED_HH Index: trunk/milena/mln/value/internal/scalar.hh =================================================================== --- trunk/milena/mln/value/internal/scalar.hh (revision 0) +++ trunk/milena/mln/value/internal/scalar.hh (revision 1251) @@ -0,0 +1,64 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_SCALAR_HH +# define MLN_VALUE_SCALAR_HH + +/*! \file mln/value/scalar.hh + * + * \brief Define a generic class for scalar values. + */ + +# include <mln/core/concept/value.hh> + +namespace mln +{ + + namespace trait + { + // FIXME + } // end of namespace mln::trait + + namespace value + { + + namespace internal + { + + template <typename E> + struct Scalar : public Value<E> + { + }; + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_SCALAR_HH Index: trunk/milena/mln/value/internal/vectoriel.hh =================================================================== --- trunk/milena/mln/value/internal/vectoriel.hh (revision 0) +++ trunk/milena/mln/value/internal/vectoriel.hh (revision 1251) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_VECTORIEL_HH +# define MLN_VALUE_VECTORIEL_HH + +/*! \file mln/value/vectoriel.hh + * + * \brief Define a generic class for vectoriel values. + */ + +# include <mln/core/concept/value.hh> + +namespace mln +{ + + namespace trait + { + + // FIXME + + } // end of namespace mln::trait + + namespace value + { + + namespace internal + { + + template <typename E> + struct Vectoriel : public Value<E> + { + }; + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_VECTORIEL_HH Index: trunk/milena/mln/value/internal/integer.hh =================================================================== --- trunk/milena/mln/value/internal/integer.hh (revision 0) +++ trunk/milena/mln/value/internal/integer.hh (revision 1251) @@ -0,0 +1,64 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// 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_VALUE_INTEGER_HH +# define MLN_VALUE_INTEGER_HH + +/*! \file mln/value/integer.hh + * + * \brief Define a generic class for integer values. + */ + +# include <mln/value/internal/scalar.hh> + +namespace mln +{ + + namespace trait + { + // FIXME + } // end of namespace mln::trait + + namespace value + { + + namespace internal + { + + template <typename E> + struct Integer : public Scalar<E> + { + }; + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_INTEGER_HH Index: trunk/milena/mln/value/internal/value_like.hh =================================================================== --- trunk/milena/mln/value/internal/value_like.hh (revision 1250) +++ trunk/milena/mln/value/internal/value_like.hh (revision 1251) @@ -56,7 +56,7 @@ * exact value type. */ template <typename V, typename E> - struct value_like_ : public Value<E> + struct value_like_ // FIXME :Remove -> : public Value<E> { /// Encoding associated type. typedef V enc; Index: trunk/milena/mln/value/int_u.hh =================================================================== --- trunk/milena/mln/value/int_u.hh (revision 1250) +++ trunk/milena/mln/value/int_u.hh (revision 1251) @@ -36,6 +36,7 @@ # include <mln/metal/math.hh> # include <mln/value/internal/value_like.hh> # include <mln/value/internal/encoding.hh> +# include <mln/value/internal/integer.hh> # include <mln/value/props.hh> # include <mln/trait/all.hh> # include <mln/debug/format.hh> @@ -92,7 +93,8 @@ */ template <unsigned n> struct int_u - : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, + : public internal::Integer< int_u<n> >, + public internal::value_like_< typename internal::encoding_unsigned_<n>::ret, int_u<n> > { protected: Index: trunk/milena/mln/value/label.hh =================================================================== --- trunk/milena/mln/value/label.hh (revision 1250) +++ trunk/milena/mln/value/label.hh (revision 1251) @@ -35,6 +35,7 @@ # include <mln/metal/math.hh> # include <mln/value/internal/value_like.hh> +# include <mln/value/internal/symbolic.hh> # include <mln/value/internal/encoding.hh> # include <mln/value/props.hh> @@ -52,13 +53,16 @@ * The parameter \c n is the number of encoding bits. */ template <unsigned n> - struct label + struct label : public internal::Symbolic< label<n> > { public: /// Encoding associated type. typedef typename internal::encoding_unsigned_<n>::ret enc; + /// Equivalent associated type. + typedef typename internal::encoding_unsigned_<n>::ret equiv; + /// Constructor without argument. label();