transpose_view.hxx

00001 // transpose_view.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_TRANSPOSE_VIEW_HXX
00018 # define VCSN_AUTOMATA_IMPLEMENTATION_TRANSPOSE_VIEW_HXX
00019 
00020 # include <vaucanson/automata/implementation/transpose_view.hh>
00021 
00022 namespace vcsn {
00023 
00024 #define AutoType(Type)                          \
00025   typename Element<S, TransposeView<T> >::Type
00026 
00027   template <class T>
00028   TransposeView<T>::TransposeView()
00029   {}
00030 
00031   template <class T>
00032   TransposeView<T>::TransposeView(const T& object):
00033     IdentityView<T>(object)
00034   {}
00035 
00036   template <class T>
00037   TransposeView<T>::TransposeView(T& object):
00038     IdentityView<T>(object)
00039   {}
00040 
00041   template <class T>
00042   TransposeView<T>::TransposeView(const TransposeView& t):
00043     IdentityView<T>(t)
00044   {}
00045 
00046   template <class S, class T>
00047   Element<S, TransposeView<T> >
00048   transpose_view(Element<S, T>& a)
00049   {
00050     return Element<S, TransposeView<T> >
00051       (a.structure(), TransposeView<T>(a.value()));
00052   }
00053 
00054   template <class S, class T>
00055   const Element<S, TransposeView<T> >
00056   transpose_view(const Element<S, T>& a)
00057   {
00058     return Element<S, TransposeView<T> >
00059       (a.structure(), TransposeView<T>(a.value()));
00060   }
00061 
00062   template <class S, class T>
00063   const typename automaton_traits<T>::tag_t&
00064   op_get_tag(const AutomataBase<S>& s, const TransposeView<T>& v)
00065   {
00066     return op_get_tag(s, v.object());
00067   }
00068 
00069   template <class S, class T>
00070   typename automaton_traits<T>::tag_t&
00071   op_get_tag(const AutomataBase<S>& s, TransposeView<T>& v)
00072   {
00073     return op_get_tag(s, v.object());
00074   }
00075 
00076   template <class S, class T>
00077   const typename automaton_traits<T>::geometry_t&
00078   op_get_geometry(const AutomataBase<S>& s, const TransposeView<T>& v)
00079   {
00080     return op_get_geometry(s, v.object());
00081   }
00082 
00083   template <class S, class T>
00084   typename automaton_traits<T>::geometry_t&
00085   op_get_geometry(const AutomataBase<S>& s, TransposeView<T>& v)
00086   {
00087     return op_get_geometry(s, v.object());
00088   }
00089 
00090   template <class S, class T>
00091   bool
00092   op_exists(const AutomataBase<S>& s, const TransposeView<T>& v)
00093   {
00094     return op_exists(s, v.object());
00095   }
00096 
00097   template <class S, class T>
00098   typename automaton_traits<T>::states_t
00099   op_states(const AutomataBase<S>& s, const TransposeView<T>& v)
00100   {
00101     return op_states(s, v.object());
00102   }
00103 
00104   template <class S, class T>
00105   typename automaton_traits<T>::transitions_t
00106   op_transitions(const AutomataBase<S>& s, const TransposeView<T>& v)
00107   {
00108     return op_transitions(s, v.object());
00109   }
00110 
00111   template <class S, class T>
00112   hstate_t
00113   op_add_state(const AutomataBase<S>& s, TransposeView<T>& v)
00114   {
00115     return op_add_state(s, v.object());
00116   }
00117 
00118   template <class S, class T>
00119   hstate_t
00120   op_choose_state(const AutomataBase<S>& s, TransposeView<T>& v)
00121   {
00122     return op_choose_state(s, v.object());
00123   }
00124 
00125   template <class S, class T>
00126   htransition_t
00127   op_add_transition(const AutomataBase<S>& s, TransposeView<T>& v,
00128                     hstate_t from,
00129                     hstate_t to,
00130                     const typename Element<S, T>::label_t& label)
00131   {
00132     return op_add_transition(s, v.object(), from, to, label);
00133   }
00134 
00135   template <class S, class T>
00136   htransition_t
00137   op_add_series_transition(const AutomataBase<S>& s,
00138                            TransposeView<T>& v,
00139                            hstate_t from,
00140                            hstate_t to,
00141                            const typename Element<S, T>::series_set_elt_t& se)
00142   {
00143     return op_add_series_transition(s, v.object(), from, to, se);
00144   }
00145 
00146   template <class S, class T>
00147   htransition_t
00148   op_add_spontaneous(const AutomataBase<S>& s, TransposeView<T>& v,
00149                      hstate_t from,
00150                      hstate_t to)
00151   {
00152     return op_add_spontaneous(s, v.object(), from, to);
00153   }
00154 
00155   template <class S, class T>
00156   htransition_t
00157   op_add_letter_transition(const AutomataBase<S>& s, TransposeView<T>& v,
00158                            hstate_t from,
00159                            hstate_t to,
00160                            const typename Element<S, T>::letter_t& e)
00161   {
00162     return op_add_letter_transition(s, v.object(), from, to, e);
00163   }
00164 
00165   template <class S, class T>
00166   void
00167   op_update(const AutomataBase<S>& s, TransposeView<T>& v,
00168             htransition_t e,
00169             const AutoType(label_t)& l)
00170   {
00171     op_update(s, v.object(), e, l);
00172   }
00173 
00174   template <class S, class T>
00175   void
00176   op_del_state(const AutomataBase<S>& s, TransposeView<T>& v,
00177                hstate_t st)
00178   {
00179     op_del_state(s, v.object(), st);
00180   }
00181 
00182   template <class S, class T>
00183   void
00184   op_del_transition(const AutomataBase<S>& s, TransposeView<T>& v,
00185                     htransition_t e)
00186   {
00187     op_del_transition(s, v.object(), e);
00188   }
00189 
00190   template <class S, class T>
00191   bool
00192   op_has_state(const AutomataBase<S>& s,
00193                const TransposeView<T>& v,
00194                hstate_t st)
00195   {
00196     return op_has_state(s, v.object(), st);
00197   }
00198 
00199   template <class S, class T>
00200   bool
00201   op_has_transition(const AutomataBase<S>& s,
00202                     const TransposeView<T>& v,
00203                     htransition_t e)
00204   {
00205     return op_has_transition(s, v.object(), e);
00206   }
00207 
00208   template <class S, class T>
00209   typename Element<S, T>::label_t
00210   op_label_of(const AutomataBase<S>& s,
00211               const TransposeView<T>& v,
00212               htransition_t e)
00213   {
00214     return op_label_of(s, v.object(), e);
00215     // FIXME: The label should be transposed.
00216   }
00217 
00218   template <class S, class T>
00219   const typename Element<S, T>::series_set_elt_t
00220   op_series_of(const AutomataBase<S>& s,
00221                const TransposeView<T>& v,
00222                htransition_t e)
00223   {
00224     typename Element<S, T>::series_set_elt_t r =
00225       op_series_of(s, v.object(), e);
00226     r.transpose();
00227     return r;
00228   }
00229 
00230   template <class S, class T>
00231   typename Element<S, T>::series_set_elt_value_t
00232   op_series_value_of(const AutomataBase<S>& s,
00233                      const TransposeView<T>& v,
00234                      htransition_t e)
00235   {
00236     return op_series_value_of(s, v.object(), e);
00237   }
00238 
00239   template <class S, class T>
00240   typename Element<S, T>::monoid_elt_t
00241   op_word_of(const AutomataBase<S>& s,
00242              const TransposeView<T>& v,
00243              htransition_t e)
00244   {
00245     return op_word_of(s, v.object(), e);
00246   }
00247 
00248   template <class S, class T>
00249   typename Element<S, T>::monoid_elt_value_t
00250   op_word_value_of(const AutomataBase<S>& s,
00251                    const TransposeView<T>& v,
00252                    htransition_t e)
00253   {
00254     return op_word_value_of(s, v.object(), e);
00255   }
00256 
00257   template <class S, class T>
00258   typename Element<S, T>::letter_t
00259   op_letter_of(const AutomataBase<S>& s,
00260                const TransposeView<T>& v,
00261                htransition_t e)
00262   {
00263     return op_letter_of(s, v.object(), e);
00264   }
00265 
00266   template <class S, class T>
00267   bool
00268   op_is_spontaneous(const AutomataBase<S>& s,
00269                     const TransposeView<T>& v,
00270                     htransition_t e)
00271   {
00272     return op_is_spontaneous(s, v.object(), e);
00273   }
00274 
00275   template <class S, class T>
00276   typename automaton_traits<TransposeView<T> >::initial_support_t
00277   op_initial(const AutomataBase<S>& s, const TransposeView<T>& v)
00278   {
00279     return op_final(s, v.object());
00280   }
00281 
00282   template <class S, class T>
00283   typename automaton_traits<TransposeView<T> >::final_support_t
00284   op_final(const AutomataBase<S>& s, const TransposeView<T>& v)
00285   {
00286     return op_initial(s, v.object());
00287   }
00288 
00289   template <class S, class T>
00290   void
00291   op_set_initial(const AutomataBase<S>& ss, TransposeView<T>& v,
00292                  hstate_t state,
00293                  const AutoType(series_set_elt_t)& s)
00294   {
00295     return op_set_final(ss, v.object(), state, s);
00296   }
00297 
00298   template <class S, class T>
00299   AutoType(series_set_elt_t)
00300   op_get_initial(const AutomataBase<S>& s,
00301                  const TransposeView<T>& v,
00302                  hstate_t state)
00303   {
00304     AutoType(series_set_elt_t) r = op_get_final(s, v.object(), state);
00305     r.transpose();
00306     return r;
00307   }
00308 
00309   template <class S, class T>
00310   void
00311   op_set_final(const AutomataBase<S>& ss, TransposeView<T>& v,
00312                hstate_t state,
00313                const typename Element<S, T>::series_set_elt_t& s)
00314   {
00315     op_set_initial(ss, v.object(), state, s);
00316   }
00317 
00318   template <class S, class T>
00319   typename Element<S, T>::series_set_elt_t
00320   op_get_final(const AutomataBase<S>& s,
00321                const TransposeView<T>& v,
00322                hstate_t state)
00323   {
00324     typename Element<S, T>::series_set_elt_t r = op_get_initial(s, v.object(),
00325                                                                 state);
00326     r.transpose();
00327     return r;
00328   }
00329 
00330   template <class S, class T>
00331   void
00332   op_clear_initial(const AutomataBase<S>& s, TransposeView<T>& v)
00333   {
00334     op_clear_final(s, v.object());
00335   }
00336 
00337   template <class S, class T>
00338   void
00339   op_clear_final(const AutomataBase<S>& s, TransposeView<T>& v)
00340   {
00341     op_clear_initial(s, v.object());
00342   }
00343 
00344   template <class S, class T>
00345   hstate_t
00346   op_src_of(const AutomataBase<S>& s,
00347             const TransposeView<T>& v,
00348             htransition_t e)
00349   {
00350     return op_dst_of(s, v.object(), e);
00351   }
00352 
00353   template <class S, class T>
00354   hstate_t
00355   op_dst_of(const AutomataBase<S>& s,
00356             const TransposeView<T>& v,
00357             htransition_t e)
00358   {
00359     return op_src_of(s, v.object(), e);
00360   }
00361 
00362   // output_return_type = OutputIterator
00363   // output_type        = htransition_t
00364   // direction          = output
00365 
00366   template <class S, class T,
00367             typename OutputIterator>
00368   void op_delta(const AutomataBase<S>& s,
00369                 const TransposeView<T>& v,
00370                 OutputIterator res,
00371                 hstate_t from,
00372                 delta_kind::transitions k)
00373   {
00374     op_rdelta(s, v.object(), res, from, k);
00375   }
00376 
00377   template <class S, class T,
00378             typename OutputIterator, typename L>
00379   void op_delta(const AutomataBase<S>& s,
00380                 const TransposeView<T>& v,
00381                 OutputIterator res,
00382                 hstate_t from,
00383                 const L& query,
00384                 delta_kind::transitions k)
00385   {
00386     op_rdelta(s, v.object(), res, from, query, k);
00387   }
00388 
00389   template <class S, class T,
00390             typename OutputIterator, typename L>
00391   void op_letter_delta(const AutomataBase<S>& s,
00392                        const TransposeView<T>& v,
00393                        OutputIterator res,
00394                        hstate_t from,
00395                        const L& letter,
00396                        delta_kind::transitions k)
00397   {
00398     op_letter_rdelta(s, v.object(), res, from, letter, k);
00399   }
00400 
00401   template <class S, class T,
00402             typename OutputIterator>
00403   void op_spontaneous_delta(const AutomataBase<S>& s,
00404                             const TransposeView<T>& v,
00405                             OutputIterator res,
00406                             hstate_t from,
00407                             delta_kind::transitions k)
00408   {
00409     op_spontaneous_rdelta(s, v.object(), res, from, k);
00410   }
00411 
00412   // output_return_type = Container
00413   // output_type        = htransition_t
00414   // direction          = output
00415 
00416   template <class S, class T,
00417             typename Container>
00418   void op_deltac(const AutomataBase<S>& s,
00419                  const TransposeView<T>& v,
00420                  Container& res, hstate_t from, delta_kind::transitions k)
00421   {
00422     op_rdeltac(s, v.object(), res, from, k);
00423   }
00424 
00425   template <class S, class T,
00426             typename Container, typename L>
00427   void op_deltac(const AutomataBase<S>& s,
00428                  const TransposeView<T>& v,
00429                  Container& res,
00430                  hstate_t from,
00431                  const L& query,
00432                  delta_kind::transitions k)
00433   {
00434     op_rdeltac(s, v.object(), res, from, query, k);
00435   }
00436 
00437   template <class S, class T,
00438             typename Container, typename L>
00439   void op_letter_deltac(const AutomataBase<S>& s,
00440                         const TransposeView<T>& v,
00441                         Container& res,
00442                         hstate_t from,
00443                         const L& letter,
00444                         delta_kind::transitions k)
00445   {
00446     op_letter_rdeltac(s, v.object(), res, from, letter, k);
00447   }
00448 
00449   template <class S, class T, class Container>
00450   void op_spontaneous_deltac(const AutomataBase<S>& s,
00451                              const TransposeView<T>& v,
00452                              Container& res,
00453                              hstate_t from,
00454                              delta_kind::transitions k)
00455   {
00456     op_spontaneous_rdeltac(s, v.object(), res, from, k);
00457   }
00458 
00459   // output_return_type = OutputIterator
00460   // output_type        = hstate_t
00461   // direction          = output
00462 
00463   template<class S, class T, typename OutputIterator>
00464   void op_delta(const AutomataBase<S>& s,
00465                 const TransposeView<T>& v,
00466                 OutputIterator res,
00467                 hstate_t from,
00468                 delta_kind::states k)
00469   {
00470     op_rdelta(s, v.object(), res, from, k);
00471   }
00472 
00473   template<class S, class T, typename OutputIterator, typename L>
00474   void op_delta(const AutomataBase<S>& s,
00475                 const TransposeView<T>& v,
00476                 OutputIterator res,
00477                 hstate_t from,
00478                 const L& query,
00479                 delta_kind::states k)
00480   {
00481     op_rdelta(s, v.object(), res, from, query, k);
00482   }
00483 
00484   template<class S, class T, typename OutputIterator, typename L>
00485   void op_letter_delta(const AutomataBase<S>& s,
00486                        const TransposeView<T>& v,
00487                        OutputIterator res,
00488                        hstate_t from,
00489                        const L& letter,
00490                        delta_kind::states k)
00491   {
00492     op_letter_rdelta(s, v.object(), res, from, letter, k);
00493   }
00494 
00495   template<class S, class T, typename OutputIterator>
00496   void op_spontaneous_delta(const AutomataBase<S>& s,
00497                             const TransposeView<T>& v,
00498                             OutputIterator res,
00499                             hstate_t from,
00500                             delta_kind::states k)
00501   {
00502     op_spontaneous_rdelta(s, v.object(), res, from, k);
00503   }
00504 
00505   // output_return_type = Container
00506   // output_type        = hstate_t
00507   // direction          = output
00508 
00509   template<class S, class T, typename Container>
00510   void op_deltac(const AutomataBase<S>& s,
00511                  const TransposeView<T>& v,
00512                  Container& res, hstate_t from, delta_kind::states k)
00513   {
00514     op_rdeltac(s, v.object(), res, from, k);
00515   }
00516 
00517   template<class S, class T, typename Container, typename L>
00518   void op_deltac(const AutomataBase<S>& s,
00519                  const TransposeView<T>& v,
00520                  Container& res,
00521                  hstate_t from,
00522                  const L& query,
00523                  delta_kind::states k)
00524   {
00525     op_rdeltac(s, v.object(), res, from, k);
00526   }
00527 
00528   template<class S, class T, typename Container, typename L>
00529   void op_letter_deltac(const AutomataBase<S>& s,
00530                         const TransposeView<T>& v,
00531                         Container& res,
00532                         hstate_t from,
00533                         const L& letter,
00534                         delta_kind::states k)
00535   {
00536     op_letter_rdeltac(s, v.object(), res, from, letter, k);
00537   }
00538 
00539   template<class S, class T, typename Container>
00540   void op_spontaneous_deltac(const AutomataBase<S>& s,
00541                              const TransposeView<T>& v,
00542                              Container& res,
00543                              hstate_t from,
00544                              delta_kind::states k)
00545   {
00546     op_spontaneous_rdeltac(s, v.object(), res, from, k);
00547   }
00548 
00549   // output_return_type = OutputIterator
00550   // output_type        = htransition_t
00551   // direction          = input
00552 
00553   template<class S, class T, typename OutputIterator>
00554   void op_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00555                  OutputIterator res,
00556                  hstate_t from,
00557                  delta_kind::transitions k)
00558   {
00559     op_delta(s, v.object(), res, from, k);
00560   }
00561 
00562   template<class S, class T, typename OutputIterator, typename L>
00563   void op_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00564                  OutputIterator res,
00565                  hstate_t from,
00566                  const L& query,
00567                  delta_kind::transitions k)
00568   {
00569     op_delta(s, v.object(), res, from, query, k);
00570   }
00571 
00572   template<class S, class T, typename OutputIterator, typename L>
00573   void op_letter_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00574                         OutputIterator res,
00575                         hstate_t from,
00576                         const L& letter,
00577                         delta_kind::transitions k)
00578   {
00579     op_letter_delta(s, v.object(), res, from, letter, k);
00580   }
00581 
00582   template<class S, class T, typename OutputIterator>
00583   void op_spontaneous_rdelta(const AutomataBase<S>& s,
00584                              const TransposeView<T>& v,
00585                              OutputIterator res,
00586                              hstate_t from,
00587                              delta_kind::transitions k)
00588   {
00589     op_spontaneous_delta(s, v.object(), res, from, k);
00590   }
00591 
00592   // output_return_type = Container
00593   // output_type        = htransition_t
00594   // direction          = input
00595 
00596   template<class S, class T, typename Container>
00597   void op_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00598                   Container& res, hstate_t from, delta_kind::transitions k)
00599   {
00600     op_deltac(s, v.object(), res, from, k);
00601   }
00602 
00603   template<class S, class T, typename Container, typename L>
00604   void op_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00605                   Container& res,
00606                   hstate_t from,
00607                   const L& query,
00608                   delta_kind::transitions k)
00609   {
00610     op_deltac(s, v.object(), res, from, query, k);
00611   }
00612 
00613   template<class S, class T, typename Container, typename L>
00614   void op_letter_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00615                          Container& res,
00616                          hstate_t from,
00617                          const L& letter,
00618                          delta_kind::transitions k)
00619   {
00620     op_letter_deltac(s, v.object(), res, from, letter, k);
00621   }
00622 
00623   template<class S, class T, typename Container>
00624   void op_spontaneous_rdeltac(const AutomataBase<S>& s,
00625                               const TransposeView<T>& v,
00626                               Container& res,
00627                               hstate_t from,
00628                               delta_kind::transitions k)
00629   {
00630     op_spontaneous_deltac(s, v.object(), res, from, k);
00631   }
00632 
00633   // output_return_type = OutputIterator
00634   // output_type        = hstate_t
00635   // direction          = input
00636 
00637   template<class S, class T, typename OutputIterator>
00638   void op_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00639                  OutputIterator res,
00640                  hstate_t from,
00641                  delta_kind::states k)
00642   {
00643     op_delta(s, v.object(), res, from, k);
00644   }
00645 
00646   template<class S, class T, typename OutputIterator, typename L>
00647   void op_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00648                  OutputIterator res,
00649                  hstate_t from,
00650                  const L& query,
00651                  delta_kind::states k)
00652   {
00653     op_delta(s, v.object(), res, from, query, k);
00654   }
00655 
00656   template<class S, class T, typename OutputIterator, typename L>
00657   void op_letter_rdelta(const AutomataBase<S>& s, const TransposeView<T>& v,
00658                         OutputIterator res,
00659                         hstate_t from,
00660                         const L& letter,
00661                         delta_kind::states k)
00662   {
00663     op_letter_delta(s, v.object(), res, from, letter, k);
00664   }
00665 
00666   template<class S, class T, typename OutputIterator>
00667   void op_spontaneous_rdelta(const AutomataBase<S>& s,
00668                              const TransposeView<T>& v,
00669                              OutputIterator res,
00670                              hstate_t from,
00671                              delta_kind::states k)
00672   {
00673     op_spontaneous_delta(s, v.object(), res, from, k);
00674   }
00675 
00676   // output_return_type = Container
00677   // output_type        = hstate_t
00678   // direction          = input
00679 
00680   template<class S, class T, typename Container>
00681   void op_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00682                   Container& res, hstate_t from, delta_kind::states k)
00683   {
00684     op_deltac(s, v.object(), res, from, k);
00685   }
00686 
00687   template<class S, class T, typename Container, typename L>
00688   void op_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00689                   Container& res,
00690                   hstate_t from,
00691                   const L& query,
00692                   delta_kind::states k)
00693   {
00694     op_deltac(s, v.object(), res, from, query, k);
00695   }
00696 
00697   template<class S, class T, typename Container, typename L>
00698   void op_letter_rdeltac(const AutomataBase<S>& s, const TransposeView<T>& v,
00699                          Container& res,
00700                          hstate_t from,
00701                          const L& letter,
00702                          delta_kind::states k)
00703   {
00704     op_letter_deltac(s, v.object(), res, from, letter, k);
00705   }
00706 
00707   template<class S, class T, typename Container>
00708   void op_spontaneous_rdeltac(const AutomataBase<S>& s,
00709                               const TransposeView<T>& v,
00710                               Container& res,
00711                               hstate_t from,
00712                               delta_kind::states k)
00713   {
00714     op_spontaneous_deltac(s, v.object(), res, from, k);
00715   }
00716 
00717 } // vcsn
00718 
00719 # undef AutoType
00720 
00721 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_TRANSPOSE_VIEW_HXX

Generated on Sat Jul 29 17:13:13 2006 for Vaucanson by  doxygen 1.4.6