https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix compilation errors.
* tests/run_pset.cc: Fix and clean.
* tests/README: Augment.
* tests/erosion.cc: Clean.
* mln/core/internal/run_pset.hh: Fix.
* mln/core/concept/function.hh: Add explicit calls to cpy
ctors.
mln/core/concept/function.hh | 23 ++++++++----
mln/core/internal/run_pset.hh | 2 -
tests/README | 16 ++++++++
tests/erosion.cc | 7 ++-
tests/run_pset.cc | 77 ++++++++++++++++++++++++++----------------
5 files changed, 85 insertions(+), 40 deletions(-)
Index: tests/run_pset.cc
--- tests/run_pset.cc (revision 1056)
+++ tests/run_pset.cc (working copy)
@@ -1,58 +1,79 @@
-#include <mln/core/internal/run_pset.hh>
+// Copyright (C) 2007 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
+// 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.
+
+/*! \file tests/run_pset.cc
+ *
+ * \brief Test on mln::internal::run_pset_ and related tools.
+ */
+
#include <mln/core/image2d_b.hh>
-#include <iostream>
+#include <mln/core/internal/run_pset.hh>
-using namespace mln;
template <typename Pset>
-void
-parc(const Pset& pset)
+void parc(const Pset& pset)
{
- typename Pset::fwd_piter it_(pset);
-
+ mln_fwd_piter(Pset) it_(pset);
for_all(it_)
- {
- std::cout << (typename Pset::point) it_ << std::endl;
- }
-
- typename Pset::bkd_piter rit_(pset);
+ std::cout << it_ << std::endl;
+ mln_bkd_piter(Pset) rit_(pset);
for_all(rit_)
- {
- std::cout << (typename Pset::point) rit_ << std::endl;
- }
+ std::cout << rit_ << std::endl;
}
-int
-main()
+int main()
{
+ using namespace mln;
+
point2d p, q, r;
p = make::point2d(2, 4);
q = make::point2d(18, 42);
r = make::point2d(50, 76);
// Psite declaration
- run_psite<point2d> site(p, 5, 0);
- run_psite<point2d> site2(r, 40, 0);
+ internal::run_psite<point2d> site(p, 5, 0);
+ internal::run_psite<point2d> site2(r, 40, 0);
// Pset test
internal::run_pset_<point2d> ps;
ps.insert(p, 7);
- assert(ps.npoints() = 7);
+ mln_assertion(ps.npoints() = 7);
ps.insert(q, 42);
- assert(ps.npoints() = 49);
+ mln_assertion(ps.npoints() = 49);
- assert(ps.has(site));
- assert(!ps.has(site2));
+ mln_assertion(ps.has(site));
+ mln_assertion(!ps.has(site2));
ps.insert(r, 14);
- assert(!ps.has(site2));
-
- // FIXME bbox test
+ mln_assertion(!ps.has(site2));
- parc(ps);
- return 0;
+ // parc(ps);
}
Index: tests/README
--- tests/README (revision 1056)
+++ tests/README (working copy)
@@ -4,14 +4,28 @@
* compilation
+** g++-4.1
+*** options
+-ansi -pedantic -W -Wall -Wextra -Wconversion
+*** sample
g++-4.1 -ansi -pedantic -W -Wall -Wextra -Wconversion -I.. sample.cc
+** g++-2.95
+*** options
+-ansi -pedantic -W -Wall -Wconversion -ftemplate-depth-51
+*** sample
g++-2.95 -ansi -pedantic -W -Wall -Wconversion -ftemplate-depth-51 -I.. sample.cc
+** icpc-9.1
+*** options
+-w1 -Wcheck -Werror -ansi
+*** sample
+icpc-9.1 -w1 -Wcheck -Werror -ansi -I.. sample.cc
+
* bench
+** median
naive: 18s
median: 1s
approx: 0.05s
-
Index: tests/erosion.cc
--- tests/erosion.cc (revision 1056)
+++ tests/erosion.cc (working copy)
@@ -54,12 +54,13 @@
win::rectangle2d rec(21, 21);
border::thickness = 66;
- image2d_b<int_u8>
- lena = io::load_pgm("../img/lena.pgm"),
- out(lena.domain());
+ image2d_b<int_u8> lena = io::load_pgm("../img/lena.pgm");
+ {
+ image2d_b<int_u8> out(lena.domain());
morpho::erosion(lena, rec, out);
io::save_pgm(out, "out.pgm");
+ }
{
image2d_b<bool> bin(lena.domain()), out(lena.domain());
Index: mln/core/internal/run_pset.hh
--- mln/core/internal/run_pset.hh (revision 1056)
+++ mln/core/internal/run_pset.hh (working copy)
@@ -217,7 +217,7 @@
}
template <typename P, typename E>
- run_piter_<P, E>::operator typename run_piter_<P, E>::psite () const
+ run_piter_<P, E>::operator internal::run_psite<P> () const
{
return site_;
}
Index: mln/core/concept/function.hh
--- mln/core/concept/function.hh (revision 1056)
+++ mln/core/concept/function.hh (working copy)
@@ -148,7 +148,8 @@
}
template <typename E>
- Function<E>::Function(const Function<E>&)
+ Function<E>::Function(const Function<E>& rhs)
+ : Object<E>(rhs)
{
}
@@ -158,7 +159,8 @@
}
template <typename E>
- Function_v2v<E>::Function_v2v(const Function_v2v<E>&)
+ Function_v2v<E>::Function_v2v(const Function_v2v<E>& rhs)
+ : Function<E>(rhs)
{
}
@@ -168,7 +170,8 @@
}
template <typename E>
- Function_i2v<E>::Function_i2v(const Function_i2v<E>&)
+ Function_i2v<E>::Function_i2v(const Function_i2v<E>& rhs)
+ : Function_v2v<E>(rhs)
{
}
@@ -178,7 +181,8 @@
}
template <typename E>
- Function_p2v<E>::Function_p2v(const Function_p2v<E>&)
+ Function_p2v<E>::Function_p2v(const Function_p2v<E>& rhs)
+ : Function_v2v<E>(rhs)
{
}
@@ -188,7 +192,8 @@
}
template <typename E>
- Function_v2b<E>::Function_v2b(const Function_v2b<E>&)
+ Function_v2b<E>::Function_v2b(const Function_v2b<E>& rhs)
+ : Function_v2v<E>(rhs)
{
}
@@ -198,7 +203,10 @@
}
template <typename E>
- Function_p2b<E>::Function_p2b(const Function_p2b<E>&)
+ Function_p2b<E>::Function_p2b(const Function_p2b<E>& rhs)
+ : Function_v2v<E>(rhs),
+ Function_p2v<E>(rhs),
+ Function_v2b<E>(rhs)
{
}
@@ -208,7 +216,8 @@
}
template <typename E>
- Function_p2p<E>::Function_p2p(const Function_p2p<E>&)
+ Function_p2p<E>::Function_p2p(const Function_p2p<E>& rhs)
+ : Function_p2v<E>(rhs)
{
}