* mln/accu/transform_diagonal.hh,
* mln/accu/transform_directional.hh,
* mln/accu/transform_snake.hh: fix wrong precondition.
* mln/core/concept/neighborhood.hh,
* mln/core/concept/window.hh: add static check to be sure the method
is present.
* mln/core/internal/complex_neighborhood_base.hh,
* mln/core/internal/complex_window_p_base.hh,
* mln/core/internal/graph_window_base.hh,
* mln/core/internal/weighted_window_base.hh: add missing is_valid.
---
milena/ChangeLog | 17 +++++++++++++++++
milena/mln/accu/transform_diagonal.hh | 2 +-
milena/mln/accu/transform_directional.hh | 2 +-
milena/mln/accu/transform_snake.hh | 2 +-
milena/mln/core/concept/neighborhood.hh | 3 +++
milena/mln/core/concept/window.hh | 2 ++
.../mln/core/internal/complex_neighborhood_base.hh | 11 +++++++++++
milena/mln/core/internal/complex_window_p_base.hh | 12 +++++++++++-
milena/mln/core/internal/graph_window_base.hh | 12 ++++++++++++
milena/mln/core/internal/weighted_window_base.hh | 13 ++++++++++++-
10 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index e6b8418..00edd1e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,22 @@
2009-02-05 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix missing is_valid() in complex and graph windows/neighborhoods.
+
+ * mln/accu/transform_diagonal.hh,
+ * mln/accu/transform_directional.hh,
+ * mln/accu/transform_snake.hh: fix wrong precondition.
+
+ * mln/core/concept/neighborhood.hh,
+ * mln/core/concept/window.hh: add static check to be sure the method
+ is present.
+
+ * mln/core/internal/complex_neighborhood_base.hh,
+ * mln/core/internal/complex_window_p_base.hh,
+ * mln/core/internal/graph_window_base.hh,
+ * mln/core/internal/weighted_window_base.hh: add missing is_valid.
+
+2009-02-05 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add new ICP variants.
* mln/registration/icp2.hh: Add two new variants.
diff --git a/milena/mln/accu/transform_diagonal.hh
b/milena/mln/accu/transform_diagonal.hh
index c8788e6..db29cc7 100644
--- a/milena/mln/accu/transform_diagonal.hh
+++ b/milena/mln/accu/transform_diagonal.hh
@@ -90,8 +90,8 @@ namespace mln
const W& win = exact(win_);
mln_precondition(input.is_valid());
+ mln_precondition(win.is_valid());
mln_precondition(! win.is_empty());
- mln_precondition(! win.is_valid());
(void) input;
(void) win;
diff --git a/milena/mln/accu/transform_directional.hh
b/milena/mln/accu/transform_directional.hh
index 6a78fcd..e8a4dd1 100644
--- a/milena/mln/accu/transform_directional.hh
+++ b/milena/mln/accu/transform_directional.hh
@@ -88,8 +88,8 @@ namespace mln
const W& win = exact(win_);
mln_precondition(input.is_valid());
+ mln_precondition(win.is_valid());
mln_precondition(! win.is_empty());
- mln_precondition(! win.is_valid());
(void) input;
(void) win;
diff --git a/milena/mln/accu/transform_snake.hh b/milena/mln/accu/transform_snake.hh
index 98bcf93..88b6361 100644
--- a/milena/mln/accu/transform_snake.hh
+++ b/milena/mln/accu/transform_snake.hh
@@ -83,8 +83,8 @@ namespace mln
const W& win = exact(win_);
mln_precondition(input.is_valid());
+ mln_precondition(win.is_valid());
mln_precondition(! win.is_empty());
- mln_precondition(! win.is_valid());
(void) input;
(void) win;
diff --git a/milena/mln/core/concept/neighborhood.hh
b/milena/mln/core/concept/neighborhood.hh
index 5547865..5a69b12 100644
--- a/milena/mln/core/concept/neighborhood.hh
+++ b/milena/mln/core/concept/neighborhood.hh
@@ -117,6 +117,9 @@ namespace mln
typedef mln_window(E) window;
bool m = (& E::win) == (& E::win);
m = 0;
+ bool (E::*m2)() const = &E::is_valid;
+ m2 = 0;
+
# if 0
/* FIXME: Disabled, as win() can either return a const reference
or a copy of the window (see documentation above). Hence the
diff --git a/milena/mln/core/concept/window.hh b/milena/mln/core/concept/window.hh
index 64b05fe..8b1a55c 100644
--- a/milena/mln/core/concept/window.hh
+++ b/milena/mln/core/concept/window.hh
@@ -185,6 +185,8 @@ namespace mln
m3 = 0;
unsigned (E::*m4)() const = &E::delta;
m4 = 0;
+ bool (E::*m5)() const = &E::is_valid;
+ m5 = 0;
}
static void run(mln::trait::window::definition::unique)
diff --git a/milena/mln/core/internal/complex_neighborhood_base.hh
b/milena/mln/core/internal/complex_neighborhood_base.hh
index 231170b..c1bde4e 100644
--- a/milena/mln/core/internal/complex_neighborhood_base.hh
+++ b/milena/mln/core/internal/complex_neighborhood_base.hh
@@ -105,6 +105,9 @@ namespace mln
/// Create a window corresponding to this neighborhood.
const window& win() const;
/// \}
+
+ /// Return true by default.
+ bool is_valid() const;
};
@@ -122,6 +125,14 @@ namespace mln
return exact(*this);
}
+ template <unsigned D, typename G, typename F, typename B, typename E>
+ inline
+ bool
+ complex_neighborhood_base<D, G, F, B, E>::is_valid() const
+ {
+ return true;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
diff --git a/milena/mln/core/internal/complex_window_p_base.hh
b/milena/mln/core/internal/complex_window_p_base.hh
index efc6ea9..21540ba 100644
--- a/milena/mln/core/internal/complex_window_p_base.hh
+++ b/milena/mln/core/internal/complex_window_p_base.hh
@@ -137,6 +137,9 @@ namespace mln
bool is_empty() const;
/// Is this window centered? (Always returns \c true).
bool is_centered() const;
+
+ /// Return true by default.
+ bool is_valid() const;
/// \}
};
@@ -158,8 +161,15 @@ namespace mln
return true;
}
+ template <unsigned D, typename G, typename F, typename B, typename E>
+ bool
+ complex_window_p_base<D, G, F, B, E>::is_valid() const
+ {
+ return true;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
-
+
} // end of namespace mln::internal
} // end of namespace mln
diff --git a/milena/mln/core/internal/graph_window_base.hh
b/milena/mln/core/internal/graph_window_base.hh
index 8af7d65..3883c8a 100644
--- a/milena/mln/core/internal/graph_window_base.hh
+++ b/milena/mln/core/internal/graph_window_base.hh
@@ -82,6 +82,9 @@ namespace mln
bool is_neighbable_() const;
/// \}
+ /// Return true by default.
+ bool is_valid() const;
+
protected:
graph_window_base();
};
@@ -146,6 +149,15 @@ namespace mln
return true;
}
+ template <typename P, typename E>
+ inline
+ bool
+ graph_window_base<P,E>::is_valid() const
+ {
+ return true;
+ }
+
+
# endif // !MLN_INCLUDE_ONLY
diff --git a/milena/mln/core/internal/weighted_window_base.hh
b/milena/mln/core/internal/weighted_window_base.hh
index f633a53..a0380a5 100644
--- a/milena/mln/core/internal/weighted_window_base.hh
+++ b/milena/mln/core/internal/weighted_window_base.hh
@@ -88,6 +88,9 @@ namespace mln
/// the definition is unique.
bool has(const mln_dpsite(W)& dp) const;
+ /// return true by default.
+ bool is_valid() const;
+
protected:
weighted_window_base();
};
@@ -155,7 +158,7 @@ namespace mln
mln_precondition(i < this->size());
return exact(this)->win().dp(i);
}
-
+
template <typename W, typename E>
inline
bool
@@ -168,6 +171,14 @@ namespace mln
return exact(this)->win().has(dp);
}
+ template <typename W, typename E>
+ inline
+ bool
+ weighted_window_base<W,E>::is_valid() const
+ {
+ return true;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
--
1.5.6.5