26 #ifndef MLN_VALUE_VITER_HH
27 # define MLN_VALUE_VITER_HH
36 # include <mln/core/concept/value_iterator.hh>
37 # include <mln/core/concept/value_set.hh>
52 struct fwd_viter_ :
public Value_Iterator< fwd_viter_<S> >
55 typedef mln_value(S) value;
61 fwd_viter_(const Value_Set<S>& s);
63 void change_target(const S& s);
66 bool is_valid() const;
78 operator mln_value(S) () const;
81 unsigned index_() const;
97 struct bkd_viter_ : public Value_Iterator< bkd_viter_<S> >
100 typedef mln_value(S) value;
106 bkd_viter_(const Value_Set<S>& s);
108 void change_target(const S& s);
111 bool is_valid() const;
123 operator mln_value(S) () const;
126 unsigned index_() const;
136 # ifndef MLN_INCLUDE_ONLY
141 template <
typename S>
143 fwd_viter_<S>::fwd_viter_()
148 template <
typename S>
150 fwd_viter_<S>::fwd_viter_(
const Value_Set<S>& s)
152 change_target(exact(s));
155 template <
typename S>
158 fwd_viter_<S>::change_target(
const S& s)
164 template <
typename S>
167 fwd_viter_<S>::is_valid()
const
169 return s_ != 0 && i_ < s_->nvalues();
172 template <
typename S>
175 fwd_viter_<S>::invalidate()
180 template <
typename S>
183 fwd_viter_<S>::start()
188 template <
typename S>
191 fwd_viter_<S>::next_()
196 template <
typename S>
198 fwd_viter_<S>::operator mln_value(S) ()
const
200 mln_precondition(is_valid());
204 template <
typename S>
207 fwd_viter_<S>::index_()
const
215 template <
typename S>
217 bkd_viter_<S>::bkd_viter_()
222 template <
typename S>
224 bkd_viter_<S>::bkd_viter_(
const Value_Set<S>& s)
226 change_target(exact(s));
229 template <
typename S>
232 bkd_viter_<S>::change_target(
const S& s)
238 template <
typename S>
241 bkd_viter_<S>::is_valid()
const
243 return s_ != 0 && i_ != s_->nvalues();
246 template <
typename S>
249 bkd_viter_<S>::invalidate()
254 template <
typename S>
257 bkd_viter_<S>::start()
259 i_ = s_->nvalues() - 1;
262 template <
typename S>
265 bkd_viter_<S>::next_()
275 template <
typename S>
277 bkd_viter_<S>::operator mln_value(S) ()
const
279 mln_precondition(is_valid());
283 template <
typename S>
286 bkd_viter_<S>::index_()
const
291 # endif // ! MLN_INCLUDE_ONLY
298 #endif // ! MLN_VALUE_VITER_HH