https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Géraud <thierry.geraud(a)lrde.epita.fr>
Allow delayed construction of function expressions.
* mln/trait/ch_value.hh (mln_ch_value_): New.
* mln/pw/cst.hh (cst_): New ctor without arg.
* mln/fun/ops.hh (mln_decl_binary_expr_): New ctor wihtout arg
so that the definition of expr template functions involved in
image types can be delayed.
(mln_decl_unary_expr_): Likewise.
* sandbox/folio/test/dt_maze.cc: Use...
* sandbox/folio/test/tmp.ppm: ...this new file.
* sandbox/folio/dt/canvas_dt.hh (f): Change to reference.
mln/fun/ops.hh | 16 ++++++++++++----
mln/pw/cst.hh | 7 +++++++
mln/trait/ch_value.hh | 1 +
sandbox/folio/dt/canvas_dt.hh | 2 +-
sandbox/folio/test/dt_maze.cc | 7 ++++---
5 files changed, 25 insertions(+), 8 deletions(-)
Index: mln/trait/ch_value.hh
--- mln/trait/ch_value.hh (revision 2074)
+++ mln/trait/ch_value.hh (working copy)
@@ -38,6 +38,7 @@
# define mln_ch_value(I, V) typename mln::trait::ch_value< I, V >::ret
+# define mln_ch_value_(I, V) mln::trait::ch_value< I, V >::ret
Index: mln/pw/cst.hh
--- mln/pw/cst.hh (revision 2074)
+++ mln/pw/cst.hh (working copy)
@@ -50,6 +50,7 @@
{
typedef T result;
+ cst_();
cst_(const T& t);
template <typename P>
@@ -78,6 +79,12 @@
}
template <typename T>
+ inline
+ cst_<T>::cst_()
+ {
+ }
+
+ template <typename T>
template <typename P>
inline
T
Index: mln/fun/ops.hh
--- mln/fun/ops.hh (revision 2074)
+++ mln/fun/ops.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -56,6 +56,10 @@
{ \
} \
\
+ Name##_##Out##_expr_() \
+ { \
+ } \
+ \
template <typename P> \
result operator()(const P& p) const \
{ \
@@ -63,8 +67,8 @@
} \
\
protected: \
- const L l_; \
- const R r_; \
+ L l_; \
+ R r_; \
}; \
\
} \
@@ -108,6 +112,10 @@
{ \
} \
\
+ Name##_##Out##_expr_() \
+ { \
+ } \
+ \
template <typename P> \
result operator()(const P& p) const \
{ \
@@ -115,7 +123,7 @@
} \
\
protected: \
- const F f_; \
+ F f_; \
}; \
\
} \
Index: sandbox/folio/test/dt_maze.cc
--- sandbox/folio/test/dt_maze.cc (revision 2074)
+++ sandbox/folio/test/dt_maze.cc (working copy)
@@ -20,7 +20,7 @@
#include <mln/core/sub_image.hh>
#include <mln/core/image_if.hh>
-#include <mln/pw/value.hh>
+#include <mln/pw/all.hh>
#include "../dt/path.hh"
// #include "../dt/raw_path_fast.hh"
@@ -35,7 +35,7 @@
point start;
point end;
- I ima = io::ppm::load<value::rgb8>("../img/monkeys_april.ppm");
+ I ima = io::ppm::load<value::rgb8>("tmp.ppm"); //
"../img/monkeys_april.ppm");
mln_fwd_piter_(I) p(ima.domain());
mln_bkd_piter_(I) pp(ima.domain());
@@ -92,7 +92,8 @@
std::cout << " => done !" << std::endl << std::endl;
std::cout << "call path algorithm..." << std::endl;
- out = dt::path(input | pw::value(mask), make::w_window2d(ws), mln_max(unsigned));
+ out = dt::path(input | (pw::value(mask) == pw::cst(true)),
+ make::w_window2d(ws), mln_max(unsigned));
std::cout << " => done !" << std::endl << std::endl;
// Create output
Index: sandbox/folio/test/tmp.ppm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: sandbox/folio/test/tmp.ppm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: sandbox/folio/dt/canvas_dt.hh
--- sandbox/folio/dt/canvas_dt.hh (revision 2074)
+++ sandbox/folio/dt/canvas_dt.hh (working copy)
@@ -55,7 +55,7 @@
private:
// Functor.
- F f;
+ F& f;
void init();
void run();