milena r1253: Add categories for value types

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-10-05 Matthieu Garrigues <garrigues@lrde.epita.fr> Add categories for value types. * mln/value/builtin.hh: Remove tests. * mln/value/concept/floating.hh, * mln/value/concept/integer.hh, * mln/value/concept/scalar.hh, * mln/value/concept/structured.hh, * mln/value/concept/symbolic.hh, * mln/value/concept/vectorial.hh: Add categories for each of these types (in namespace value). --- builtin.hh | 46 +++++++++++----------------------------------- concept/floating.hh | 10 ++++++++++ concept/integer.hh | 11 ++++++++++- concept/scalar.hh | 13 +++++++++++++ concept/structured.hh | 14 ++++++++++++++ concept/symbolic.hh | 13 +++++++++++++ concept/vectorial.hh | 13 +++++++++++++ 7 files changed, 84 insertions(+), 36 deletions(-) Index: trunk/milena/mln/value/concept/symbolic.hh =================================================================== --- trunk/milena/mln/value/concept/symbolic.hh (revision 1252) +++ trunk/milena/mln/value/concept/symbolic.hh (revision 1253) @@ -38,6 +38,9 @@ namespace mln { + // Fwd decl. + template <typename E> struct Value; + namespace trait { @@ -48,6 +51,16 @@ namespace value { + // Fwd decl. + template <typename E> struct Symbolic; + + // Category flag type. + template <> + struct Symbolic<void> + { + typedef Value<void> super; + }; + template <typename E> struct Symbolic : public Value<E> { Index: trunk/milena/mln/value/concept/floating.hh =================================================================== --- trunk/milena/mln/value/concept/floating.hh (revision 1252) +++ trunk/milena/mln/value/concept/floating.hh (revision 1253) @@ -46,6 +46,16 @@ namespace value { + // Fwd decl. + template <typename E> struct Floating; + + // Category flag type. + template <> + struct Floating<void> + { + typedef Scalar<void> super; + }; + template <typename E> struct Floating : public Scalar<E> { Index: trunk/milena/mln/value/concept/structured.hh =================================================================== --- trunk/milena/mln/value/concept/structured.hh (revision 1252) +++ trunk/milena/mln/value/concept/structured.hh (revision 1253) @@ -38,6 +38,9 @@ namespace mln { + // Fwd decl. + template <typename E> struct Value; + namespace trait { // FIXME @@ -46,6 +49,17 @@ namespace value { + + // Fwd decl. + template <typename E> struct Structured; + + // Category flag type. + template <> + struct Structured<void> + { + typedef Value<void> super; + }; + template <typename E> struct Structured : public Value<E> { Index: trunk/milena/mln/value/concept/scalar.hh =================================================================== --- trunk/milena/mln/value/concept/scalar.hh (revision 1252) +++ trunk/milena/mln/value/concept/scalar.hh (revision 1253) @@ -38,6 +38,9 @@ namespace mln { + // Fwd decl. + template <typename E> struct Value; + namespace trait { // FIXME @@ -46,6 +49,16 @@ namespace value { + // Fwd decl. + template <typename E> struct Scalar; + + // Category flag type. + template <> + struct Scalar<void> + { + typedef Value<void> super; + }; + template <typename E> struct Scalar : public Value<E> { Index: trunk/milena/mln/value/concept/vectorial.hh =================================================================== --- trunk/milena/mln/value/concept/vectorial.hh (revision 1252) +++ trunk/milena/mln/value/concept/vectorial.hh (revision 1253) @@ -38,6 +38,9 @@ namespace mln { + // Fwd decl. + template <typename E> struct Value; + namespace trait { @@ -48,6 +51,16 @@ namespace value { + // Fwd decl. + template <typename E> struct Vectorial; + + // Category flag type. + template <> + struct Vectorial<void> + { + typedef Value<void> super; + }; + template <typename E> struct Vectorial : public Value<E> { Index: trunk/milena/mln/value/concept/integer.hh =================================================================== --- trunk/milena/mln/value/concept/integer.hh (revision 1252) +++ trunk/milena/mln/value/concept/integer.hh (revision 1253) @@ -37,7 +37,6 @@ namespace mln { - namespace trait { // FIXME @@ -46,6 +45,16 @@ namespace value { + // Fwd decl. + template <typename E> struct Integer; + + // Category flag type. + template <> + struct Integer<void> + { + typedef Scalar<void> super; + }; + template <typename E> struct Integer : public Scalar<E> { Index: trunk/milena/mln/value/builtin.hh =================================================================== --- trunk/milena/mln/value/builtin.hh (revision 1252) +++ trunk/milena/mln/value/builtin.hh (revision 1253) @@ -32,6 +32,9 @@ * \brief Some definitions about builtins. */ +# include <mln/value/concept/symbolic.hh> +# include <mln/value/concept/integer.hh> +# include <mln/value/concept/floating.hh> namespace mln { @@ -42,50 +45,23 @@ // The case of built-in types. - template <typename E> - struct Built_In; + // Fwd decl. + template <typename E> struct Built_In; + // Category flag type. template <> struct Built_In<void> { typedef void* super; // Every builtin belongs to a sub-category of Value but we do not know which one. }; + template <> struct category< bool > { typedef Built_In<void> ret; typedef value::Symbolic<void> super; }; - template <typename E> struct Symbolic; - - template <> - struct Symbolic<void> - { - typedef Value<void> super; - }; - - - template <typename E> struct Integer; - - template <> - struct Integer<void> - { - typedef Value<void> super; - }; - - - template <typename E> struct Floating; - - template <> - struct Floating<void> - { - typedef Value<void> super; - }; - - - template <> struct category< bool > { typedef Built_In<void> ret; typedef Symbolic<void> super; }; - - template <> struct category< int > { typedef Built_In<void> ret; typedef Integer<void> super; }; - template <> struct category< unsigned > { typedef Built_In<void> ret; typedef Integer<void> super; }; + template <> struct category< int > { typedef Built_In<void> ret; typedef value::Integer<void> super; }; + template <> struct category< unsigned > { typedef Built_In<void> ret; typedef value::Integer<void> super; }; - template <> struct category< float > { typedef Built_In<void> ret; typedef Floating<void> super; }; - template <> struct category< double > { typedef Built_In<void> ret; typedef Floating<void> super; }; + template <> struct category< float > { typedef Built_In<void> ret; typedef value::Floating<void> super; }; + template <> struct category< double > { typedef Built_In<void> ret; typedef value::Floating<void> super; }; // FIXME: ...
participants (1)
-
Matthieu Garrigues