URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-04-29 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add dim2/ funtion objects and display_edge(), untested.
* mln/world/inter_pixel/dim2/all.hh: New file including all directory.
* mln/world/inter_pixel/dim2/is_dot.hh: New function to test dot.
* mln/world/inter_pixel/dim2/is_edge.hh: New function to test edge.
* mln/world/inter_pixel/dim2/is_pixel.hh: New function to test pixel.
* mln/world/inter_pixel/dim2/is_row_odd.hh: New function to test row.
* mln/world/inter_pixel/display_edge.hh: Display edges in an image.
---
dim2/all.hh | 43 ++++++++++++++++++++++++++
dim2/is_dot.hh | 76 +++++++++++++++++++++++++++++++++++++++++++++++
dim2/is_edge.hh | 76 +++++++++++++++++++++++++++++++++++++++++++++++
dim2/is_pixel.hh | 76 +++++++++++++++++++++++++++++++++++++++++++++++
dim2/is_row_odd.hh | 76 +++++++++++++++++++++++++++++++++++++++++++++++
display_edge.hh | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 432 insertions(+)
Index: trunk/milena/mln/world/inter_pixel/display_edge.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/display_edge.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/display_edge.hh (revision 3729)
@@ -0,0 +1,85 @@
+// 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_WORLD_INTER_PIXEL_DISPLAY_EDGE_HH
+# define MLN_WORLD_INTER_PIXEL_DISPLAY_EDGE_HH
+
+/// \file mln/world/inter_pixel/display_edge.hh
+///
+/// FIXME: insert comment.
+
+# include <mln/core/image/image2d.hh>
+# include <mln/core/image/image_if.hh>
+# include <mln/data/fill.hh>
+# include <mln/world/inter_pixel/dim2/is_edge.hh>
+# include <mln/opt/at.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace inter_pixel
+ {
+
+ template <typename I>
+ I display_edge(const I& ima, mln_value(I) bg, unsigned zoom)
+ {
+ unsigned nrows = ima.nrows() / 2 + 1;
+ unsigned ncols = ima.ncols() / 2 + 1;
+ I output(nrows * (zoom + 1) - 1,
+ ncols * (zoom + 1) - 1);
+ data::fill(output, bg);
+ typedef image_if<const I, dim2::is_edge> edge_t;
+ edge_t edge = ima | dim2::is_edge();
+ mln_piter(edge_t) p(edge.domain());
+ for_all(p)
+ if (p.row() % 2) // horizontal edge
+ {
+ unsigned row = (p.row() / 2 + 1) * (zoom + 1) - 1;
+ unsigned col = (p.col() / 2) * (zoom + 1);
+ for (unsigned i = 0; i < zoom; ++i)
+ opt::at(output, row, col + i) = ima(p);
+ }
+ else // vertical edge
+ {
+ unsigned row = (p.row() / 2) * (zoom + 1);
+ unsigned col = (p.col() / 2 + 1) * (zoom + 1) - 1;
+ for (unsigned i = 0; i < zoom; ++i)
+ opt::at(output, row + i, col) = ima(p);
+ }
+ return output;
+ }
+
+ } // end of namespace mln::world::inter_pixel
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DISPLAY_EDGE
Index: trunk/milena/mln/world/inter_pixel/dim2/is_dot.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/dim2/is_dot.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/dim2/is_dot.hh (revision 3729)
@@ -0,0 +1,76 @@
+// 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_WORLD_INTER_PIXEL_DIM2_IS_DOT_HH
+# define MLN_WORLD_INTER_PIXEL_DIM2_IS_DOT_HH
+
+/// \file mln/world/inter_pixel/dim2d/is_dot.hh
+///
+/// FIXME: insert comment.
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace inter_pixel
+ {
+
+ namespace dim2
+ {
+
+ struct is_dot : public Function_p2b< is_dot >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ inline
+ bool
+ is_dot::operator()(const point2d& p) const
+ {
+ return p.row() % 2 && p.col() % 2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::world::inter_pixel::dim2
+
+ } // end of namespace mln::world::inter_pixel
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DIM2_IS_DOT_HH
Index: trunk/milena/mln/world/inter_pixel/dim2/all.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/dim2/all.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/dim2/all.hh (revision 3729)
@@ -0,0 +1,43 @@
+// Copyright (C) 2008 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_WORLD_INTER_PIXEL_DIM2_ALL_HH
+# define MLN_WORLD_INTER_PIXEL_DIM2_ALL_HH
+
+/// \file mln/world/inter_pixel/dim2/all.hh
+///
+/// File that includes all the dim2 routines.
+
+
+// Local directory.
+# include <mln/world/inter_pixel/dim2/is_dot.hh>
+# include <mln/world/inter_pixel/dim2/is_edge.hh>
+# include <mln/world/inter_pixel/dim2/is_pixel.hh>
+# include <mln/world/inter_pixel/dim2/is_row_odd.hh>
+
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DIM2_ALL_HH
Index: trunk/milena/mln/world/inter_pixel/dim2/is_row_odd.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/dim2/is_row_odd.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/dim2/is_row_odd.hh (revision 3729)
@@ -0,0 +1,76 @@
+// 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_WORLD_INTER_PIXEL_DIM2_IS_ROW_ODD_HH
+# define MLN_WORLD_INTER_PIXEL_DIM2_IS_ROW_ODD_HH
+
+/// \file mln/world/inter_pixel/dim2d/is_row_odd.hh
+///
+/// FIXME: insert comment.
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace inter_pixel
+ {
+
+ namespace dim2
+ {
+
+ struct is_row_odd : public Function_p2b< is_row_odd >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ inline
+ bool
+ is_row_odd::operator()(const point2d& p) const
+ {
+ return p.row() % 2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::world::inter_pixel::dim2
+
+ } // end of namespace mln::world::inter_pixel
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DIM2_IS_ROW_ODD_HH
Index: trunk/milena/mln/world/inter_pixel/dim2/is_pixel.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/dim2/is_pixel.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/dim2/is_pixel.hh (revision 3729)
@@ -0,0 +1,76 @@
+// 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_WORLD_INTER_PIXEL_DIM2_IS_PIXEL_HH
+# define MLN_WORLD_INTER_PIXEL_DIM2_IS_PIXEL_HH
+
+/// \file mln/world/inter_pixel/dim2d/is_pixel.hh
+///
+/// FIXME: insert comment.
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace inter_pixel
+ {
+
+ namespace dim2
+ {
+
+ struct is_pixel : public Function_p2b< is_pixel >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ inline
+ bool
+ is_pixel::operator()(const point2d& p) const
+ {
+ return p.row() % 2 == 0 && p.col() % 2 == 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::world::inter_pixel::dim2
+
+ } // end of namespace mln::world::inter_pixel
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DIM2_IS_PIXEL_HH
Index: trunk/milena/mln/world/inter_pixel/dim2/is_edge.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/dim2/is_edge.hh (revision 0)
+++ trunk/milena/mln/world/inter_pixel/dim2/is_edge.hh (revision 3729)
@@ -0,0 +1,76 @@
+// 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_WORLD_INTER_PIXEL_DIM2_IS_EDGE_HH
+# define MLN_WORLD_INTER_PIXEL_DIM2_IS_EDGE_HH
+
+/// \file mln/world/inter_pixel/dim2d/is_edge.hh
+///
+/// FIXME: insert comment.
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace inter_pixel
+ {
+
+ namespace dim2
+ {
+
+ struct is_edge : public Function_p2b< is_edge >
+ {
+ typedef bool result;
+ bool operator()(const point2d& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ inline
+ bool
+ is_edge::operator()(const point2d& p) const
+ {
+ return p.row() % 2 + p.col() % 2 == 1;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::world::inter_pixel::dim2
+
+ } // end of namespace mln::world::inter_pixel
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_INTER_PIXEL_DIM2_IS_EDGE_HH
URL: https://svn.lrde.epita.fr/svn/oln/trunk
ChangeLog:
2009-04-28 Frederic Bour <bour(a)lrde.epita.fr>
Correct bugs, point functions.
* milena/mln/fun/point/col.hh: New.
* milena/mln/fun/point/row.hh: New.
* milena/mln/fun/point/sli.hh: New.
* milena/mln/fun/point: New.
* milena/mln/fun/spe/unary.hh: Improved proxy support.
* milena/mln/fun/unary.hh: Improved proxy support.
* milena/mln/trait/next/solve_proxy.hh: Typo errors correction.
* milena/sandbox/fred/tests/fun.cc,
* milena/sandbox/fred/tests/thru.cc: Add some tests for proxy.
---
mln/fun/point/col.hh | 84 ++++++++++++++++++++++++++++++++++++++++++
mln/fun/point/row.hh | 84 ++++++++++++++++++++++++++++++++++++++++++
mln/fun/point/sli.hh | 84 ++++++++++++++++++++++++++++++++++++++++++
mln/fun/spe/unary.hh | 26 ++++++++++++-
mln/fun/unary.hh | 2 -
mln/trait/next/solve_proxy.hh | 15 ++-----
sandbox/fred/tests/fun.cc | 2 -
sandbox/fred/tests/thru.cc | 12 ++++++
8 files changed, 295 insertions(+), 14 deletions(-)
Index: trunk/milena/mln/trait/next/solve_proxy.hh
===================================================================
--- trunk/milena/mln/trait/next/solve_proxy.hh (revision 3721)
+++ trunk/milena/mln/trait/next/solve_proxy.hh (revision 3722)
@@ -25,17 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_PROXY_HH
-# define MLN_CORE_CONCEPT_PROXY_HH
+#ifndef MLN_TRAIT_NEXT_SOLVE_PROXY_HH
+# define MLN_TRAIT_NEXT_SOLVE_PROXY_HH
-/*! \file mln/core/concept/proxy.hh
+/*! \file mln/trait/next/solve_proxy.hh
*
- * \brief Definition of the concept of mln::Proxy.
- *
- * \todo preinc and predec are not tested; post-like ops are not handled.
- *
- * \todo add "op=(T)" when possible, so add a constness property.
- * \todo add "opT()const" when possible.
+ * \brief Proxy support for "next" trait solver.
*/
# include <mln/core/concept/object.hh>
@@ -99,4 +94,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_PROXY_HH
+#endif // ! MLN_TRAIT_NEXT_SOLVE_PROXY_HH
Index: trunk/milena/mln/fun/spe/unary.hh
===================================================================
--- trunk/milena/mln/fun/spe/unary.hh (revision 3721)
+++ trunk/milena/mln/fun/spe/unary.hh (revision 3722)
@@ -202,9 +202,20 @@
using super::operator ();
+ lresult apply_rw(typename super::argument& value) const
+ {
+ return lresult(exact(*this), value);
+ }
+
+ template <typename U>
+ typename lresult_with<U>::ret apply_rw(U& value) const
+ {
+ return typename lresult_with<U>::ret(exact(*this), value);
+ }
+
lresult operator () (typename super::argument& value) const
{
- return lresult(this, value);
+ return apply_rw(value);
}
};
@@ -256,10 +267,21 @@
using super::operator ();
- lresult operator () (typename super::argument& value) const
+ lresult apply_rw(typename super::argument& value) const
{
return lresult(exact(*this), value);
}
+
+ template <typename U>
+ typename lresult_with<U>::ret apply_rw(U& value) const
+ {
+ return typename lresult_with<U>::ret(exact(*this), value);
+ }
+
+ lresult operator () (typename super::argument& value) const
+ {
+ return apply_rw(value);
+ }
};
} // end of namespace mln::fun::spe::impl
Index: trunk/milena/mln/fun/point/row.hh
===================================================================
--- trunk/milena/mln/fun/point/row.hh (revision 0)
+++ trunk/milena/mln/fun/point/row.hh (revision 3722)
@@ -0,0 +1,84 @@
+// 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 rowistribute 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_POINT_ROW_HH
+# define MLN_FUN_POINT_ROW_HH
+
+/// \file mln/fun/point/row.hh
+///
+/// Meta function to retrieve/modify the row coord of a point.
+
+# include <mln/fun/unary.hh>
+# include <mln/core/point.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ struct row : unary<row> {};
+
+ } // end of namespace mln::fun
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace trait
+ {
+
+ namespace next
+ {
+
+ template <typename G, typename C>
+ struct set_precise_unary_<mln::fun::row, mln::point<G,C> >
+ {
+ typedef set_precise_unary_ ret;
+ typedef mln::point<G,C> argument;
+ typedef typename argument::coord result;
+ typedef argument& lvalue;
+
+ static result read(const argument& p)
+ {
+ return p.row();
+ }
+
+ static void write(lvalue l, const result& r)
+ {
+ l.row() = r;
+ }
+ };
+
+ } // end of namespace mln::trait::next
+
+ } // end of namespace mln::trait
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif // MLN_FUN_POINT_ROW_HH
Index: trunk/milena/mln/fun/point/sli.hh
===================================================================
--- trunk/milena/mln/fun/point/sli.hh (revision 0)
+++ trunk/milena/mln/fun/point/sli.hh (revision 3722)
@@ -0,0 +1,84 @@
+// 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 rowistribute 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_POINT_SLI_HH
+# define MLN_FUN_POINT_SLI_HH
+
+/// \file mln/fun/point/sli.hh
+///
+/// Meta function to retrieve/modify the sli coord of a point.
+
+# include <mln/fun/unary.hh>
+# include <mln/core/point.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ struct sli : unary<sli> {};
+
+ } // end of namespace mln::fun
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace trait
+ {
+
+ namespace next
+ {
+
+ template <typename G, typename C>
+ struct set_precise_unary_<mln::fun::col, mln::point<G, C> >
+ {
+ typedef set_precise_unary_ ret;
+ typedef mln::point<G,C> argument;
+ typedef typename argument::coord result;
+ typedef argument& lvalue;
+
+ static result read(const argument& p)
+ {
+ return p.sli();
+ }
+
+ static void write(lvalue l, const result& r)
+ {
+ l.sli() = r;
+ }
+ };
+
+ } // end of namespace mln::trait::next
+
+ } // end of namespace mln::trait
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif // MLN_FUN_POINT_SLI_HH
Index: trunk/milena/mln/fun/point/col.hh
===================================================================
--- trunk/milena/mln/fun/point/col.hh (revision 0)
+++ trunk/milena/mln/fun/point/col.hh (revision 3722)
@@ -0,0 +1,84 @@
+// 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 rowistribute 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_POINT_COL_HH
+# define MLN_FUN_POINT_COL_HH
+
+/// \file mln/fun/point/col.hh
+///
+/// Meta function to retrieve/modify the col coord of a point.
+
+# include <mln/fun/unary.hh>
+# include <mln/core/point.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ struct col : unary<col> {};
+
+ } // end of namespace mln::fun
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace trait
+ {
+
+ namespace next
+ {
+
+ template <typename G, typename C>
+ struct set_precise_unary_<mln::fun::col, mln::point<G, C> >
+ {
+ typedef set_precise_unary_ ret;
+ typedef mln::point<G,C> argument;
+ typedef typename argument::coord result;
+ typedef argument& lvalue;
+
+ static result read(const argument& p)
+ {
+ return p.col();
+ }
+
+ static void write(lvalue l, const result& r)
+ {
+ l.col() = r;
+ }
+ };
+
+ } // end of namespace mln::trait::next
+
+ } // end of namespace mln::trait
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif // MLN_FUN_POINT_COL_HH
Index: trunk/milena/mln/fun/unary.hh
===================================================================
--- trunk/milena/mln/fun/unary.hh (revision 3721)
+++ trunk/milena/mln/fun/unary.hh (revision 3722)
@@ -71,7 +71,7 @@
template <typename T>
typename with<T>::ret::template lresult_with<T>::ret operator()(T& v) const
{
- return typename with<T>::ret(storage_get())(v);
+ return typename with<T>::ret(storage_get()).apply_rw(v);
}
template <typename T, typename R>
Index: trunk/milena/sandbox/fred/tests/thru.cc
===================================================================
--- trunk/milena/sandbox/fred/tests/thru.cc (revision 3721)
+++ trunk/milena/sandbox/fred/tests/thru.cc (revision 3722)
@@ -6,11 +6,16 @@
#include <mln/core/var.hh>
#include <mln/core/image/image2d.hh>
+
+#include <mln/fun/point/row.hh>
+
#include <mln/value/int_u8.hh>
#include <mln/debug/all.hh>
#include <iostream>
#include <typeinfo>
+#include <mln/trait/next/solve_proxy.hh>
+
#define dbg_print(val) std::cout << #val << "\n\t -> \t" << (val) << std::endl
int main()
@@ -32,5 +37,12 @@
data::fill_with_image(ima2, tmp);
+ mln::fun::row row;
+
+ mln_piter_(I) p(ima.domain());
+
+ for_all(p)
+ std::cout << row(p);
+
debug::println(ima2);
}
\ No newline at end of file
Index: trunk/milena/sandbox/fred/tests/fun.cc
===================================================================
--- trunk/milena/sandbox/fred/tests/fun.cc (revision 3721)
+++ trunk/milena/sandbox/fred/tests/fun.cc (revision 3722)
@@ -2,10 +2,10 @@
#include <mln/fun/math/abs.hh>
#include <mln/fun/math/cos.hh>
#include <mln/fun/math/norm.hh>
-// #include <mln/fun/math/inc.hh>
#include <mln/fun/component/red.hh>
#include <mln/fun/component/comp.hh>
#include <mln/value/rgb8.hh>
+
#include <iostream>
#define dbg_print(val) std::cout << #val << "\n\t -> \t" << (val) << std::endl