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

- File List
- File Members

# pair_to_fmp.hh

Go to the documentation of this file.

    00001 // pair_to_fmp.hh: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2008 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_ALGORITHMS_PAIR_TO_FMP_HH
    00018 # define VCSN_ALGORITHMS_PAIR_TO_FMP_HH
    00019
    00020 # include <map>
    00021 # include <utility>
    00022
    00023 # include <vaucanson/automata/concept/automata.hh>
    00024 # include <vaucanson/algebra/concept/freemonoid_product.hh>
    00025 # include <vaucanson/algebra/implementation/alphabets/alphabet_set.hh>
    00026 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
    00027
    00028 // Needed for op_rout(fmp)
    00029 # include <vaucanson/algebra/implementation/monoid/pair_str_words.hh>
    00030
    00044 // INTERFACE: void pair_to_fmp(const Automaton& a, PairToFMP& b) { return vcsn::pair_to_fmp(*a, *b); }
    00045 // INTERFACE: PairToFMP pair_to_fmp(const Automaton& a) { return vcsn::pair_to_fmp(*a); }
    00046
    00047 namespace vcsn
    00048 {
    00051
    00052
    00053
    00054
    00055   // Helper to mute a pair automaton into its corresponding FMP transducer.
    00056   template <typename S, typename T>
    00057   struct mute_pair_to_fmp
    00058   {
    00059     // The automaton type.
    00060     typedef Element<S, T> automaton_t;
    00061
    00062     // The monoid type.
    00063     typedef typename automaton_t::monoid_elt_t monoid_elt_t;
    00064
    00065     // The alphabet type.
    00066     typedef typename monoid_elt_t::set_t::alphabet_t alphabet_t;
    00067
    00068     // Alphabet traits.
    00069     typedef algebra::alphabet_traits<typename alphabet_t::set_t,
    00070               typename alphabet_t::value_t> alphabet_traits_t;
    00071
    00072     // Word traits.
    00073     typedef algebra::word_traits<typename monoid_elt_t::set_t,
    00074               typename monoid_elt_t::value_t> word_traits_t;
    00075
    00076     // The first computed monoid.
    00077     typedef typename word_traits_t::first_monoid_t first_monoid_t;
    00078
    00079     // The second computed monoid.
    00080     typedef typename word_traits_t::second_monoid_t second_monoid_t;
    00081
    00082     // The semiring type.
    00083     typedef typename automaton_t::semiring_t semiring_t;
    00084
    00085     // The first alphabet type.
    00086     typedef typename first_monoid_t::alphabet_t ret_first_alphabet_t;
    00087
    00088     // The second alphabet type.
    00089     typedef typename second_monoid_t::alphabet_t ret_second_alphabet_t;
    00090
    00091     // The free monoid product type.
    00092
    00093     // 1 - structure
    00094     typedef algebra::FreeMonoidProduct<first_monoid_t,
    00095                                        second_monoid_t> ret_monoid_t;
    00096
    00097     // 2 - implementation
    00098     typedef std::pair<typename word_traits_t::first_projection_t::value_t,
    00099                       typename word_traits_t::second_projection_t::value_t>
    00100         ret_word_impl_t;
    00101
    00102     // 3 - element
    00103     typedef Element<ret_monoid_t, ret_word_impl_t> ret_monoid_elt_t;
    00104
    00105     // The muted automaton type.
    00106
    00107     // 1 - structure
    00108     typedef typename algebra::
    00109         mute_series_traits<typename automaton_t::series_set_t,
    00110                            typename automaton_t::semiring_t,
    00111                            ret_monoid_t>::ret
    00112         ret_series_set_t;
    00113     typedef Automata<ret_series_set_t, typename automaton_t::kind_t> ret_set_t;
    00114
    00115     // 2 - implementation
    00116     typedef typename mute_graph_impl_monoid_traits<typename automaton_t::
    00117         value_t, ret_word_impl_t, undefined_type>::ret ret_impl_t;
    00118
    00119     // 3 - element
    00120     typedef Element<ret_set_t, ret_impl_t> ret;
    00121
    00122     // Automaton "makers".
    00123     static ret
    00124     make_automaton(const ret_first_alphabet_t&, const ret_second_alphabet_t&);
    00125
    00126     static ret
    00127     make_automaton(const automaton_t&);
    00128
    00129     // Series converter.
    00130     static typename ret::series_set_elt_t
    00131     series_convert(const ret_series_set_t&,
    00132                    const typename automaton_t::series_set_elt_t&);
    00133   };
    00134
    00135   template <typename S, typename T>
    00136   void
    00137   pair_to_fmp(const Element<S, T>& aut,
    00138               typename mute_pair_to_fmp<S, T>::ret& res);
    00139
    00140   template <typename S, typename T>
    00141   typename mute_pair_to_fmp<S, T>::ret
    00142   pair_to_fmp(const Element<S, T>& aut);
    00143
    00145
    00148 } // ! vcsn
    00149
    00150 # if !defined VCSN_USE_INTERFACE_ONLY && !defined VCSN_USE_LIB
    00151 #  include <vaucanson/algorithms/pair_to_fmp.hxx>
    00152 # endif // ! VCSN_USE_INTERFACE_ONLY
    00153
    00154 #endif // ! VCSN_ALGORITHMS_PAIR_TO_FMP_HH