https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing trace in mln::test routines.
* mln/level/compare.hh,
* mln/test/positive.hh,
* mln/test/predicate.hh: Add trace.
Upgrade doc style.
* tests/level/compare.cc: Upgrade doc style.
mln/level/compare.hh | 88 +++++++++++++++++++++++++++++--------------------
mln/test/positive.hh | 17 ++++++---
mln/test/predicate.hh | 37 +++++++++++++++++---
tests/level/compare.cc | 10 ++---
4 files changed, 101 insertions(+), 51 deletions(-)
Index: mln/level/compare.hh
--- mln/level/compare.hh (revision 3524)
+++ mln/level/compare.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 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
@@ -28,10 +29,9 @@
#ifndef MLN_LEVEL_COMPARE_HH
# define MLN_LEVEL_COMPARE_HH
-/*! \file mln/level/compare.hh
- *
- * \brief Comparison operators between the pixel values of images.
- */
+/// \file mln/level/compare.hh
+///
+/// Comparison operators between the pixel values of images.
# include <mln/core/concept/image.hh>
# include <mln/fun/vv2b/eq.hh>
@@ -43,38 +43,38 @@
namespace mln
{
- /*! Point-wise test if the pixel values of \p lhs are equal to the
- * pixel values of \p rhs.
- *
- * \param[in] lhs A first image.
- * \param[in] rhs A second image.
- *
- * \pre lhs.domain == rhs.domain
- */
+ /// Point-wise test if the pixel values of \p lhs are equal to the
+ /// pixel values of \p rhs.
+ ///
+ /// \param[in] lhs A first image.
+ /// \param[in] rhs A second image.
+ ///
+ /// \pre lhs.domain == rhs.domain
+ //
template <typename L, typename R>
bool operator == (const Image<L>& lhs, const Image<R>& rhs);
- /*! Point-wise test if the pixel values of \p lhs are point-wise
- * less than the pixel values of \p rhs.
- *
- * \param[in] lhs A first image.
- * \param[in] rhs A second image.
- *
- * \pre lhs.domain == rhs.domain
- */
+ /// Point-wise test if the pixel values of \p lhs are point-wise
+ /// less than the pixel values of \p rhs.
+ ///
+ /// \param[in] lhs A first image.
+ /// \param[in] rhs A second image.
+ ///
+ /// \pre lhs.domain == rhs.domain
+ //
template <typename L, typename R>
bool operator < (const Image<L>& lhs, const Image<R>& rhs);
- /*! Point-wise test if the pixel values of \p lhs are point-wise
- * less than or equal to the pixel values of \p rhs.
- *
- * \param[in] lhs A first image.
- * \param[in] rhs A second image.
- *
- * \pre lhs.domain == rhs.domain
- */
+ /// Point-wise test if the pixel values of \p lhs are point-wise
+ /// less than or equal to the pixel values of \p rhs.
+ ///
+ /// \param[in] lhs A first image.
+ /// \param[in] rhs A second image.
+ ///
+ /// \pre lhs.domain == rhs.domain
+ //
template <typename L, typename R> // required!
bool operator <= (const Image<L>& lhs, const Image<R>& rhs);
@@ -82,45 +82,63 @@
# ifndef MLN_INCLUDE_ONLY
+
template <typename L, typename R>
inline
bool operator == (const Image<L>& lhs_, const Image<R>& rhs_)
{
- typedef fun::vv2b::eq<mln_value(L), mln_value(R)> F;
+ trace::entering("level::compare (==)");
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
+
mln_precondition(lhs.is_valid());
mln_precondition(rhs.is_valid());
mln_precondition(lhs.domain() == rhs.domain());
- return test::predicate(lhs_, rhs_, F());
+ typedef fun::vv2b::eq<mln_value(L), mln_value(R)> F;
+ bool res = test::predicate(lhs_, rhs_, F());
+
+ trace::exiting("level::compare (==)");
+ return res;
}
+
template <typename L, typename R>
inline
bool operator < (const Image<L>& lhs_, const Image<R>& rhs_)
{
- typedef fun::vv2b::lt<mln_value(L), mln_value(R)> F;
+ trace::entering("level::compare (<)");
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
+
mln_precondition(lhs.domain() == rhs.domain());
- return test::predicate(lhs_, rhs_, F());
+ typedef fun::vv2b::lt<mln_value(L), mln_value(R)> F;
+ bool res = test::predicate(lhs_, rhs_, F());
+
+ trace::exiting("level::compare (<)");
+ return res;
}
+
template <typename L, typename R> // required!
inline
bool operator <= (const Image<L>& lhs_, const Image<R>& rhs_)
{
- typedef fun::vv2b::le<mln_value(L), mln_value(R)> F;
+ trace::entering("level::compare (<=)");
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
+
mln_precondition(lhs.domain() == rhs.domain());
- return test::predicate(lhs_, rhs_, F());
+ typedef fun::vv2b::le<mln_value(L), mln_value(R)> F;
+ bool res = test::predicate(lhs_, rhs_, F());
+
+ trace::exiting("level::compare (<=)");
+ return res;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/test/positive.hh
--- mln/test/positive.hh (revision 3524)
+++ mln/test/positive.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 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
@@ -28,10 +29,9 @@
#ifndef MLN_TEST_POSITIVE_HH
# define MLN_TEST_POSITIVE_HH
-/*! \file mln/test/positive.hh
- *
- * \brief Test if an image only contains positive values.
- */
+/// \file mln/test/positive.hh
+///
+/// Test if an image only contains positive values.
# include <mln/test/predicate.hh>
# include <mln/pw/all.hh>
@@ -56,17 +56,22 @@
inline
bool positive(const Image<I>& input_)
{
+ trace::entering("test::positive");
+
const I& input = exact(input_);
mln_precondition(input.is_valid());
// FIXME: Below the '>=' op should properly work with signed/unsigned
without
// FIXME: warnings; so we really need to overload ops for functions when literals
// FIXME: are involved.
mln_value(I) zero_ = literal::zero;
- return test::predicate(input.domain(),
+ bool res = test::predicate(input.domain(),
pw::value(input) >= pw::cst(zero_));
// FIXME: test the version below.
// return test::predicate(input,
// fun::v2v::id<mln_value(I)>() >= pw::cst(0));
+
+ trace::exiting("test::positive");
+ return res;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/test/predicate.hh
--- mln/test/predicate.hh (revision 3524)
+++ mln/test/predicate.hh (working copy)
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
-// (LRDE)
+// 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 redistribute it and/or modify it under the terms
@@ -49,6 +49,7 @@
///
/// \param[in] ima The image.
/// \param[in] f The predicate.
+ //
template <typename I, typename F>
bool predicate(const Image<I>& ima, const Function_v2b<F>& f);
@@ -59,6 +60,7 @@
/// \param[in] lhs The image.
/// \param[in] rhs The image.
/// \param[in] f The predicate.
+ //
template <typename I, typename J, typename F>
bool predicate(const Image<I>& lhs, const Image<J>& rhs, const
Function_vv2b<F>& f);
@@ -67,12 +69,16 @@
///
/// \param[in] pset The point set.
/// \param[in] f The predicate.
+ //
template <typename S, typename F>
bool predicate(const Site_Set<S>& pset, const Function_p2b<F>&
f);
# ifndef MLN_INCLUDE_ONLY
+
+ // Tests.
+
namespace internal
{
@@ -115,6 +121,9 @@
} // end of namespace mln::test::internal
+
+ // Implementations.
+
namespace impl
{
@@ -191,15 +200,22 @@
} // end of namespace mln::test::impl
+
// Facades.
+
template <typename I, typename F>
inline
bool predicate(const Image<I>& ima, const Function_v2b<F>& f)
{
+ trace::entering("test::predicate");
+
internal::predicate_tests(ima, f);
- return impl::predicate_(mln_trait_image_speed(I)(), exact(ima),
+ bool res = impl::predicate_(mln_trait_image_speed(I)(), exact(ima),
exact(f));
+
+ trace::exiting("test::predicate");
+ return res;
}
@@ -207,23 +223,34 @@
inline
bool predicate(const Image<I>& lhs_, const Image<J>& rhs_, const
Function_vv2b<F>& f)
{
+ trace::entering("test::predicate");
+
const I& lhs = exact(lhs_);
const J& rhs = exact(rhs_);
internal::predicate_tests(lhs_, rhs_, f);
- return impl::predicate_(mln_trait_image_speed(I)(),
+ bool res = impl::predicate_(mln_trait_image_speed(I)(),
mln_trait_image_speed(J)(),
lhs, rhs,
exact(f));
+
+ trace::exiting("test::predicate");
+ return res;
}
template <typename S, typename F>
inline
bool predicate(const Site_Set<S>& pset, const Function_p2b<F>&
f)
{
+ trace::entering("test::predicate");
+
internal::predicate_tests(pset, f);
- return impl::predicate_(exact(pset), exact(f));
+
+ bool res = impl::predicate_(exact(pset), exact(f));
+
+ trace::exiting("test::predicate");
+ return res;
}
# endif // ! MLN_INCLUDE_ONLY
Index: tests/level/compare.cc
--- tests/level/compare.cc (revision 3524)
+++ tests/level/compare.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/compare.cc
- *
- * \brief Tests on mln::level::compare.
- */
+/// \file tests/level/compare.cc
+///
+/// Tests on mln::level::compare.
#include <mln/core/image/image2d.hh>
#include <mln/level/compare.hh>