* mln/core/image/complex_neighborhood_piter.hh
(complex_window_fwd_piter<I, G, W>::init_)
(complex_window_bkd_piter<I, G, W>::init_):
s/center_at/this->center_at/
Misc. documentation changes.
* mln/core/image/complex_window_piter.hh
(complex_neighborhood_fwd_piter(const Neighborhood<N>&, const Pref&))
(complex_neighborhood_bkd_piter(const Neighborhood<N>&, const Pref&)):
Move the initializations...
(complex_neighborhood_fwd_piter<I, G, N>::init_)
(complex_neighborhood_bkd_piter<I, G, N>::init_):
...here (new method).
Misc. documentation changes.
---
milena/ChangeLog | 18 +++++++
.../mln/core/image/complex_neighborhood_piter.hh | 49 +++++++++++++++----
milena/mln/core/image/complex_window_piter.hh | 17 +++----
3 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index b19c004..b420d56 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2009-09-29 Roland Levillain <roland(a)lrde.epita.fr>
+ Make complex window and complex neighborhood piters symmetric.
+
+ * mln/core/image/complex_neighborhood_piter.hh
+ (complex_window_fwd_piter<I, G, W>::init_)
+ (complex_window_bkd_piter<I, G, W>::init_):
+ s/center_at/this->center_at/
+ Misc. documentation changes.
+ * mln/core/image/complex_window_piter.hh
+ (complex_neighborhood_fwd_piter(const Neighborhood<N>&, const Pref&))
+ (complex_neighborhood_bkd_piter(const Neighborhood<N>&, const Pref&)):
+ Move the initializations...
+ (complex_neighborhood_fwd_piter<I, G, N>::init_)
+ (complex_neighborhood_bkd_piter<I, G, N>::init_):
+ ...here (new method).
+ Misc. documentation changes.
+
+2009-09-29 Roland Levillain <roland(a)lrde.epita.fr>
+
Have complex neighborhoods depend on complex windows.
* mln/core/internal/complex_neighborhood_base.hh
diff --git a/milena/mln/core/image/complex_neighborhood_piter.hh
b/milena/mln/core/image/complex_neighborhood_piter.hh
index 04e0626..6298aac 100644
--- a/milena/mln/core/image/complex_neighborhood_piter.hh
+++ b/milena/mln/core/image/complex_neighborhood_piter.hh
@@ -27,7 +27,6 @@
# define MLN_CORE_IMAGE_COMPLEX_NEIGHBORHOOD_PITER_HH
/// \file
-///
/// Definition of a site iterator on a complex neighborhood.
# include <mln/core/concept/neighborhood.hh>
@@ -36,10 +35,10 @@
// FIXME: These might be factor-able, both between fwd/bkd and nbh/win.
/* FIXME: Do we really want to inherit from
- internal::site_relative_iterator_base? I might duplicate things,
+ internal::site_relative_iterator_base? It might duplicate things,
since most of the implementation of this iterator is delegated to
- the underlying complex iter. Moreover, change_target_() is
- useless. Think about introducing base class replacement. */
+ the underlying complex iter. Think about introducing base class
+ replacement. */
namespace mln
@@ -49,7 +48,7 @@ namespace mln
| complex_neighborhood_fwd_piter<I, G, N>. |
`------------------------------------------*/
- /// Forward iterator on complex neighborhood.
+ /// \brief Forward iterator on complex neighborhood.
template <typename I, typename G, typename N>
class complex_neighborhood_fwd_piter
: public internal::site_relative_iterator_base< N,
@@ -73,6 +72,10 @@ namespace mln
const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ template <typename Pref>
+ void init_(const Neighborhood<N>& nbh, const Pref& p_ref);
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -85,7 +88,7 @@ namespace mln
/// Go to the next site.
void do_next_();
- /// Set the reference psite.
+ /// Additional work while setting the reference site.
template <typename Pref>
void center_at_(const Pref& c);
@@ -93,7 +96,7 @@ namespace mln
psite compute_p_() const;
/// \}
- /// Accessors.
+ /// \brief Accessors.
/// \{
const iter_type& iter() const;
iter_type& iter();
@@ -116,7 +119,7 @@ namespace mln
| complex_neighborhood_bkd_piter<I, G, N>. |
`------------------------------------------*/
- /// Backward iterator on complex neighborhood.
+ /// \brief Backward iterator on complex neighborhood.
template <typename I, typename G, typename N>
class complex_neighborhood_bkd_piter
: public internal::site_relative_iterator_base< N,
@@ -140,6 +143,10 @@ namespace mln
const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ template <typename Pref>
+ void init_(const Neighborhood<N>& nbh, const Pref& p_ref);
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -152,15 +159,15 @@ namespace mln
/// Go to the next site.
void do_next_();
- /// Do some work while setting the reference site.
+ /// Additional work while setting the reference site.
template <typename Pref>
- void center_at_(const Pref&);
+ void center_at_(const Pref& c);
/// Compute the current psite.
psite compute_p_() const;
/// \}
- /// Accessors.
+ /// \brief Accessors.
/// \{
const iter_type& iter() const;
iter_type& iter();
@@ -198,6 +205,16 @@ namespace mln
complex_neighborhood_fwd_piter<I, G, N>::complex_neighborhood_fwd_piter(const
Neighborhood<N>& nbh,
const Pref& p_ref)
{
+ init_(nbh, p_ref);
+ }
+
+ template <typename I, typename G, typename N>
+ template <typename Pref>
+ inline
+ void
+ complex_neighborhood_fwd_piter<I, G, N>::init_(const Neighborhood<N>&
nbh,
+ const Pref& p_ref)
+ {
this->change_target(exact(nbh));
this->center_at(p_ref);
mln_postcondition(!this->is_valid());
@@ -295,6 +312,16 @@ namespace mln
complex_neighborhood_bkd_piter<I, G, N>::complex_neighborhood_bkd_piter(const
Neighborhood<N>& nbh,
const Pref& p_ref)
{
+ init_(nbh, p_ref);
+ }
+
+ template <typename I, typename G, typename N>
+ template <typename Pref>
+ inline
+ void
+ complex_neighborhood_bkd_piter<I, G, N>::init_(const Neighborhood<N>&
nbh,
+ const Pref& p_ref)
+ {
this->change_target(exact(nbh));
this->center_at(p_ref);
mln_postcondition(!this->is_valid());
diff --git a/milena/mln/core/image/complex_window_piter.hh
b/milena/mln/core/image/complex_window_piter.hh
index b723ec6..8a54adb 100644
--- a/milena/mln/core/image/complex_window_piter.hh
+++ b/milena/mln/core/image/complex_window_piter.hh
@@ -29,17 +29,16 @@
/// \file
/// \brief Definition of a site iterator on a complex window.
+# include <mln/core/concept/window.hh>
# include <mln/core/internal/site_relative_iterator_base.hh>
// FIXME: These might be factor-able, both between fwd/bkd and nbh/win.
/* FIXME: Do we really want to inherit from
- internal::site_relative_iterator_base? I might duplicate things,
+ internal::site_relative_iterator_base? It might duplicate things,
since most of the implementation of this iterator is delegated to
- the underlying complex iter. Moreover, change_target_() is
- useless, and center_at() ``hides'' an existing method in (one of)
- the super class(es) which is not sound, IMHO. Think about
- introducing base class replacement. */
+ the underlying complex iter. Think about introducing base class
+ replacement. */
namespace mln
@@ -88,7 +87,7 @@ namespace mln
/// Go to the next site.
void do_next_();
- /// Do some work while setting the reference site.
+ /// Additional work while setting the reference site.
template <typename Pref>
void center_at_(const Pref& c);
@@ -158,7 +157,7 @@ namespace mln
/// Go to the next site.
void do_next_();
- /// Do some work while setting the reference site.
+ /// Additional work while setting the reference site.
template <typename Pref>
void center_at_(const Pref& c);
@@ -215,7 +214,7 @@ namespace mln
const Pref& p_ref)
{
this->change_target(exact(win));
- center_at(p_ref);
+ this->center_at(p_ref);
mln_postcondition(!this->is_valid());
}
@@ -323,7 +322,7 @@ namespace mln
const Pref& p_ref)
{
this->change_target(exact(win));
- center_at(p_ref);
+ this->center_at(p_ref);
mln_postcondition(!this->is_valid());
}
--
1.6.3.1