* mln/fun/meta/all.hh,
* mln/fun/meta/essential.hh: include new headers.
* mln/fun/meta/first.hh,
* mln/fun/meta/second.hh: meta function to access util::couple data.
---
milena/ChangeLog | 10 ++++
milena/mln/fun/meta/all.hh | 19 ++++---
milena/mln/fun/meta/{all.hh => essential.hh} | 31 ++---------
milena/mln/fun/meta/{all.hh => first.hh} | 69 ++++++++++++++++++++------
milena/mln/fun/meta/{all.hh => second.hh} | 69 ++++++++++++++++++++------
5 files changed, 134 insertions(+), 64 deletions(-)
copy milena/mln/fun/meta/{all.hh => essential.hh} (69%)
copy milena/mln/fun/meta/{all.hh => first.hh} (52%)
copy milena/mln/fun/meta/{all.hh => second.hh} (52%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 994c509..4f0c24c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,13 @@
+2009-03-10 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Add meta::first and meta::second.
+
+ * mln/fun/meta/all.hh,
+ * mln/fun/meta/essential.hh: include new headers.
+
+ * mln/fun/meta/first.hh,
+ * mln/fun/meta/second.hh: meta function to access util::couple data.
+
2009-03-09 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Add leaves container in tree structure and test new propagations.
diff --git a/milena/mln/fun/meta/all.hh b/milena/mln/fun/meta/all.hh
index 23d7bc2..49bd5b5 100644
--- a/milena/mln/fun/meta/all.hh
+++ b/milena/mln/fun/meta/all.hh
@@ -40,15 +40,16 @@ namespace mln
} // end of namespace mln
-#include<mln/fun/meta/red.hh>
-#include<mln/fun/meta/hue.hh>
-#include<mln/fun/meta/lum.hh>
-#include<mln/fun/meta/all.hh>
-#include<mln/fun/meta/green.hh>
-#include<mln/fun/meta/inty.hh>
-#include<mln/fun/meta/blue.hh>
-#include<mln/fun/meta/sat.hh>
-#include<mln/fun/meta/to_enc.hh>
+# include <mln/fun/meta/blue.hh>
+# include <mln/fun/meta/first.hh>
+# include <mln/fun/meta/green.hh>
+# include <mln/fun/meta/hue.hh>
+# include <mln/fun/meta/inty.hh>
+# include <mln/fun/meta/lum.hh>
+# include <mln/fun/meta/red.hh>
+# include <mln/fun/meta/sat.hh>
+# include <mln/fun/meta/second.hh>
+# include <mln/fun/meta/to_enc.hh>
#endif // ! MLN_FUN_META_ALL_HH
diff --git a/milena/mln/fun/meta/all.hh b/milena/mln/fun/meta/essential.hh
similarity index 69%
copy from milena/mln/fun/meta/all.hh
copy to milena/mln/fun/meta/essential.hh
index 23d7bc2..821a0a9 100644
--- a/milena/mln/fun/meta/all.hh
+++ b/milena/mln/fun/meta/essential.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// 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
@@ -26,29 +26,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_META_ALL_HH
-# define MLN_FUN_META_ALL_HH
+#ifndef MLN_FUN_META_ESSENTIAL_HH
+# define MLN_FUN_META_ESSENTIAL_HH
-namespace mln
-{
+# include <mln/fun/meta/all.hh>
- namespace meta
- {
-
- } // end of namespace mln::meta
-
-} // end of namespace mln
-
-
-#include<mln/fun/meta/red.hh>
-#include<mln/fun/meta/hue.hh>
-#include<mln/fun/meta/lum.hh>
-#include<mln/fun/meta/all.hh>
-#include<mln/fun/meta/green.hh>
-#include<mln/fun/meta/inty.hh>
-#include<mln/fun/meta/blue.hh>
-#include<mln/fun/meta/sat.hh>
-#include<mln/fun/meta/to_enc.hh>
-
-#endif // ! MLN_FUN_META_ALL_HH
+#endif // ! MLN_FUN_META_ESSENTIAL_HH
diff --git a/milena/mln/fun/meta/all.hh b/milena/mln/fun/meta/first.hh
similarity index 52%
copy from milena/mln/fun/meta/all.hh
copy to milena/mln/fun/meta/first.hh
index 23d7bc2..89d3f12 100644
--- a/milena/mln/fun/meta/all.hh
+++ b/milena/mln/fun/meta/first.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// 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
@@ -26,8 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_META_ALL_HH
-# define MLN_FUN_META_ALL_HH
+#ifndef MLN_FUN_META_FIRST_HH
+# define MLN_FUN_META_FIRST_HH
+
+/// \file mln/fun/meta/first.hh
+///
+/// Meta function to retrieve/modify the first component.
+
+# include <mln/core/concept/meta_fun.hh>
+# include <mln/util/couple.hh>
namespace mln
{
@@ -35,20 +42,52 @@ namespace mln
namespace meta
{
+ template <class T>
+ struct first : impl< first<T> >
+ {
+ typedef T value;
+ };
+
} // end of namespace mln::meta
-} // end of namespace mln
+ template <typename T, typename U>
+ struct function< meta::first< util::couple<T,U> > >
+ : public Function_v2w_w2v<function< meta::first < util::couple<T,U>
> > >
+ {
+ typedef util::couple<T,U> value;
+
+ typedef T result;
+ result read(const value& c);
+
+ typedef result& lresult;
+ lresult write(value& c);
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
-#include<mln/fun/meta/red.hh>
-#include<mln/fun/meta/hue.hh>
-#include<mln/fun/meta/lum.hh>
-#include<mln/fun/meta/all.hh>
-#include<mln/fun/meta/green.hh>
-#include<mln/fun/meta/inty.hh>
-#include<mln/fun/meta/blue.hh>
-#include<mln/fun/meta/sat.hh>
-#include<mln/fun/meta/to_enc.hh>
-#endif // ! MLN_FUN_META_ALL_HH
+ template <typename T, typename U>
+ inline
+ typename function< meta::first< util::couple<T,U> > >::result
+ function< meta::first< util::couple<T,U> > >::read(const value&
c)
+ {
+ return c.first();
+ }
+
+ template <typename T, typename U>
+ inline
+ typename function< meta::first< util::couple<T,U> > >::lresult
+ function< meta::first< util::couple<T,U> > >::write(value& c)
+ {
+ return c.first();
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace mln
+#endif // MLN_FUN_META_FIRST_HH
diff --git a/milena/mln/fun/meta/all.hh b/milena/mln/fun/meta/second.hh
similarity index 52%
copy from milena/mln/fun/meta/all.hh
copy to milena/mln/fun/meta/second.hh
index 23d7bc2..5f94846 100644
--- a/milena/mln/fun/meta/all.hh
+++ b/milena/mln/fun/meta/second.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// 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
@@ -26,8 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_META_ALL_HH
-# define MLN_FUN_META_ALL_HH
+#ifndef MLN_FUN_META_SECOND_HH
+# define MLN_FUN_META_SECOND_HH
+
+/// \file mln/fun/meta/second.hh
+///
+/// Meta function to retrieve/modify the second component.
+
+# include <mln/core/concept/meta_fun.hh>
+# include <mln/util/couple.hh>
namespace mln
{
@@ -35,20 +42,52 @@ namespace mln
namespace meta
{
+ template <class T>
+ struct second : impl< second<T> >
+ {
+ typedef T value;
+ };
+
} // end of namespace mln::meta
-} // end of namespace mln
+ template <typename T, typename U>
+ struct function< meta::second< util::couple<T,U> > >
+ : public Function_v2w_w2v<function< meta::second < util::couple<T,U>
> > >
+ {
+ typedef util::couple<T,U> value;
+
+ typedef T result;
+ result read(const value& c);
+
+ typedef result& lresult;
+ lresult write(value& c);
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
-#include<mln/fun/meta/red.hh>
-#include<mln/fun/meta/hue.hh>
-#include<mln/fun/meta/lum.hh>
-#include<mln/fun/meta/all.hh>
-#include<mln/fun/meta/green.hh>
-#include<mln/fun/meta/inty.hh>
-#include<mln/fun/meta/blue.hh>
-#include<mln/fun/meta/sat.hh>
-#include<mln/fun/meta/to_enc.hh>
-#endif // ! MLN_FUN_META_ALL_HH
+ template <typename T, typename U>
+ inline
+ typename function< meta::second< util::couple<T,U> > >::result
+ function< meta::second< util::couple<T,U> > >::read(const value&
c)
+ {
+ return c.second();
+ }
+
+ template <typename T, typename U>
+ inline
+ typename function< meta::second< util::couple<T,U> > >::lresult
+ function< meta::second< util::couple<T,U> > >::write(value& c)
+ {
+ return c.second();
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace mln
+#endif // MLN_FUN_META_SECOND_HH
--
1.5.6.5