27 #ifndef MLN_CORE_IMAGE_GRAPH_WINDOW_PITER_HH
28 # define MLN_CORE_IMAGE_GRAPH_WINDOW_PITER_HH
37 # include <mln/core/concept/site_set.hh>
38 # include <mln/core/concept/window.hh>
39 # include <mln/core/internal/site_relative_iterator_base.hh>
46 template <
typename S,
typename I>
class p_graph_piter;
54 template <
typename C,
typename P,
typename E>
59 internal::force_exact<E>(*this).iter_.start();
68 template <
typename C,
typename E>
69 struct impl_selector<C,C,E>
73 E& this_ = internal::force_exact<E>(*this);
84 this_.change_target_site_set(this_.center().site_set());
98 template <
typename S,
typename W,
typename I>
100 :
public internal::site_relative_iterator_base< W,
101 graph_window_piter<S,W,I>,
102 typename W::center_t >,
103 public internal::impl_selector<typename W::center_t, mln_psite(W),
104 graph_window_piter<S,W,I> >
108 internal::site_relative_iterator_base<W,self_,mln_psite(S)> super_;
110 internal::impl_selector<
typename W::center_t, mln_psite(W),
118 typedef mln_result(S::fun_t)
P;
141 template <typename Pref>
153 template <typename Pref>
161 template <typename Pref>
162 void init_(const
Window<W>& win, const Pref& p_ref);
164 template <typename Pref>
165 void init_(const
Window<W>& win,
173 bool is_valid_() const;
181 template <typename Pref>
182 void center_at_(const Pref& c);
185 template <typename S2, typename I2>
189 const graph_element&
element() const;
192 mln_psite(W) compute_p_() const;
208 const S& target_site_set() const;
210 using super_impl_::do_start_;
212 friend struct internal::impl_selector<typename W::center_t, mln_psite(W),
221 # ifndef MLN_INCLUDE_ONLY
224 template <
typename S,
typename W,
typename I>
232 template <
typename S,
typename W,
typename I>
233 template <
typename Pref>
241 mlc_is(center_t, mln_psite(W))::check();
246 template <
typename S,
typename W,
typename I>
247 template <
typename Pref>
256 mlc_is_not(center_t, mln_psite(W))::check();
257 init_(win, target_site_set, p_ref);
260 template <
typename S,
typename W,
typename I>
261 template <
typename Pref>
267 this->center_at(p_ref);
268 this->change_target(exact(win));
270 mln_postcondition(!this->is_valid());
273 template <
typename S,
typename W,
typename I>
274 template <
typename Pref>
277 graph_window_piter<S,W,I>::init_(
const Window<W>& win,
278 const Site_Set<S>& target_site_set,
281 this->center_at(p_ref);
282 this->change_target(exact(win));
283 change_target_site_set(exact(target_site_set));
284 mln_postcondition(!this->is_valid());
288 template <
typename S,
typename W,
typename I>
291 graph_window_piter<S,W,I>::is_valid_()
const
293 return s_ != 0 && s_->is_valid() && iter_.is_valid();
296 template <
typename S,
typename W,
typename I>
299 graph_window_piter<S,W,I>::invalidate_()
304 template <
typename S,
typename W,
typename I>
307 graph_window_piter<S,W,I>::do_next_()
312 template <
typename S,
typename W,
typename I>
313 template <
typename Pref>
316 graph_window_piter<S, W, I>::center_at_(
const Pref& c)
318 iter_.center_at(c.p_hook_());
321 template <
typename S,
typename W,
typename I>
322 template <
typename S2,
typename I2>
325 graph_window_piter<S, W, I>::center_at_(
const p_graph_piter<S2, I2>& c)
327 iter_.center_at(c.hook_elt_());
330 template <
typename S,
typename W,
typename I>
333 graph_window_piter<S,W,I>::compute_p_()
const
335 return mln_psite(S)(target_site_set(), iter_.id());
338 template <
typename S,
typename W,
typename I>
340 const typename graph_window_piter<S,W,I>::graph_element&
346 template <
typename S,
typename W,
typename I>
354 template <
typename S,
typename W,
typename I>
360 mln_assertion(s_ != 0);
363 template <
typename S,
typename W,
typename I>
368 mln_precondition(s_ != 0);
369 mln_precondition(s_->is_valid());
374 # endif // ! MLN_INCLUDE_ONLY
378 #endif // ! MLN_CORE_IMAGE_GRAPH_WINDOW_PITER_HH