27 #ifndef MLN_CORE_INTERNAL_SITE_RELATIVE_ITERATOR_BASE_HH
28 # define MLN_CORE_INTERNAL_SITE_RELATIVE_ITERATOR_BASE_HH
40 # include <mln/core/internal/site_iterator_base.hh>
41 # include <mln/metal/converts_to.hh>
61 template <
typename S,
typename E,
typename C = mln_psite(S)>
93 const mln_psite(S)&
subj_();
96 const mln_psite(S)&
p_hook_()
const;
119 template <
typename P>
120 void center_at_(
const P& c);
128 # ifndef MLN_INCLUDE_ONLY
130 template <
typename S,
typename E,
typename C>
135 void (E::*m1)() = & E::do_start_;
137 void (E::*m2)() = & E::do_next_;
139 mln_psite(S) (E::*m3)()
const = & E::compute_p_;
143 template <
typename S,
typename E,
typename C>
144 template <
typename P>
149 mlc_converts_to(P,
const C&)::check();
150 c_ = &
static_cast< const C&
>(c);
151 exact(
this)->center_at_(c);
155 template <
typename S,
typename E,
typename C>
158 site_relative_iterator_base<S,E,C>::start_()
160 exact(
this)->do_start_();
161 if (this->is_valid())
162 p_ =
exact(
this)->compute_p_();
165 template <
typename S,
typename E,
typename C>
168 site_relative_iterator_base<S,E,C>::next_()
170 exact(
this)->do_next_();
171 if (this->is_valid())
172 p_ = exact(
this)->compute_p_();
175 template <
typename S,
typename E,
typename C>
178 site_relative_iterator_base<S,E,C>::center()
const
180 mln_precondition(c_ != 0);
184 template <
typename S,
typename E,
typename C>
189 mln_precondition(this->s_ != 0);
193 template <
typename S,
typename E,
typename C>
196 site_relative_iterator_base<S,E,C>::subj_()
199 mln_assertion(!this->is_valid() ||
exact(
this)->compute_p_() == p_);
203 template <
typename S,
typename E,
typename C>
206 site_relative_iterator_base<S,E,C>::p_hook_()
const
211 template <
typename S,
typename E,
typename C>
214 site_relative_iterator_base<S,E,C>::change_target(
const S& s)
219 if_possible::change_target(p_, s);
224 template <
typename S,
typename E,
typename C>
229 mln_precondition(this->s_ && c_);
230 p_ =
exact(
this)->compute_p_();
231 mln_postcondition(this->is_valid());
235 template <
typename S,
typename E,
typename C>
236 template <
typename P>
239 site_relative_iterator_base<S,E,C>::center_at_(
const P&)
244 # endif // ! MLN_INCLUDE_ONLY
251 #endif // ! MLN_CORE_INTERNAL_SITE_RELATIVE_ITERATOR_BASE_HH