URL:
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008
ChangeLog:
2008-09-15 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix various test related files.
* milena/tests/core/routine/exact.cc: Write test.
* milena/tests/canvas/chamfer.cc: Fix includes.
* milena/tests/convert/to_p_set.cc: Fix a method call.
* milena/mln/trait/op/all.hh: remove guards.
* milena/mln/core/internal/exact.hh: Add a forward declaration.
* milena/mln/core/routine/exact.hh: Move an include.
* milena/mln/level/median.hh,
* milena/mln/level/naive/median.hh,
* milena/mln/level/was.median.hh: Use median_h.
* milena/mln/level/memset_.hh: Use full namespace name to call
force_exact (g++ does not look at the right namespace if the full name
is not given).
* milena/mln/convert/to_image.hh: use geom::bbox().
* milena/mln/geom/chamfer.hh,
* milena/mln/geom/pmin_pmax.hh: Rename mln_point to mln_site.
* milena/mln/geom/seeds2tiling.hh,
* milena/mln/geom/seeds2tiling_roundness.hh: Use exact().
* milena/mln/value/hsi.hh: Add missing copyright header.
---
mln/convert/to_image.hh | 2 +-
mln/core/internal/exact.hh | 11 ++++++++++-
mln/core/routine/exact.hh | 6 +-----
mln/geom/chamfer.hh | 3 +--
mln/geom/pmin_pmax.hh | 26 +++++++++++++-------------
mln/geom/seeds2tiling.hh | 5 +++--
mln/geom/seeds2tiling_roundness.hh | 12 +++++++-----
mln/level/median.hh | 6 +++---
mln/level/memset_.hh | 2 +-
mln/level/naive/median.hh | 4 ++--
mln/level/was.median.hh | 6 +++---
mln/trait/op/all.hh | 5 +----
mln/value/hsi.hh | 27 +++++++++++++++++++++++++++
tests/canvas/chamfer.cc | 2 --
tests/convert/to_p_set.cc | 5 ++++-
tests/core/routine/exact.cc | 7 +------
16 files changed, 78 insertions(+), 51 deletions(-)
Index: branches/cleanup-2008/milena/tests/core/routine/exact.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/routine/exact.cc (revision 2269)
+++ branches/cleanup-2008/milena/tests/core/routine/exact.cc (revision 2270)
@@ -44,11 +44,6 @@
using namespace mln;
test t;
- std::cout << typeid(exact(t)).name() << std::endl;;
-
Object<test>& t_ = t;
- std::cout << typeid(exact(t_)).name() << std::endl;;
-
- int i;
- std::cout << typeid(exact(i)).name() << std::endl;;
+ mln_assertion(typeid(exact(t_)).name() == typeid(exact(t)).name());
}
Index: branches/cleanup-2008/milena/tests/convert/to_p_set.cc
===================================================================
--- branches/cleanup-2008/milena/tests/convert/to_p_set.cc (revision 2269)
+++ branches/cleanup-2008/milena/tests/convert/to_p_set.cc (revision 2270)
@@ -60,7 +60,10 @@
d(0,-1);
p_set<point2d> ref;
- ref.insert(a).insert(b).insert(c).insert(d);
+ ref.insert(a);
+ ref.insert(b);
+ ref.insert(c);
+ ref.insert(d);
// Reference constructed.
// Nbh :
Index: branches/cleanup-2008/milena/tests/canvas/chamfer.cc
===================================================================
--- branches/cleanup-2008/milena/tests/canvas/chamfer.cc (revision 2269)
+++ branches/cleanup-2008/milena/tests/canvas/chamfer.cc (revision 2270)
@@ -32,14 +32,12 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
-#include <mln/core/image_if_value.hh>
#include <mln/core/image/inplace.hh>
#include <mln/level/fill.hh>
#include <mln/debug/println.hh>
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/core/alias/w_window2d_float.hh>
-#include <mln/core/image_if_interval.hh>
#include <mln/make/win_chamfer.hh>
#include <mln/geom/chamfer.hh>
Index: branches/cleanup-2008/milena/mln/trait/op/all.hh
===================================================================
--- branches/cleanup-2008/milena/mln/trait/op/all.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/trait/op/all.hh (revision 2270)
@@ -25,8 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TRAIT_OP_ALL_HH
-# define MLN_TRAIT_OP_ALL_HH
+// GUARD NOT REQUIRED: all included files already have guards.
/*!
* \file mln/trait/op/all.hh
@@ -81,5 +80,3 @@
// Ordering.
# include <mln/trait/op/ord.hh>
-
-#endif // ! MLN_TRAIT_OP_ALL_HH
Index: branches/cleanup-2008/milena/mln/core/internal/exact.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/internal/exact.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/core/internal/exact.hh (revision 2270)
@@ -32,7 +32,15 @@
* \brief Meta-code for the mln::exact downcast routines.
*/
-# include <mln/core/concept/object.hh>
+
+/// Forward declaration.
+namespace mln
+{
+
+ template <typename T>
+ struct Object;
+
+} // End of namespace mln
namespace mln
@@ -121,5 +129,6 @@
} // end of namespace mln
+# include <mln/core/concept/object.hh>
#endif // ! MLN_CORE_INTERNAL_EXACT_HH
Index: branches/cleanup-2008/milena/mln/core/routine/exact.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/routine/exact.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/core/routine/exact.hh (revision 2270)
@@ -32,14 +32,11 @@
* \brief Definition of the mln::exact downcast routines.
*/
-#include <mln/core/internal/exact.hh>
-
-
/// FIXME: Doc!
#define mln_exact(T) typename mln::internal::exact_<T>::ret
#define mln_exact_(T) mln::internal::exact_<T>::ret
-
+#include <mln/core/internal/exact.hh>
namespace mln
{
@@ -88,5 +85,4 @@
} // end of namespace mln
-
#endif // ! MLN_CORE_ROUTINE_EXACT_HH
Index: branches/cleanup-2008/milena/mln/level/was.median.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/was.median.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/level/was.median.hh (revision 2270)
@@ -40,7 +40,7 @@
# include <mln/geom/max_row.hh>
# include <mln/geom/min_row.hh>
# include <mln/set/diff.hh>
-# include <mln/accu/median.hh>
+# include <mln/level/median.hh>
# include <mln/win/hline2d.hh>
namespace mln
@@ -81,7 +81,7 @@
q_bp(win_bkd_plus, p), q_bm(win_bkd_minus, p),
q_top(win_top, p), q_bot(win_bot, p);
- accu::median<mln_vset(I)> med(input.values());
+ accu::median_h<mln_vset(I)> med(input.values());
// initialization
@@ -154,7 +154,7 @@
int& row = p.row();
int& col = p.col();
- accu::median<mln_vset(I)> med(input.values());
+ accu::median_h<mln_vset(I)> med(input.values());
for (row = min_row; row <= max_row; ++row)
{
Index: branches/cleanup-2008/milena/mln/level/memset_.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/memset_.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/level/memset_.hh (revision 2270)
@@ -128,7 +128,7 @@
typedef mln_image(P) I;
metal::is_not_const<I>::check();
- P& pix = internal::force_exact<P>(pix_);
+ P& pix = mln::internal::force_exact<P>(pix_);
mln_precondition(pix.ima().has_data());
mln_precondition(& pix.val() >= & pix.ima()[0]);
mln_precondition(& pix.val() < & pix.ima()[0] + pix.ima().nelements());
Index: branches/cleanup-2008/milena/mln/level/median.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/median.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/level/median.hh (revision 2270)
@@ -43,7 +43,7 @@
# include <mln/canvas/browsing/snake_fwd.hh>
# include <mln/canvas/browsing/dir_struct_elt_incr_update.hh>
-# include <mln/accu/median.hh>
+# include <mln/accu/median_h.hh>
namespace mln
@@ -108,7 +108,7 @@
// aux data
- accu::median<mln_vset(I)> med;
+ accu::median_h<mln_vset(I)> med;
P p;
window<D> win_fp, win_fm, win_bp, win_bm, win_dp, win_dm;
mln_qiter(W) q_fp, q_fm, q_bp, q_bm, q_dp, q_dm;
@@ -196,7 +196,7 @@
// aux data
mln_psite(I) p;
- accu::median<mln_vset(I)> med;
+ accu::median_h<mln_vset(I)> med;
// ctor
inline
Index: branches/cleanup-2008/milena/mln/level/naive/median.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/naive/median.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/level/naive/median.hh (revision 2270)
@@ -35,7 +35,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/alias/window2d.hh>
-# include <mln/accu/median.hh>
+# include <mln/level/median.hh>
namespace mln
@@ -79,7 +79,7 @@
{
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
- accu::median<mln_vset(I)> med(input.values());
+ accu::median_h<mln_vset(I)> med(input.values());
for_all(p)
{
Index: branches/cleanup-2008/milena/mln/value/hsi.hh
===================================================================
--- branches/cleanup-2008/milena/mln/value/hsi.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/value/hsi.hh (revision 2270)
@@ -1,3 +1,30 @@
+// Copyright (C) 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
+// 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.
+
#include <mln/value/ops.hh>
#include <mln/value/concept/vectorial.hh>
Index: branches/cleanup-2008/milena/mln/convert/to_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/convert/to_image.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/convert/to_image.hh (revision 2270)
@@ -137,7 +137,7 @@
mln_image_from(S, bool) to_image(const Site_Set<S>& pset_, unsigned
border)
{
const S& pset = exact(pset_);
- mln_image_from(S, bool) ima(pset.bbox().to_larger(border));
+ mln_image_from(S, bool) ima(geom::bbox(pset).to_larger(border));
level::fill(ima, false);
mln_piter(S) p(pset);
for_all(p)
Index: branches/cleanup-2008/milena/mln/geom/pmin_pmax.hh
===================================================================
--- branches/cleanup-2008/milena/mln/geom/pmin_pmax.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/geom/pmin_pmax.hh (revision 2270)
@@ -50,7 +50,7 @@
/// Compute the minimum and maximum points of point set \p s.
template <typename S>
- std::pair<mln_point(S), mln_point(S)>
+ std::pair<mln_site(S), mln_site(S)>
pmin_pmax(const Site_Set<S>& s);
@@ -58,13 +58,13 @@
/// of point set \p s.
template <typename S>
void
- pmin_pmax(const Site_Set<S>& s, mln_point(S)& pmin, mln_point(S)&
pmax);
+ pmin_pmax(const Site_Set<S>& s, mln_site(S)& pmin, mln_site(S)&
pmax);
/// Compute the minimum and maximum points when browsing with
/// iterator \p p.
template <typename I>
- std::pair<mln_psite(I), mln_psite(I)>
+ std::pair<mln_site(I), mln_site(I)>
pmin_pmax(const Site_Iterator<I>& p);
@@ -72,7 +72,7 @@
/// when browsing with iterator \p p.
template <typename I>
void
- pmin_pmax(const Site_Iterator<I>& p, mln_psite(I)& pmin,
mln_psite(I)& pmax);
+ pmin_pmax(const Site_Iterator<I>& p, mln_site(I)& pmin,
mln_site(I)& pmax);
@@ -84,7 +84,7 @@
template <typename I>
inline
void
- pmin_pmax(const Site_Iterator<I>& p_, mln_psite(I)& pmin,
mln_psite(I)& pmax)
+ pmin_pmax(const Site_Iterator<I>& p_, mln_site(I)& pmin,
mln_site(I)& pmax)
{
I p = exact(p_); // a copy of p_
@@ -94,7 +94,7 @@
pmin = pmax = p;
// update with remaining points
- typedef mln_psite(I) P;
+ typedef mln_site(I) P;
for_all_remaining(p)
for (unsigned i = 0; i < P::dim; ++i)
if (p[i] < pmin[i])
@@ -105,10 +105,10 @@
template <typename I>
inline
- std::pair<mln_psite(I), mln_psite(I)>
+ std::pair<mln_site(I), mln_site(I)>
pmin_pmax(const Site_Iterator<I>& p)
{
- typedef mln_psite(I) P;
+ typedef mln_site(I) P;
std::pair<P, P> tmp;
pmin_pmax(p, tmp.first, tmp.second); // Calls the previous version.
return tmp;
@@ -125,7 +125,7 @@
template <typename S>
inline
void
- pmin_pmax_(const Site_Set<S>& s, mln_point(S)& pmin,
mln_point(S)& pmax)
+ pmin_pmax_(const Site_Set<S>& s, mln_site(S)& pmin, mln_site(S)&
pmax)
{
mln_piter(S) it(exact(s));
pmin_pmax(it, pmin, pmax);
@@ -136,7 +136,7 @@
template <typename B>
inline
void
- pmin_pmax_(const Box<B>& b, mln_point(B)& pmin, mln_point(B)&
pmax)
+ pmin_pmax_(const Box<B>& b, mln_site(B)& pmin, mln_site(B)&
pmax)
{
pmin = exact(b).pmin();
pmax = exact(b).pmax();
@@ -148,7 +148,7 @@
template <typename S>
inline
void
- pmin_pmax(const Site_Set<S>& s, mln_point(S)& pmin, mln_point(S)&
pmax)
+ pmin_pmax(const Site_Set<S>& s, mln_site(S)& pmin, mln_site(S)&
pmax)
{
mln_precondition(exact(s).nsites() != 0);
impl::pmin_pmax_(exact(s), pmin, pmax);
@@ -156,11 +156,11 @@
template <typename S>
inline
- std::pair<mln_point(S), mln_point(S)>
+ std::pair<mln_site(S), mln_site(S)>
pmin_pmax(const Site_Set<S>& s)
{
mln_precondition(exact(s).nsites() != 0);
- typedef mln_point(S) P;
+ typedef mln_site(S) P;
std::pair<P, P> tmp;
pmin_pmax(s, tmp.first, tmp.second); // Calls the previous version.
return tmp;
Index: branches/cleanup-2008/milena/mln/geom/seeds2tiling.hh
===================================================================
--- branches/cleanup-2008/milena/mln/geom/seeds2tiling.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/geom/seeds2tiling.hh (revision 2270)
@@ -69,12 +69,13 @@
inline
I
seeds2tiling (Image<I>& ima_,
- const Neighborhood<N>& nbh)
+ const Neighborhood<N>& nbh_)
{
trace::entering("geom::impl::seed2tiling");
I& ima = exact(ima_);
I out = clone(ima_);
+ const N& nbh = exact(nbh_);
p_queue<mln_psite(I)> q;
// Init.
@@ -105,7 +106,7 @@
if (out(n) != 0)
out(p) = out(n);
else
- q.push_force(n); // n may already be in the queue,
+ q.push(n); // n may already be in the queue,
// yet we then queue again this psite
}
}
Index: branches/cleanup-2008/milena/mln/geom/seeds2tiling_roundness.hh
===================================================================
--- branches/cleanup-2008/milena/mln/geom/seeds2tiling_roundness.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/geom/seeds2tiling_roundness.hh (revision 2270)
@@ -37,7 +37,8 @@
# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/p_priority_fast.hh>
+# include <mln/core/site_set/p_priority.hh>
+# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/core/routine/clone.hh>
# include <mln/accu/mean.hh>
# include <mln/estim/min_max.hh>
@@ -79,21 +80,22 @@
inline
I
seeds2tiling_roundness(Image<I>& ima_, const w_window2d_int& w_win,
- unsigned max, const Neighborhood<N>& nbh)
+ unsigned max, const Neighborhood<N>& nbh_)
{
trace::entering("geom::impl::seed2tiling_roundness");
I& ima = exact(ima_);
+ const N& nbh = exact(nbh_);
image2d<unsigned> dist = geom::chamfer(ima, w_win, max);
I out = clone(ima_);
- p_priority_fast<mln_psite(I), unsigned> q;
+ p_priority<mln_psite(I), p_queue_fast<unsigned> > q;
// Init.
{
mln_piter(I) p(ima.domain());
for_all(p)
- q.push_force(p, max - dist(p));
+ q.push(p, max - dist(p));
}
@@ -145,4 +147,4 @@
} // end of namespace mln
-#endif // ! MLN_GEOM_SEEDS2TILING_ROUNDNESS_HH
+#endif // ! MLN_GEOM_SEEDS3TILING_ROUNDNESS_HH
Index: branches/cleanup-2008/milena/mln/geom/chamfer.hh
===================================================================
--- branches/cleanup-2008/milena/mln/geom/chamfer.hh (revision 2269)
+++ branches/cleanup-2008/milena/mln/geom/chamfer.hh (revision 2270)
@@ -37,7 +37,6 @@
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/core/alias/w_window2d_float.hh>
# include <mln/core/image/sub_image.hh>
-# include <mln/core/image_if_value.hh>
# include <mln/core/image/inplace.hh>
# include <mln/canvas/chamfer.hh>
@@ -66,7 +65,7 @@
{
typedef I_ I;
typedef W_ W;
- typedef mln_point(I_) P;
+ typedef mln_site(I_) P;
// requirements from mln::canvas::chamfer: