https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a resolve mechanism for use in meta functions.
* mln/fun/internal/resolve.hh New.
* mln/metal/is_a.hh (mlc_is_a__1comma): New macro.
* mln/trait/solve_binary.hh: Upgrade file doc style.
fun/internal/resolve.hh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
metal/is_a.hh | 15 ++++++---
trait/solve_binary.hh | 13 +++-----
3 files changed, 93 insertions(+), 13 deletions(-)
Index: mln/trait/solve_binary.hh
--- mln/trait/solve_binary.hh (revision 3392)
+++ mln/trait/solve_binary.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 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,13 +29,9 @@
#ifndef MLN_TRAIT_SOLVE_BINARY_HH
# define MLN_TRAIT_SOLVE_BINARY_HH
-/*!
- * \file mln/trait/solve_binary.hh
- *
- * \brief FIXME
- *
- *
- */
+/// \file mln/trait/solve_binary.hh
+///
+/// FIXME
# include <mln/core/category.hh>
# include <mln/core/routine/exact.hh>
Index: mln/metal/is_a.hh
--- mln/metal/is_a.hh (revision 3392)
+++ mln/metal/is_a.hh (working copy)
@@ -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,10 +29,9 @@
#ifndef MLN_METAL_IS_A_HH
# define MLN_METAL_IS_A_HH
-/*! \file mln/metal/is_a.hh
- *
- * \brief Definition of a type that means "is_a".
- */
+/// \file mln/metal/is_a.hh
+///
+/// \brief Definition of a type that means "is_a".
# include <mln/metal/bool.hh>
@@ -47,6 +47,11 @@
# define mlc_is_a(T, M) mln::metal::is_a<T, M>
+// Allows to write somthing like "mlc_is_a(T<P1,P2>, M)" without
+// getting trouble with the preprocessor due to the 1st comma.
+# define mlc_is_a__1comma(Tleft, Tright, M) mln::metal::is_a< Tleft,Tright , M >
+
+
namespace mln
{
Index: mln/fun/internal/resolve.hh
--- mln/fun/internal/resolve.hh (revision 0)
+++ mln/fun/internal/resolve.hh (revision 0)
@@ -0,0 +1,78 @@
+// Copyright (C) 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
+// 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_FUN_INTERNAL_RESOLVE_HH
+# define MLN_FUN_INTERNAL_RESOLVE_HH
+
+/// \file mln/fun/internal/resolve.hh
+///
+/// \brief FIXME.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/solve.hh>
+# include <mln/value/builtin/all.hh>
+
+
+# define mln_fun_internal_resolve(F) typename fun::internal::resolve< F >::ret
+
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace internal
+ {
+
+ template <typename F>
+ struct resolve;
+
+ template < template <class, class> class F,
+ typename L,
+ typename R >
+ struct resolve< F<L,R> > : public mln::trait::solve_binary< F, L, R
>,
+ private mlc_is_a__1comma(F<L,R>, Function)::check_t
+ {
+ };
+
+ template < template <class> class F,
+ typename T >
+ struct resolve< F<T> > : public mln::trait::solve_unary< F, T >,
+ private mlc_is_a(F<T>, Function)::check_t
+ {
+ };
+
+ } // end of namespace mln::fun::internal
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_INTERNAL_RESOLVE_HH