- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# 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, 2006 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_geometry(const AutomataBase<S>& s, const TransposeView<T>& v)
    00079   {
    00080     return op_geometry(s, v.object());
    00081   }
    00082
    00083   template <class S, class T>
    00084   typename automaton_traits<T>::geometry_t&
    00085   op_geometry(const AutomataBase<S>& s, TransposeView<T>& v)
    00086   {
    00087     return op_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   typename automaton_traits<T>::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   typename automaton_traits<T>::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   typename automaton_traits<T>::htransition_t
    00127   op_add_transition(const AutomataBase<S>& s, TransposeView<T>& v,
    00128                     const typename automaton_traits<T>::hstate_t& from,
    00129                     const typename automaton_traits<T>::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   typename automaton_traits<T>::htransition_t
    00137   op_add_series_transition(const AutomataBase<S>& s,
    00138                            TransposeView<T>& v,
    00139                            const typename automaton_traits<T>::hstate_t& from,
    00140                            const typename automaton_traits<T>::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   typename automaton_traits<T>::htransition_t
    00148   op_add_spontaneous(const AutomataBase<S>& s, TransposeView<T>& v,
    00149                      const typename automaton_traits<T>::hstate_t& from,
    00150                      const typename automaton_traits<T>::hstate_t& to)
    00151   {
    00152     return op_add_spontaneous(s, v.object(), from, to);
    00153   }
    00154
    00155   template <class S, class T>
    00156   typename automaton_traits<T>::htransition_t
    00157   op_add_letter_transition(const AutomataBase<S>& s, TransposeView<T>& v,
    00158                            const typename automaton_traits<T>::hstate_t& from,
    00159                            const typename automaton_traits<T>::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             const typename automaton_traits<T>::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                const typename automaton_traits<T>::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                     const typename automaton_traits<T>::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                const typename automaton_traits<T>::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                     const typename automaton_traits<T>::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               const typename automaton_traits<T>::htransition_t& e)
    00213   {
    00214     return op_label_of(s, v.object(), e);
    00215   }
    00216
    00217   template <class S, class T>
    00218   const typename Element<S, T>::series_set_elt_t
    00219   op_series_of(const AutomataBase<S>& s,
    00220                const TransposeView<T>& v,
    00221                const typename automaton_traits<T>::htransition_t& e)
    00222   {
    00223     typename Element<S, T>::series_set_elt_t r =
    00224       op_series_of(s, v.object(), e);
    00225     r.transpose();
    00226     return r;
    00227   }
    00228
    00229   template <class S, class T>
    00230   typename Element<S, T>::series_set_elt_value_t
    00231   op_series_value_of(const AutomataBase<S>& s,
    00232                      const TransposeView<T>& v,
    00233                      const typename automaton_traits<T>::htransition_t& e)
    00234   {
    00235     return op_series_value_of(s, v.object(), e);
    00236   }
    00237
    00238   template <class S, class T>
    00239   typename Element<S, T>::monoid_elt_t
    00240   op_word_of(const AutomataBase<S>& s,
    00241              const TransposeView<T>& v,
    00242              const typename automaton_traits<T>::htransition_t& e)
    00243   {
    00244     return op_word_of(s, v.object(), e);
    00245   }
    00246
    00247   template <class S, class T>
    00248   typename Element<S, T>::monoid_elt_value_t
    00249   op_word_value_of(const AutomataBase<S>& s,
    00250                    const TransposeView<T>& v,
    00251                    const typename automaton_traits<T>::htransition_t& e)
    00252   {
    00253     return op_word_value_of(s, v.object(), e);
    00254   }
    00255
    00256   template <class S, class T>
    00257   typename Element<S, T>::letter_t
    00258   op_letter_of(const AutomataBase<S>& s,
    00259                const TransposeView<T>& v,
    00260                const typename automaton_traits<T>::htransition_t& e)
    00261   {
    00262     return op_letter_of(s, v.object(), e);
    00263   }
    00264
    00265   template <class S, class T>
    00266   bool
    00267   op_is_spontaneous(const AutomataBase<S>& s,
    00268                     const TransposeView<T>& v,
    00269                     const typename automaton_traits<T>::htransition_t& e)
    00270   {
    00271     return op_is_spontaneous(s, v.object(), e);
    00272   }
    00273
    00274   template <class S, class T>
    00275   typename automaton_traits<TransposeView<T> >::initial_support_t
    00276   op_initial(const AutomataBase<S>& s, const TransposeView<T>& v)
    00277   {
    00278     return op_final(s, v.object());
    00279   }
    00280
    00281   template <class S, class T>
    00282   typename automaton_traits<TransposeView<T> >::final_support_t
    00283   op_final(const AutomataBase<S>& s, const TransposeView<T>& v)
    00284   {
    00285     return op_initial(s, v.object());
    00286   }
    00287
    00288   template <class S, class T>
    00289   void
    00290   op_set_initial(const AutomataBase<S>& ss, TransposeView<T>& v,
    00291                  const typename automaton_traits<T>::hstate_t& state,
    00292                  const AutoType(series_set_elt_t)& s)
    00293   {
    00294     return op_set_final(ss, v.object(), state, s);
    00295   }
    00296
    00297   template <class S, class T>
    00298   AutoType(series_set_elt_t)
    00299   op_get_initial(const AutomataBase<S>& s,
    00300                  const TransposeView<T>& v,
    00301                  const typename automaton_traits<T>::hstate_t& state)
    00302   {
    00303     AutoType(series_set_elt_t) r = op_get_final(s, v.object(), state);
    00304     r.transpose();
    00305     return r;
    00306   }
    00307
    00308   template <class S, class T>
    00309   void
    00310   op_set_final(const AutomataBase<S>& ss, TransposeView<T>& v,
    00311                const typename automaton_traits<T>::hstate_t& state,
    00312                const typename Element<S, T>::series_set_elt_t& s)
    00313   {
    00314     op_set_initial(ss, v.object(), state, s);
    00315   }
    00316
    00317   template <class S, class T>
    00318   typename Element<S, T>::series_set_elt_t
    00319   op_get_final(const AutomataBase<S>& s,
    00320                const TransposeView<T>& v,
    00321                const typename automaton_traits<T>::hstate_t& state)
    00322   {
    00323     typename Element<S, T>::series_set_elt_t r = op_get_initial(s, v.object(),
    00324                                                                 state);
    00325     r.transpose();
    00326     return r;
    00327   }
    00328
    00329   template <class S, class T>
    00330   void
    00331   op_clear_initial(const AutomataBase<S>& s, TransposeView<T>& v)
    00332   {
    00333     op_clear_final(s, v.object());
    00334   }
    00335
    00336   template <class S, class T>
    00337   void
    00338   op_clear_final(const AutomataBase<S>& s, TransposeView<T>& v)
    00339   {
    00340     op_clear_initial(s, v.object());
    00341   }
    00342
    00343   template <class S, class T>
    00344   typename automaton_traits<T>::hstate_t
    00345   op_src_of(const AutomataBase<S>& s,
    00346             const TransposeView<T>& v,
    00347             const typename automaton_traits<T>::htransition_t& e)
    00348   {
    00349     return op_dst_of(s, v.object(), e);
    00350   }
    00351
    00352   template <class S, class T>
    00353   typename automaton_traits<T>::hstate_t
    00354   op_dst_of(const AutomataBase<S>& s,
    00355             const TransposeView<T>& v,
    00356             const typename automaton_traits<T>::htransition_t& e)
    00357   {
    00358     return op_src_of(s, v.object(), e);
    00359   }
    00360
    00361 } // vcsn
    00362
    00363 # undef AutoType
    00364
    00365 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_TRANSPOSE_VIEW_HXX