* mln/world/k1/immerse_with.hh,
* mln/world/k1/un_immerse.hh,
* mln/world/kn/display_enlarged.hh,
* mln/world/kn/fill_0_1_faces_internal_border.hh: Avoid the use of
exact() in preconditions.
* mln/world/kn/accu/max_interval.hh
* mln/world/kn/accu/min_interval.hh: Improve comments.
---
milena/ChangeLog | 13 +++++++++++++
milena/mln/world/k1/immerse_with.hh | 3 ++-
milena/mln/world/k1/un_immerse.hh | 4 ++--
milena/mln/world/kn/accu/max_interval.hh | 6 +++---
milena/mln/world/kn/accu/min_interval.hh | 7 ++++---
milena/mln/world/kn/display_enlarged.hh | 13 +++++++------
.../mln/world/kn/fill_0_1_faces_internal_border.hh | 2 +-
7 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d0db77e..addbfff 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,18 @@
2012-11-01 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Revamp Code.
+
+ * mln/world/k1/immerse_with.hh,
+ * mln/world/k1/un_immerse.hh,
+ * mln/world/kn/display_enlarged.hh,
+ * mln/world/kn/fill_0_1_faces_internal_border.hh: Avoid the use of
+ exact() in preconditions.
+
+ * mln/world/kn/accu/max_interval.hh
+ * mln/world/kn/accu/min_interval.hh: Improve comments.
+
+2012-11-01 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Make use of safe_cast.
* mln/world/k1/fill_0_from_1_faces.hh,
diff --git a/milena/mln/world/k1/immerse_with.hh b/milena/mln/world/k1/immerse_with.hh
index aa9658b..1e3fd5d 100644
--- a/milena/mln/world/k1/immerse_with.hh
+++ b/milena/mln/world/k1/immerse_with.hh
@@ -125,7 +125,6 @@ namespace mln
const Function_vvvv2v<F4>& f_0faces_)
{
trace::entering("mln::world::k1::immerse_with");
- mln_precondition(exact(ima_).is_valid());
// FIXME: we cannot write that test because we rely on
// safe_convert. So, even though some types may not
@@ -138,6 +137,8 @@ namespace mln
const F2& f_1faces = exact(f_1faces_);
const F4& f_0faces = exact(f_0faces_);
+ mln_precondition(ima.is_valid());
+
mln_ch_value(I,V) output = k1::immerse(ima, new_value_type, default_value);
k1::fill_1_from_2_faces(output, f_1faces);
k1::fill_0_from_1_faces(output, f_0faces);
diff --git a/milena/mln/world/k1/un_immerse.hh b/milena/mln/world/k1/un_immerse.hh
index 767e4f5..8c352ca 100644
--- a/milena/mln/world/k1/un_immerse.hh
+++ b/milena/mln/world/k1/un_immerse.hh
@@ -76,8 +76,8 @@ namespace mln
un_immerse(const Image<I>& ima_, const V& new_value_type)
{
trace::entering("mln::world::k1::un_immerse");
- mln_precondition(exact(ima_).is_valid());
const I& ima = exact(ima_);
+ mln_precondition(ima.is_valid());
mln_ch_value(I,V) output = kn::un_immerse(ima, 2, new_value_type);
@@ -91,8 +91,8 @@ namespace mln
un_immerse(const Image<I>& ima_)
{
trace::entering("mln::world::k1::un_immerse");
- mln_precondition(exact(ima_).is_valid());
const I& ima = exact(ima_);
+ mln_precondition(ima.is_valid());
mln_concrete(I) output = kn::un_immerse(ima, 1);
diff --git a/milena/mln/world/kn/accu/max_interval.hh
b/milena/mln/world/kn/accu/max_interval.hh
index 8d49932..e53be7e 100644
--- a/milena/mln/world/kn/accu/max_interval.hh
+++ b/milena/mln/world/kn/accu/max_interval.hh
@@ -28,7 +28,7 @@
/// \file
///
-/// \brief Define an accumulator that computes a max on a specific
+/// \brief Maximum accumulator restricted to a specific
/// interval.
# include <mln/core/concept/meta_accumulator.hh>
@@ -78,8 +78,8 @@ namespace mln
namespace accu
{
- /// \brief Minimum accumulator restricted to a specific
- /// interval.
+ /// \brief Maximum accumulator restricted to a specific
+ /// interval.
///
/// The parameter \c T is the type of values.
///
diff --git a/milena/mln/world/kn/accu/min_interval.hh
b/milena/mln/world/kn/accu/min_interval.hh
index df6120d..7081a07 100644
--- a/milena/mln/world/kn/accu/min_interval.hh
+++ b/milena/mln/world/kn/accu/min_interval.hh
@@ -28,7 +28,8 @@
/// \file
///
-/// Define an accumulator that computes a min on a specific interval.
+/// \brief An accumulator that computes a min within specific
+/// interval.
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
@@ -76,8 +77,8 @@ namespace mln
namespace accu
{
- /// \brief Minimum accumulator restricted to a specific
- /// interval.
+ /// \brief An accumulator that computes a min within specific
+ /// interval.
/*!
* The parameter \c T is the type of values.
*
diff --git a/milena/mln/world/kn/display_enlarged.hh
b/milena/mln/world/kn/display_enlarged.hh
index e1b122a..00e3f24 100644
--- a/milena/mln/world/kn/display_enlarged.hh
+++ b/milena/mln/world/kn/display_enlarged.hh
@@ -89,10 +89,10 @@ namespace mln
{
trace::entering("mln::world::kn::display_enlarged");
- mln_precondition(exact(ima_kn_).is_valid());
+ const I& ima_kn = exact(ima_kn_);
+ mln_precondition(ima_kn.is_valid());
mln_assertion(zoom_ % 2);
- const I& ima_kn = exact(ima_kn_);
int
shift = zoom_ + 1,
mult = shift / 2;
@@ -101,10 +101,11 @@ namespace mln
if (zoom_ == 1)
return duplicate(ima_kn);
- mln_concrete(I) output(make::box2d(ima_kn.domain().pmin().row() * mult,
- ima_kn.domain().pmin().col() * mult,
- ima_kn.domain().pmax().row() * mult,
- ima_kn.domain().pmax().col() * mult));
+ mln_concrete(I)
+ output(make::box2d(ima_kn.domain().pmin().row() * mult,
+ ima_kn.domain().pmin().col() * mult,
+ ima_kn.domain().pmax().row() * mult,
+ ima_kn.domain().pmax().col() * mult));
const mln::def::coord
min_row = geom::min_row(ima_kn),
diff --git a/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
b/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
index 915a69a..f991ecb 100644
--- a/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
+++ b/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
@@ -74,8 +74,8 @@ namespace mln
{
trace::entering("mln::world::kn::fill_0_1_faces_internal_border");
- mln_precondition(exact(inout_).is_valid());
I& inout = exact(inout_);
+ mln_precondition(inout.is_valid());
inner_border::fill(inout, v);
--
1.7.2.5