00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_AUTOMATA_CONCEPT_AUTOMATA_OPS_HXX
00018 # define VCSN_AUTOMATA_CONCEPT_AUTOMATA_OPS_HXX
00019
00020 # include <iterator>
00021 # include <set>
00022 # include <vaucanson/misc/random.hh>
00023 # include <vaucanson/misc/contract.hh>
00024 # include <vaucanson/algebra/concept/series_base.hh>
00025
00026 namespace vcsn {
00027
00028 #define AutoType(Type) \
00029 typename Element<S, T>::Type
00030
00031 template<typename S, typename T, typename U>
00032 void
00033 op_assign(const AutomataBase<S>& concept, T& dst, const U& src)
00034 {
00035 dst = op_convert(concept, dst, src);
00036 }
00037
00038 template<typename S, typename T>
00039 void
00040 op_assign(const AutomataBase<S>&, T& dst, const T& src)
00041 {
00042 dst = src;
00043 }
00044
00045 template<typename S, typename T>
00046 const T& op_convert(const AutomataBase<S>&,
00047 SELECTOR(T), const T& from_data)
00048 {
00049 return from_data;
00050 }
00051
00052 template<typename S, typename R, typename T>
00053 R op_convert(const AutomataBase<S>& concept,
00054 SELECTOR(R), const T& src)
00055 {
00056 typedef typename automaton_traits<R>::hstate_t dst_hstate_t;
00057 typedef typename automaton_traits<T>::hstate_t src_hstate_t;
00058 typedef typename automaton_traits<T>::transition_iterator transition_iterator;
00059 typedef typename automaton_traits<T>::final_iterator final_iterator;
00060 typedef typename automaton_traits<T>::initial_iterator initial_iterator;
00061 typedef typename automaton_traits<T>::state_iterator state_iterator;
00062
00063 R dst;
00064 std::map<src_hstate_t, dst_hstate_t> states_map;
00065
00066
00067 for (state_iterator s = op_states(concept, src).begin(),
00068 s_end = op_states(concept, src).end(); s != s_end; ++s)
00069 states_map[*s] = op_add_state(concept, dst);
00070
00071
00072 for (transition_iterator t = op_transitions(concept, src).begin(),
00073 t_end = op_transitions(concept, src).end(); t != t_end; ++t)
00074 op_add_series_transition(concept,
00075 dst,
00076 states_map[op_src_of(concept, src, *t)],
00077 states_map[op_dst_of(concept, src, *t)],
00078 op_label_of(concept, src, *t));
00079
00080
00081 for (initial_iterator i = op_initial(concept, src).begin(),
00082 i_end = op_initial(concept, src).end(); i != i_end; ++i)
00083 op_set_initial(concept,
00084 dst,
00085 states_map[*i],
00086 op_get_initial(concept, src, *i));
00087
00088
00089 for (final_iterator f = op_final(concept, src).begin(),
00090 f_end = op_final(concept, src).end(); f != f_end; ++f)
00091 op_set_final(concept,
00092 dst,
00093 states_map[*f],
00094 op_get_final(concept, src, *f));
00095
00096
00097
00098 return dst;
00099 }
00100
00101
00102 template <class S, class T>
00103 const typename automaton_traits<T>::tag_t&
00104 op_get_tag(const AutomataBase<S>&, const T& v)
00105 {
00106 return v.tag();
00107 }
00108
00109 template <class S, class T>
00110 typename automaton_traits<T>::tag_t&
00111 op_get_tag(const AutomataBase<S>&, T& v)
00112 {
00113 return v.tag();
00114 }
00115
00116 template <class S, class T>
00117 const typename automaton_traits<T>::geometry_t&
00118 op_get_geometry(const AutomataBase<S>&, const T& v)
00119 {
00120 return v.geometry();
00121 }
00122
00123 template <class S, class T>
00124 typename automaton_traits<T>::geometry_t&
00125 op_get_geometry(const AutomataBase<S>&, T& v)
00126 {
00127 return v.geometry();
00128 }
00129
00130 template <class S, class T>
00131 bool
00132 op_exists(const AutomataBase<S>& s, const T& v)
00133 {
00134 return v.exists(s);
00135 }
00136
00137 template <class S, class T>
00138 typename automaton_traits<T>::states_t
00139 op_states(const AutomataBase<S>&, const T& v)
00140 {
00141 return v.states();
00142 }
00143
00144 template <class S, class T>
00145 typename automaton_traits<T>::hstate_t
00146 op_get_state(const AutomataBase<S>&, const T& v, int state)
00147 {
00148 return v.get_state(state);
00149 }
00150
00151 template <class S, class T>
00152 typename automaton_traits<T>::transitions_t
00153 op_transitions(const AutomataBase<S>&, const T& v)
00154 {
00155 return v.edges();
00156 }
00157
00158 template <class S, class T>
00159 typename automaton_traits<T>::initial_support_t
00160 op_initial(const AutomataBase<S>&, const T& v)
00161 {
00162 return v.initial();
00163 }
00164
00165 template <class S, class T>
00166 typename automaton_traits<T>::final_support_t
00167 op_final(const AutomataBase<S>&, const T& v)
00168 {
00169 return v.final();
00170 }
00171
00172 template <class S, class T>
00173 void
00174 op_set_initial(const AutomataBase<S>& ss, T& v,
00175 const typename automaton_traits<T>::hstate_t& state,
00176 const AutoType(series_set_elt_t)& s)
00177 {
00178 typedef
00179 typename Element<S, T>::series_set_elt_value_t series_set_elt_value_t;
00180 v.set_initial(state,
00181 s.value(),
00182 zero_value(ss.series(),
00183 SELECT(series_set_elt_value_t)));
00184 }
00185
00186 template <class S, class T>
00187 typename Element<S, T>::series_set_elt_t
00188 op_get_initial(const AutomataBase<S>& s,
00189 const T& v,
00190 const typename automaton_traits<T>::hstate_t& state)
00191 {
00192 return typename Element<S, T>::series_set_elt_t
00193 (s.series(),
00194 v.get_initial(state,
00195 zero_value(s.series(),
00196 SELECT(AutoType(series_set_elt_value_t)))));
00197 }
00198
00199 template <class S, class T>
00200 bool
00201 op_is_initial(const AutomataBase<S>& s,
00202 const T& v,
00203 const typename automaton_traits<T>::hstate_t& state)
00204 {
00205 return v.is_initial(state, zero_value(s.series(),
00206 SELECT(AutoType(series_set_elt_value_t))));
00207 }
00208
00209 template <class S, class T>
00210 void
00211 op_set_final(const AutomataBase<S>& ss, T& v,
00212 const typename automaton_traits<T>::hstate_t& state,
00213 const typename Element<S, T>::series_set_elt_t& s)
00214 {
00215 v.set_final(state,
00216 s.value(),
00217 zero_value(ss.series(),
00218 SELECT(AutoType(series_set_elt_value_t))));
00219 }
00220
00221 template <class S, class T>
00222 void
00223 op_set_initial(const AutomataBase<S>& ss, T& v,
00224 int state,
00225 const AutoType(series_set_elt_t)& s)
00226 {
00227 op_set_initial(ss, v, op_get_state(ss, v, state), s);
00228 }
00229
00230 template <class S, class T>
00231 typename Element<S, T>::series_set_elt_t
00232 op_get_initial(const AutomataBase<S>& s,
00233 const T& v,
00234 int state)
00235 {
00236 return op_get_initial(s, v, op_get_state(s, v, state));
00237 }
00238
00239 template <class S, class T>
00240 bool
00241 op_is_initial(const AutomataBase<S>& s,
00242 const T& v,
00243 int state)
00244 {
00245 return op_is_initial(s, v, op_get_state(s, v, state));
00246 }
00247
00248 template <class S, class T>
00249 void
00250 op_set_final(const AutomataBase<S>& ss, T& v,
00251 int state,
00252 const typename Element<S, T>::series_set_elt_t& s)
00253 {
00254 op_set_final(ss, v, op_get_state(ss, v, state), s);
00255 }
00256
00257 template <class S, class T>
00258 typename Element<S, T>::series_set_elt_t
00259 op_get_final(const AutomataBase<S>& s,
00260 const T& v,
00261 const typename automaton_traits<T>::hstate_t& state)
00262 {
00263 return typename Element<S, T>::series_set_elt_t
00264 (s.series(),
00265 v.get_final(state,
00266 zero_value(s.series(),
00267 SELECT(AutoType(series_set_elt_value_t)))));
00268 }
00269
00270 template <class S, class T>
00271 typename Element<S, T>::series_set_elt_t
00272 op_get_final(const AutomataBase<S>& s,
00273 const T& v,
00274 int state)
00275 {
00276 return op_get_final(s, v, op_get_state(s, v, state));
00277 }
00278
00279 template <class S, class T>
00280 bool
00281 op_is_final(const AutomataBase<S>& s,
00282 const T& v,
00283 const typename automaton_traits<T>::hstate_t& state)
00284 {
00285 return v.is_final(state, zero_value(s.series(),
00286 SELECT(AutoType(series_set_elt_value_t))));
00287 }
00288
00289 template <class S, class T>
00290 bool
00291 op_is_final(const AutomataBase<S>& s,
00292 const T& v,
00293 int state)
00294 {
00295 return op_is_final(s, v, op_get_state(s, v, state));
00296 }
00297
00298 template <class S, class T>
00299 void
00300 op_clear_initial(const AutomataBase<S>&, T& v)
00301 {
00302 return v.clear_initial();
00303 }
00304
00305 template <class S, class T>
00306 void
00307 op_clear_final(const AutomataBase<S>&, T& v)
00308 {
00309 return v.clear_final();
00310 }
00311
00312 template <class S, class T>
00313 typename automaton_traits<T>::hstate_t
00314 op_add_state(const AutomataBase<S>&, T& v)
00315 {
00316 return v.add_state();
00317 }
00318
00319 template <class S, class T>
00320 typename automaton_traits<T>::hstate_t
00321 op_choose_state(const AutomataBase<S>& s, const T& v)
00322 {
00323 typedef typename automaton_traits<T>::states_t states_t;
00324 typedef typename states_t::const_iterator state_iterator;
00325 const states_t& st = op_states(s, v);
00326 assertion(st.size() > 0);
00327 int n = misc::random::generate(0, int(st.size() - 1));
00328 state_iterator ss = st.begin();
00329 for (; n > 0; --n)
00330 ++ss;
00331 return *ss;
00332 }
00333
00334 template <class S, class T>
00335 typename automaton_traits<T>::htransition_t
00336 op_add_transition(const AutomataBase<S>&, T& v,
00337 const typename automaton_traits<T>::hstate_t& from,
00338 const typename automaton_traits<T>::hstate_t& to,
00339 const typename Element<S, T>::label_t& label)
00340 {
00341 return v.add_edge(from, to, label);
00342 }
00343
00344 template <class S, class T>
00345 typename automaton_traits<T>::htransition_t
00346 op_add_transition(const AutomataBase<S>& s, T& v,
00347 int from,
00348 int to,
00349 const typename Element<S, T>::label_t& label)
00350 {
00351 return op_add_transition(s, v, op_get_state(s, v, from),
00352 op_get_state(s, v, to), label);
00353 }
00354
00355 template<class S, class T>
00356 typename automaton_traits<T>::htransition_t
00357 op_add_weighted_transition(const AutomataBase<S>& s, T& v,
00358 const typename automaton_traits<T>::hstate_t& from,
00359 const typename automaton_traits<T>::hstate_t& to,
00360 const typename Element<S, T>::semiring_elt_t& w,
00361 const typename Element<S, T>::monoid_elt_value_t& m)
00362 {
00363 typename Element<S, T>::series_set_elt_t series (s.series());
00364 series.assoc(m, w.value());
00365 return op_add_series_transition(s, v, from, to, series);
00366 }
00367
00368 template<class S, class T>
00369 typename automaton_traits<T>::htransition_t
00370 op_add_weighted_transition(const AutomataBase<S>& s, T& v,
00371 int from,
00372 int to,
00373 const typename Element<S, T>::semiring_elt_t& w,
00374 const typename Element<S, T>::monoid_elt_value_t& m)
00375 {
00376 return op_add_weighted_transition(s, v, op_get_state(s, v, from),
00377 op_get_state(s, v, to), w, m);
00378 }
00379
00380 template <class S, class T>
00381 typename automaton_traits<T>::htransition_t
00382 op_add_series_transition(const AutomataBase<S>& s, T& v,
00383 const typename automaton_traits<T>::hstate_t& from,
00384 const typename automaton_traits<T>::hstate_t& to,
00385 const typename Element<S, T>::series_set_elt_t& l)
00386 {
00387 return op_add_transition(s, v, from, to, l.value());
00388 }
00389
00390 template <class S, class T>
00391 typename automaton_traits<T>::htransition_t
00392 op_add_series_transition(const AutomataBase<S>& s, T& v,
00393 int from,
00394 int to,
00395 const typename Element<S, T>::series_set_elt_t& l)
00396 {
00397 return op_add_series_transition(s, v, op_get_state(s, v, from),
00398 op_get_state(s, v, to), l);
00399 }
00400
00401 template <class S, class T>
00402 typename automaton_traits<T>::htransition_t
00403 op_add_spontaneous(const AutomataBase<S>& s, T& v,
00404 const typename automaton_traits<T>::hstate_t& from,
00405 const typename automaton_traits<T>::hstate_t& to,
00406 const typename Element<S, T>::semiring_elt_t& w)
00407 {
00408 AutoType(series_set_elt_t) ss(s.series());
00409 ss.assoc(algebra::identity_as<AutoType(monoid_elt_value_t)>::
00410 of(s.series().monoid()), w);
00411 return op_add_series_transition(s, v, from, to, ss);
00412 }
00413
00414 template <class S, class T>
00415 typename automaton_traits<T>::htransition_t
00416 op_add_spontaneous(const AutomataBase<S>& s, T& v,
00417 int from,
00418 int to,
00419 const typename Element<S, T>::semiring_elt_t& w)
00420 {
00421 return op_add_spontaneous(s, v, op_get_state(s, v, from),
00422 op_get_state(s, v, to), w);
00423 }
00424
00425 template <class S, class T>
00426 typename automaton_traits<T>::htransition_t
00427 op_add_letter_transition(const AutomataBase<S>& s, T& v,
00428 const typename automaton_traits<T>::hstate_t& from,
00429 const typename automaton_traits<T>::hstate_t& to,
00430 const typename Element<S, T>::letter_t& l)
00431 {
00432 return op_add_transition(s, v, from, to, l);
00433 }
00434
00435 template <class S, class T>
00436 typename automaton_traits<T>::htransition_t
00437 op_add_letter_transition(const AutomataBase<S>& s, T& v,
00438 int from,
00439 int to,
00440 const typename Element<S, T>::letter_t& l)
00441 {
00442 return op_add_letter_transition(s, v, op_get_state(s, v, from),
00443 op_get_state(s, v, to), l);
00444 }
00445
00446 template <class S, class T>
00447 void
00448 op_update(const AutomataBase<S>&, T& v,
00449 const typename automaton_traits<T>::htransition_t& e,
00450 const AutoType(label_t)& l)
00451 {
00452
00453 v.update(e, l);
00454 }
00455
00456 template <class S, class T>
00457 void
00458 op_del_state(const AutomataBase<S>&, T& v,
00459 const typename automaton_traits<T>::hstate_t& s)
00460 {
00461 v.del_state(s);
00462 }
00463
00464 template <class S, class T>
00465 void
00466 op_del_state(const AutomataBase<S>& s, T& v,
00467 int state)
00468 {
00469 op_del_state(s, v, op_get_state(s, v, state));
00470 }
00471
00472 template <class S, class T>
00473 void
00474 op_del_transition(const AutomataBase<S>&, T& v,
00475 const typename automaton_traits<T>::htransition_t& e)
00476 {
00477 v.del_edge(e);
00478 }
00479
00480 template <class S, class T>
00481 bool
00482 op_has_state(const AutomataBase<S>&, const T& v,
00483 const typename automaton_traits<T>::hstate_t& s)
00484 {
00485 return v.has_state(s);
00486 }
00487
00488 template <class S, class T>
00489 bool
00490 op_has_state(const AutomataBase<S>& s, const T& v,
00491 int state)
00492 {
00493 return op_has_state(s, v, op_get_state(s, v, state));
00494 }
00495
00496 template <class S, class T>
00497 bool
00498 op_has_transition(const AutomataBase<S>&, const T& v,
00499 const typename automaton_traits<T>::htransition_t& e)
00500 {
00501 return v.has_edge(e);
00502 }
00503
00504 template <class S, class T>
00505 typename automaton_traits<T>::hstate_t
00506 op_src_of(const AutomataBase<S>&, const T& v,
00507 const typename automaton_traits<T>::htransition_t& e)
00508 {
00509 return v.src_of(e);
00510 }
00511
00512 template <class S, class T>
00513 typename automaton_traits<T>::hstate_t
00514 op_dst_of(const AutomataBase<S>&, const T& v,
00515 const typename automaton_traits<T>::htransition_t& e)
00516 {
00517 return v.dst_of(e);
00518 }
00519
00520 template <class S, class T>
00521 typename Element<S, T>::label_t
00522 op_label_of(const AutomataBase<S>&, const T& v,
00523 const typename automaton_traits<T>::htransition_t& e)
00524 {
00525 return v.label_of(e);
00526 }
00527
00528 template <class S, class T>
00529 const typename Element<S, T>::series_set_elt_t
00530 op_series_of(const AutomataBase<S>& s, const T& v,
00531 const typename automaton_traits<T>::htransition_t& e)
00532 {
00533 return typename Element<S, T>::series_set_elt_t
00534 (s.series(),
00535 v.label_of(e));
00536 }
00537
00538 template <class S, class T>
00539 typename Element<S, T>::series_set_elt_value_t
00540 op_series_value_of(const AutomataBase<S>& s, const T& v,
00541 const typename automaton_traits<T>::htransition_t& e)
00542 {
00543 return op_series_of(s, v, e).value();
00544 }
00545
00546 template <class S, class T>
00547 typename Element<S, T>::monoid_elt_t
00548 op_word_of(const AutomataBase<S>& s, const T& v,
00549 const typename automaton_traits<T>::htransition_t& e)
00550 {
00551 return typename Element<S, T>::monoid_elt_t
00552 (s.series().monoid(),
00553 v.label_of(e));
00554 }
00555
00556 template <class S, class T>
00557 typename Element<S, T>::semiring_elt_t
00558 op_weight_of(const AutomataBase<S>& s, const T& v,
00559 const typename automaton_traits<T>::htransition_t& e)
00560 {
00561 return op_series_of(s, v, e).get(op_word_of(s, v, e));
00562 }
00563
00564 template <class S, class T>
00565 typename Element<S, T>::monoid_elt_value_t
00566 op_word_value_of(const AutomataBase<S>& s, const T& v,
00567 const typename automaton_traits<T>::htransition_t& e)
00568 {
00569 return op_word_of(s, v, e).value();
00570 }
00571
00572 template <class S, class T>
00573 typename Element<S, T>::letter_t
00574 op_letter_of(const AutomataBase<S>&, const T& v,
00575 const typename automaton_traits<T>::htransition_t& e)
00576 {
00577 return v.label_of(e);
00578 }
00579
00580 template <class S, class T>
00581 bool
00582 op_is_spontaneous(const AutomataBase<S>& s, const T& v,
00583 const typename automaton_traits<T>::htransition_t& e)
00584 {
00585 return (op_series_of(s, v, e) ==
00586 algebra::identity_as<AutoType(series_set_elt_value_t)>::of(s.series()));
00587 }
00588
00589 template<typename T>
00590 struct always_true
00591 {
00592 bool operator()(const typename automaton_traits<T>::htransition_t&) const
00593 {
00594 return true;
00595 }
00596 };
00597
00598 template <class S, class T, class Letter>
00599 class letter_query
00600 {
00601 public:
00602 letter_query(const S* s, const T* v, const Letter& l) :
00603 s_ (s),
00604 v_ (v),
00605 w_ (s->series().monoid(), l),
00606 l_ (l)
00607 {
00608 }
00609
00610 bool operator()(const typename automaton_traits<T>::htransition_t& e) const
00611 {
00612 return (op_series_get(s_->series(),
00613 op_series_of(*s_, *v_, e).value(),
00614 w_.value())
00615 != algebra::zero_as<AutoType(semiring_elt_value_t)>
00616 ::of(s_->series().semiring()));
00617 }
00618
00619 Letter letter() const
00620 {
00621 return l_;
00622 }
00623
00624 private:
00625 const S* s_;
00626 const T* v_;
00627 AutoType(monoid_elt_t) w_;
00628 const Letter l_;
00629 };
00630
00631 template <class S, class T, class Letter>
00632 letter_query<S, T, Letter>
00633 make_letter_query(const S& s, const T& t, const Letter& l)
00634 {
00635 return letter_query<S, T, Letter> (&s, &t, l);
00636 }
00637
00638 template <class S, class T>
00639 class spontaneous_query
00640 {
00641 public:
00642 spontaneous_query(const S& s, const T& v):
00643 s_(s),
00644 v_(v)
00645 {}
00646
00647 bool operator()(const typename automaton_traits<T>::htransition_t& e) const
00648 {
00649 return (op_series_of(s_, v_, e)
00650 .get(algebra::identity_as<AutoType(monoid_elt_value_t)>::of
00651 (s_.series().monoid()))
00652 != algebra::zero_as<AutoType(semiring_elt_value_t)>
00653 ::of(s_.series().semiring()));
00654 }
00655
00656 private:
00657 const S& s_;
00658 const T& v_;
00659 };
00660
00661 template <class S, class T>
00662 spontaneous_query<S, T> make_spontaneous_query(const S& s,
00663 const T& t)
00664 {
00665 return spontaneous_query<S, T>(s.self(), t);
00666 }
00667
00668
00669
00670
00671
00672 template <class S, class T,
00673 typename OutputIterator, typename Kind>
00674 void op_delta(const AutomataBase<S>&, const T& v,
00675 OutputIterator res,
00676 const typename automaton_traits<T>::hstate_t& from,
00677 delta_kind::kind<Kind> k)
00678 {
00679 v.delta(res, from, always_true<T>(), k);
00680 }
00681
00682 template <class S, class T,
00683 typename OutputIterator, typename Kind>
00684 void op_delta(const AutomataBase<S>&s, const T& v,
00685 OutputIterator res,
00686 int from,
00687 delta_kind::kind<Kind> k)
00688 {
00689 op_delta(s, v, res, op_get_state(s, v, from), always_true<T>(), k);
00690 }
00691
00692 template <class S, class T,
00693 typename OutputIterator, typename L, typename Kind>
00694 void op_delta(const AutomataBase<S>&, const T& v,
00695 OutputIterator res,
00696 const typename automaton_traits<T>::hstate_t& from,
00697 const L& query,
00698 delta_kind::kind<Kind> k)
00699 {
00700 v.delta(res, from, query, k);
00701 }
00702
00703 template <class S, class T,
00704 typename OutputIterator, typename L, typename Kind>
00705 void op_delta(const AutomataBase<S>&s, const T& v,
00706 OutputIterator res,
00707 int from,
00708 const L& query,
00709 delta_kind::kind<Kind> k)
00710 {
00711 op_delta(s, v, res, op_get_state(s, v, from), query, k);
00712 }
00713
00714 template <class S, class T,
00715 typename OutputIterator, typename L, typename Kind>
00716 void op_letter_delta(const AutomataBase<S>& s, const T& v,
00717 OutputIterator res,
00718 const typename automaton_traits<T>::hstate_t& from,
00719 const L& letter,
00720 delta_kind::kind<Kind> k)
00721 {
00722 v.delta(res, from, make_letter_query(s.self(), v, letter), k);
00723 }
00724
00725 template <class S, class T,
00726 typename OutputIterator, typename L, typename Kind>
00727 void op_letter_delta(const AutomataBase<S>& s, const T& v,
00728 OutputIterator res,
00729 int from,
00730 const L& letter,
00731 delta_kind::kind<Kind> k)
00732 {
00733 op_letter_delta(s, v, res, op_get_state(s, v, from), letter, k);
00734 }
00735
00736 template <class S, class T,
00737 typename OutputIterator, typename Kind>
00738 void op_spontaneous_delta(const AutomataBase<S>& s,
00739 const T& v,
00740 OutputIterator res,
00741 const typename automaton_traits<T>::hstate_t& from,
00742 delta_kind::kind<Kind> k)
00743 {
00744 v.delta (res, from, make_spontaneous_query(s.self(), v), k);
00745 }
00746
00747 template <class S, class T,
00748 typename OutputIterator, typename Kind>
00749 void op_spontaneous_delta(const AutomataBase<S>& s,
00750 const T& v,
00751 OutputIterator res,
00752 int from,
00753 delta_kind::kind<Kind> k)
00754 {
00755 op_spontaneous_delta (s, v, res, op_get_state(s, v, from), k);
00756 }
00757
00758
00759
00760
00761
00762 template <class S, class T,
00763 typename Container, typename Kind>
00764 void op_deltac(const AutomataBase<S>&, const T& v,
00765 Container& res,
00766 const typename automaton_traits<T>::hstate_t& from,
00767 delta_kind::kind<Kind> k)
00768 {
00769 std::insert_iterator<Container> i(res, res.begin());
00770 v.delta(i, from, always_true<T>(), k);
00771 }
00772
00773 template <class S, class T,
00774 typename Container, typename Kind>
00775 void op_deltac(const AutomataBase<S>& s, const T& v,
00776 Container& res,
00777 int from,
00778 delta_kind::kind<Kind> k)
00779 {
00780 op_deltac(s, v, res, op_get_state(s, v, from), k);
00781 }
00782
00783 template <class S, class T,
00784 typename Container, typename L, typename Kind>
00785 void op_deltac(const AutomataBase<S>&,
00786 const T& v,
00787 Container& res,
00788 const typename automaton_traits<T>::hstate_t& from,
00789 const L& query,
00790 delta_kind::kind<Kind> k)
00791 {
00792 std::insert_iterator<Container> i(res, res.begin());
00793 v.delta(i, from, query, k);
00794 }
00795
00796 template <class S, class T,
00797 typename Container, typename L, typename Kind>
00798 void op_deltac(const AutomataBase<S>& s,
00799 const T& v,
00800 Container& res,
00801 int from,
00802 const L& query,
00803 delta_kind::kind<Kind> k)
00804 {
00805 op_deltac(s, v, res, op_get_state(s, v, from), query, k);
00806 }
00807
00808 template <class S, class T,
00809 typename Container, typename L, typename Kind>
00810 void op_letter_deltac(const AutomataBase<S>& s,
00811 const T& v,
00812 Container& res,
00813 const typename automaton_traits<T>::hstate_t& from,
00814 const L& letter,
00815 delta_kind::kind<Kind> k)
00816 {
00817 std::insert_iterator<Container> i(res, res.begin());
00818 v.delta(i, from, make_letter_query(s.self(), v, letter), k);
00819 }
00820
00821 template <class S, class T,
00822 typename Container, typename L, typename Kind>
00823 void op_letter_deltac(const AutomataBase<S>& s,
00824 const T& v,
00825 Container& res,
00826 int from,
00827 const L& letter,
00828 delta_kind::kind<Kind> k)
00829 {
00830 op_letter_deltac(s, v, res, op_get_state(s, v, from), letter, k);
00831 }
00832
00833 template <class S, class T, class Container, typename Kind>
00834 void op_spontaneous_deltac(const AutomataBase<S>& s,
00835 const T& v,
00836 Container& res,
00837 const typename automaton_traits<T>::hstate_t& from,
00838 delta_kind::kind<Kind> k)
00839 {
00840 std::insert_iterator<Container> i(res, res.begin());
00841 v.delta (i, from, make_spontaneous_query(s.self(), v), k);
00842 }
00843
00844 template <class S, class T, class Container, typename Kind>
00845 void op_spontaneous_deltac(const AutomataBase<S>& s,
00846 const T& v,
00847 Container& res,
00848 int from,
00849 delta_kind::kind<Kind> k)
00850 {
00851 op_spontaneous_deltac(s, v, res, op_get_state(s, v, from), k);
00852 }
00853
00854
00855
00856
00857
00858 template <class S, class T,
00859 typename Functor, typename Kind>
00860 void op_deltaf(const AutomataBase<S>&, const T& v,
00861 Functor& fun,
00862 const typename automaton_traits<T>::hstate_t& from,
00863 delta_kind::kind<Kind> k)
00864 {
00865 v.deltaf(fun, from, always_true<T>(), k);
00866 }
00867
00868 template <class S, class T,
00869 typename Functor, typename Kind>
00870 void op_deltaf(const AutomataBase<S>& s, const T& v,
00871 Functor& fun,
00872 int from,
00873 delta_kind::kind<Kind> k)
00874 {
00875 op_deltaf(s, v, fun, op_get_state(s, v, from), k);
00876 }
00877
00878 template <class S, class T,
00879 typename Functor, typename L, typename Kind>
00880 void op_deltaf(const AutomataBase<S>&,
00881 const T& v,
00882 Functor& fun,
00883 const typename automaton_traits<T>::hstate_t& from,
00884 const L& query,
00885 delta_kind::kind<Kind> k)
00886 {
00887 v.deltaf(fun, from, query, k);
00888 }
00889
00890 template <class S, class T,
00891 typename Functor, typename L, typename Kind>
00892 void op_deltaf(const AutomataBase<S>& s,
00893 const T& v,
00894 Functor& fun,
00895 int from,
00896 const L& query,
00897 delta_kind::kind<Kind> k)
00898 {
00899 op_deltaf(s, v, fun, op_get_state(s, v, from), query, k);
00900 }
00901
00902
00903 template <class S, class T,
00904 typename Functor, typename L, typename Kind>
00905 void op_letter_deltaf(const AutomataBase<S>& s,
00906 const T& v,
00907 Functor& fun,
00908 const typename automaton_traits<T>::hstate_t& from,
00909 const L& letter,
00910 delta_kind::kind<Kind> k)
00911 {
00912 v.deltaf(fun, from, make_letter_query(s.self(), v, letter), k);
00913 }
00914
00915 template <class S, class T,
00916 typename Functor, typename L, typename Kind>
00917 void op_letter_deltaf(const AutomataBase<S>& s,
00918 const T& v,
00919 Functor& fun,
00920 int from,
00921 const L& letter,
00922 delta_kind::kind<Kind> k)
00923 {
00924 op_letter_deltaf(s, v, fun, op_get_state(s, v, from), letter, k);
00925 }
00926
00927 template <class S, class T, class Functor, typename Kind>
00928 void op_spontaneous_deltaf(const AutomataBase<S>& s,
00929 const T& v,
00930 Functor& fun,
00931 const typename automaton_traits<T>::hstate_t& from,
00932 delta_kind::kind<Kind> k)
00933 {
00934 v.deltaf(fun, from, make_spontaneous_query(s.self(), v), k);
00935 }
00936
00937 template <class S, class T, class Functor, typename Kind>
00938 void op_spontaneous_deltaf(const AutomataBase<S>& s,
00939 const T& v,
00940 Functor& fun,
00941 int from,
00942 delta_kind::kind<Kind> k)
00943 {
00944 op_spontaneous_deltaf(s, v, fun, op_get_state(s, v, from), k);
00945 }
00946
00947
00948
00949
00950
00951
00952 template <class S, class T,
00953 typename OutputIterator, typename Kind>
00954 void op_rdelta(const AutomataBase<S>&, const T& v,
00955 OutputIterator res,
00956 const typename automaton_traits<T>::hstate_t& from,
00957 delta_kind::kind<Kind> k)
00958 {
00959 v.rdelta (res, from, always_true<T>(), k);
00960 }
00961
00962 template <class S, class T,
00963 typename OutputIterator, typename Kind>
00964 void op_rdelta(const AutomataBase<S>& s, const T& v,
00965 OutputIterator res,
00966 int from,
00967 delta_kind::kind<Kind> k)
00968 {
00969 op_rdelta(s, v, res, op_get_state(s, v, from), k);
00970 }
00971
00972 template <class S, class T,
00973 typename OutputIterator, typename L, typename Kind>
00974 void op_rdelta(const AutomataBase<S>&, const T& v,
00975 OutputIterator res,
00976 const typename automaton_traits<T>::hstate_t& from,
00977 const L& query,
00978 delta_kind::kind<Kind> k)
00979 {
00980 v.rdelta(res, from, query, k);
00981 }
00982
00983 template <class S, class T,
00984 typename OutputIterator, typename L, typename Kind>
00985 void op_rdelta(const AutomataBase<S>& s, const T& v,
00986 OutputIterator res,
00987 int from,
00988 const L& query,
00989 delta_kind::kind<Kind> k)
00990 {
00991 op_rdelta(s, v, res, op_get_state(s, v, from), query, k);
00992 }
00993
00994 template <class S, class T,
00995 typename OutputIterator, typename L, typename Kind>
00996 void op_letter_rdelta(const AutomataBase<S>& s, const T& v,
00997 OutputIterator res,
00998 const typename automaton_traits<T>::hstate_t& from,
00999 const L& letter,
01000 delta_kind::kind<Kind> k)
01001 {
01002 v.rdelta(res, from, make_letter_query(s.self(), v, letter), k);
01003 }
01004
01005 template <class S, class T,
01006 typename OutputIterator, typename L, typename Kind>
01007 void op_letter_rdelta(const AutomataBase<S>& s, const T& v,
01008 OutputIterator res,
01009 int from,
01010 const L& letter,
01011 delta_kind::kind<Kind> k)
01012 {
01013 op_letter_rdelta(s, v, res, op_get_state(s, v, from), letter, k);
01014 }
01015
01016 template <class S, class T,
01017 typename OutputIterator, typename Kind>
01018 void op_spontaneous_rdelta(const AutomataBase<S>& s, const T& v,
01019 OutputIterator res,
01020 const typename automaton_traits<T>::hstate_t& from,
01021 delta_kind::kind<Kind> k)
01022 {
01023 v.rdelta(res, from, make_spontaneous_query(s.self(), v), k);
01024 }
01025
01026 template <class S, class T,
01027 typename OutputIterator, typename Kind>
01028 void op_spontaneous_rdelta(const AutomataBase<S>& s, const T& v,
01029 OutputIterator res,
01030 int from,
01031 delta_kind::kind<Kind> k)
01032 {
01033 op_spontaneous_rdelta(s, v, res, op_get_state(s, v, from), k);
01034 }
01035
01036
01037
01038
01039
01040 template <class S, class T,
01041 typename Container, typename Kind>
01042 void op_rdeltac(const AutomataBase<S>&,
01043 const T& v,
01044 Container& res,
01045 const typename automaton_traits<T>::hstate_t& from,
01046 delta_kind::kind<Kind> k)
01047 {
01048 std::insert_iterator<Container> i(res, res.begin());
01049 v.rdelta(i, from, always_true<T>(), k);
01050 }
01051
01052 template <class S, class T,
01053 typename Container, typename Kind>
01054 void op_rdeltac(const AutomataBase<S>& s,
01055 const T& v,
01056 Container& res,
01057 int from,
01058 delta_kind::kind<Kind> k)
01059 {
01060 op_rdeltac(s, v, res, op_get_state(s, v, from), k);
01061 }
01062
01063 template <class S, class T,
01064 typename Container, typename L, typename Kind>
01065 void op_rdeltac(const AutomataBase<S>&,
01066 const T& v,
01067 Container& res,
01068 const typename automaton_traits<T>::hstate_t& from,
01069 const L& query,
01070 delta_kind::kind<Kind> k)
01071 {
01072 std::insert_iterator<Container> i(res, res.begin());
01073 v.rdelta(i, from, query, k);
01074 }
01075
01076 template <class S, class T,
01077 typename Container, typename L, typename Kind>
01078 void op_rdeltac(const AutomataBase<S>& s,
01079 const T& v,
01080 Container& res,
01081 int from,
01082 const L& query,
01083 delta_kind::kind<Kind> k)
01084 {
01085 op_rdeltac(s, v, res, op_get_state(s, v, from), query, k);
01086 }
01087
01088 template <class S, class T,
01089 typename Container, typename L, typename Kind>
01090 void op_letter_rdeltac(const AutomataBase<S>& s,
01091 const T& v,
01092 Container& res,
01093 const typename automaton_traits<T>::hstate_t& from,
01094 const L& letter,
01095 delta_kind::kind<Kind> k)
01096 {
01097 std::insert_iterator<Container> i(res, res.begin());
01098 v.rdelta (i, from, make_letter_query(s.self(), v, letter), k);
01099 }
01100
01101 template <class S, class T,
01102 typename Container, typename L, typename Kind>
01103 void op_letter_rdeltac(const AutomataBase<S>& s,
01104 const T& v,
01105 Container& res,
01106 int from,
01107 const L& letter,
01108 delta_kind::kind<Kind> k)
01109 {
01110 op_letter_rdeltac(s, v, res, op_get_state(s, v, from), letter, k);
01111 }
01112
01113 template <class S, class T, class Container, typename Kind>
01114 void op_spontaneous_rdeltac(const AutomataBase<S>& s,
01115 const T& v,
01116 Container& res,
01117 const typename automaton_traits<T>::hstate_t& from,
01118 delta_kind::kind<Kind> k)
01119 {
01120 std::insert_iterator<Container> i(res, res.begin());
01121 v.rdelta (i, from, make_spontaneous_query(s.self(), v), k);
01122 }
01123
01124 template <class S, class T, class Container, typename Kind>
01125 void op_spontaneous_rdeltac(const AutomataBase<S>& s,
01126 const T& v,
01127 Container& res,
01128 int from,
01129 delta_kind::kind<Kind> k)
01130 {
01131 op_spontaneous_rdeltac(s, v, res, op_get_state(s, v, from), k);
01132 }
01133
01134
01135
01136
01137
01138 template <class S, class T,
01139 typename Functor, typename Kind>
01140 void op_rdeltaf(const AutomataBase<S>&,
01141 const T& v,
01142 Functor& fun,
01143 const typename automaton_traits<T>::hstate_t& from,
01144 delta_kind::kind<Kind> k)
01145 {
01146 v.rdeltaf(fun, from, always_true<T>(), k);
01147 }
01148
01149 template <class S, class T,
01150 typename Functor, typename Kind>
01151 void op_rdeltaf(const AutomataBase<S>& s,
01152 const T& v,
01153 Functor& fun,
01154 int from,
01155 delta_kind::kind<Kind> k)
01156 {
01157 op_rdeltaf(s, v, fun, op_get_state(s, v, from), k);
01158 }
01159
01160 template <class S, class T,
01161 typename Functor, typename L, typename Kind>
01162 void op_rdeltaf(const AutomataBase<S>&,
01163 const T& v,
01164 Functor& fun,
01165 const typename automaton_traits<T>::hstate_t& from,
01166 const L& query,
01167 delta_kind::kind<Kind> k)
01168 {
01169 v.rdeltaf(fun, from, query, k);
01170 }
01171
01172 template <class S, class T,
01173 typename Functor, typename L, typename Kind>
01174 void op_rdeltaf(const AutomataBase<S>& s,
01175 const T& v,
01176 Functor& fun,
01177 int from,
01178 const L& query,
01179 delta_kind::kind<Kind> k)
01180 {
01181 op_rdeltaf(s, v, fun, op_get_state(s, v, from), query, k);
01182 }
01183
01184
01185 template <class S, class T,
01186 typename Functor, typename L, typename Kind>
01187 void op_letter_rdeltaf(const AutomataBase<S>& s,
01188 const T& v,
01189 Functor& fun,
01190 const typename automaton_traits<T>::hstate_t& from,
01191 const L& letter,
01192 delta_kind::kind<Kind> k)
01193 {
01194 v.rdeltaf(fun, from, make_letter_query(s.self(), v, letter), k);
01195 }
01196
01197 template <class S, class T,
01198 typename Functor, typename L, typename Kind>
01199 void op_letter_rdeltaf(const AutomataBase<S>& s,
01200 const T& v,
01201 Functor& fun,
01202 int from,
01203 const L& letter,
01204 delta_kind::kind<Kind> k)
01205 {
01206 op_letter_rdeltaf(s, v, fun, op_get_state(s, v, from), letter, k);
01207 }
01208
01209 template <class S, class T, class Functor, typename Kind>
01210 void op_spontaneous_rdeltaf(const AutomataBase<S>& s,
01211 const T& v,
01212 Functor& fun,
01213 const typename automaton_traits<T>::hstate_t& from,
01214 delta_kind::kind<Kind> k)
01215 {
01216 v.rdeltaf(fun, from, make_spontaneous_query(s.self(), v), k);
01217 }
01218
01219 template <class S, class T, class Functor, typename Kind>
01220 void op_spontaneous_rdeltaf(const AutomataBase<S>& s,
01221 const T& v,
01222 Functor& fun,
01223 int from,
01224 delta_kind::kind<Kind> k)
01225 {
01226 op_spontaneous_rdeltaf(s, v, fun, op_get_state(s, v, from), k);
01227 }
01228
01229
01230 }
01231
01232 # undef AutoType
01233
01234 #endif // ! VCSN_AUTOMATA_CONCEPT_AUTOMATA_OPS_HXX