
* mln/core/dpsites_piter.hh, * mln/core/image/graph_window_if_piter.hh, * mln/win/multiple_size.hh: Add missing init_ member. * mln/core/mixed_neighb.hh: Fix invalid constructor declarations. * mln/core/image/graph_window_piter.hh: Add comments. * mln/core/internal/neighb_niter_base.hh: Add missing includes. * mln/fun/i2v/array.hh: Add operator<<. --- milena/ChangeLog | 16 ++++++++++++++ milena/mln/core/dpsites_piter.hh | 14 ++++++++++++ milena/mln/core/image/graph_window_if_piter.hh | 16 +++++++++++++- milena/mln/core/image/graph_window_piter.hh | 6 +++++ milena/mln/core/internal/neighb_niter_base.hh | 3 ++ milena/mln/core/mixed_neighb.hh | 9 ++++++- milena/mln/fun/i2v/array.hh | 26 ++++++++++++++++++++++++ milena/mln/win/multiple_size.hh | 13 ++++++++++++ 8 files changed, 100 insertions(+), 3 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 4a7d67e..789fd82 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,19 @@ +2009-08-26 Guillaume Lazzara <lazzara@lrde.epita.fr> + + Small fixes. + + * mln/core/dpsites_piter.hh, + * mln/core/image/graph_window_if_piter.hh, + * mln/win/multiple_size.hh: Add missing init_ member. + + * mln/core/mixed_neighb.hh: Fix invalid constructor declarations. + + * mln/core/image/graph_window_piter.hh: Add comments. + + * mln/core/internal/neighb_niter_base.hh: Add missing includes. + + * mln/fun/i2v/array.hh: Add operator<<. + 2009-08-24 Guillaume Lazzara <lazzara@lrde.epita.fr> Regen mk files. diff --git a/milena/mln/core/dpsites_piter.hh b/milena/mln/core/dpsites_piter.hh index 970fe0e..0bbb0f5 100644 --- a/milena/mln/core/dpsites_piter.hh +++ b/milena/mln/core/dpsites_piter.hh @@ -106,6 +106,10 @@ namespace mln /// Constructor without argument. dpsites_bkd_piter(); + /// Delayed initialization. + template <typename P> + void init_(const V& v, const P& c); + /// Test the iterator validity. bool is_valid_() const; @@ -212,10 +216,20 @@ namespace mln inline dpsites_bkd_piter<V>::dpsites_bkd_piter(const V& v, const P& c) { + init_(v, c); + } + + template <typename V> + template <typename P> + inline + void + dpsites_bkd_piter<V>::init_(const V& v, const P& c) + { this->change_target(v); this->center_at(c); } + template <typename V> inline bool diff --git a/milena/mln/core/image/graph_window_if_piter.hh b/milena/mln/core/image/graph_window_if_piter.hh index 070bccc..d872853 100644 --- a/milena/mln/core/image/graph_window_if_piter.hh +++ b/milena/mln/core/image/graph_window_if_piter.hh @@ -65,9 +65,13 @@ namespace mln graph_window_if_piter(); template <typename Pref> graph_window_if_piter(const Window<W>& win, - const Pref& p_ref); + const Pref& p_ref); /// \} + /// Delayed initialization. + template <typename Pref> + void init_(const Window<W>& win, const Pref& p_ref); + /// Manipulation. /// \{ /// Test if the iterator is valid. @@ -125,6 +129,16 @@ namespace mln graph_window_if_piter<S,W,I>::graph_window_if_piter(const Window<W>& win, const Pref& p_ref) { + init_(win, p_ref); + } + + template <typename S, typename W, typename I> + template <typename Pref> + inline + void + graph_window_if_piter<S,W,I>::init_(const Window<W>& win, + const Pref& p_ref) + { this->center_at(p_ref); this->change_target(exact(win)); diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh index 8ea77db..1b4ab7a 100644 --- a/milena/mln/core/image/graph_window_piter.hh +++ b/milena/mln/core/image/graph_window_piter.hh @@ -207,7 +207,13 @@ namespace mln unsigned id() const; /// \} + /// Change the target site set. + /// Window elements different from the center come from the target + /// site set. void change_target_site_set(const S& s); + /// Return the target site set. + /// Window elements different from the center come from the target + /// site set. const S& target_site_set() const; using super_impl_::do_start_; diff --git a/milena/mln/core/internal/neighb_niter_base.hh b/milena/mln/core/internal/neighb_niter_base.hh index 6aba054..27459b6 100644 --- a/milena/mln/core/internal/neighb_niter_base.hh +++ b/milena/mln/core/internal/neighb_niter_base.hh @@ -30,6 +30,9 @@ /// /// Base implementation for neighborhood iterators. +# include <mln/core/internal/site_relative_iterator_base.hh> +# include <mln/core/internal/neighb_niter_impl.hh> + namespace mln { diff --git a/milena/mln/core/mixed_neighb.hh b/milena/mln/core/mixed_neighb.hh index 377bab1..7789aba 100644 --- a/milena/mln/core/mixed_neighb.hh +++ b/milena/mln/core/mixed_neighb.hh @@ -37,6 +37,7 @@ /// \todo See if the impl of from_to is fine. What about removing the /// origin? etc. +# include <mln/core/neighb.hh> # include <mln/core/internal/neighb_base.hh> # include <mln/core/internal/neighb_niter_base.hh> # include <mln/core/internal/site_relative_iterator_base.hh> @@ -117,7 +118,9 @@ namespace mln mixed_neighb_fwd_niter(); template <typename P> - mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh, const P& c); + mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh, + const mln_target(W)& nbh_site_set, + const P& c); }; @@ -138,7 +141,9 @@ namespace mln mixed_neighb_bkd_niter(); template <typename P> - mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh, const P& c); + mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh, + const mln_target(W)& nbh_site_set, + const P& c); }; diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh index ed4a379..b7175c9 100644 --- a/milena/mln/fun/i2v/array.hh +++ b/milena/mln/fun/i2v/array.hh @@ -151,6 +151,13 @@ namespace mln }; + + /// Operator<<. + template <typename T> + std::ostream& operator<<(std::ostream& ostr, + const array<T>& a); + + } // end of namespace mln::fun::i2v } // end of namespace mln::fun @@ -340,6 +347,25 @@ namespace mln } + // Operator <<. + + template <typename T> + std::ostream& operator<<(std::ostream& ostr, + const array<T>& a) + { + ostr << '('; + const unsigned n = a.nelements(); + for (unsigned i = 0; i < n; ++i) + { + ostr << a[i]; + if (i != n - 1) + ostr << ", "; + } + ostr << ')'; + return ostr; + } + + } // end of namespace mln::fun::i2v } // end of namespace mln::fun diff --git a/milena/mln/win/multiple_size.hh b/milena/mln/win/multiple_size.hh index 7d4390e..1edb325 100644 --- a/milena/mln/win/multiple_size.hh +++ b/milena/mln/win/multiple_size.hh @@ -145,6 +145,9 @@ namespace mln template <typename P> multiple_size_qiter(const multiple_size<n,W,F>& w, const P& c); + template <typename P> + void init_(const multiple_size<n,W,F>& w, const P& c); + /// Test the iterator validity. bool is_valid_() const; @@ -312,12 +315,22 @@ namespace mln inline multiple_size_qiter<n,W,F>::multiple_size_qiter(const multiple_size<n,W,F>& w, const P& c) { + init_(w, c); + } + + template <unsigned n, typename W, typename F> + template <typename P> + inline + void + multiple_size_qiter<n,W,F>::init_(const multiple_size<n,W,F>& w, const P& c) + { this->center_at(c); // We have to first change the center so that 'invalidate' can // work when changing the target. this->change_target(w); } + template <unsigned n, typename W, typename F> inline bool -- 1.5.6.5
participants (1)
-
Guillaume Lazzara