00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH
00018 # define VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH
00019
00030 # include <vaucanson/design_pattern/design_pattern.hh>
00031 # include <vaucanson/algebra/concept/series_base.hh>
00032 # include <vaucanson/algebra/implementation/series/series.hh>
00033 # include <vaucanson/algebra/implementation/alphabets/alphabets.hh>
00034 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
00035 # include <vaucanson/algebra/implementation/letter/couple_letter.hh>
00036 # include <vaucanson/misc/char_traits.hh>
00037 # include <vaucanson/algebra/implementation/series/krat.hh>
00038
00039 # include <utility>
00040
00041 namespace vcsn {
00042
00045
00046
00047
00049 template <typename S, typename T>
00050 struct linearize_element
00051 {
00052
00053 typedef typename T::semiring_elt_value_t orig_semiring_elt_value_t;
00054 typedef typename S::semiring_t orig_semiring_t;
00055 typedef typename S::monoid_t orig_monoid_t;
00056 typedef typename orig_monoid_t::letter_t orig_letter_t;
00057
00058
00059 typedef int index_t;
00060 typedef std::pair<orig_letter_t, index_t> letter_t;
00061
00062
00063 typedef algebra::AlphabetSet<letter_t> alphabets_t;
00064 typedef std::set<letter_t> alphabet_impl_t;
00065 typedef Element<alphabets_t, alphabet_impl_t> alphabet_t;
00066
00067
00068
00069
00070 typedef algebra::FreeMonoid<alphabet_t> monoid_t;
00071
00072 typedef algebra::Series<orig_semiring_t, monoid_t> series_set_t;
00073 typedef std::basic_string<letter_t, misc::char_traits<letter_t> >
00074 monoid_elt_value_t;
00075 typedef rat::exp<monoid_elt_value_t, orig_semiring_elt_value_t>
00076 series_set_elt_value_t;
00077
00078 typedef Element<series_set_t, series_set_elt_value_t>
00079 element_t;
00080 };
00081
00083 template <class Series, class T>
00084 typename linearize_element<Series, T>::element_t
00085 linearize(const Element<Series, T>& exp);
00086
00089 }
00090
00091 # if !defined VCSN_USE_INTERFACE_ONLY && !defined VCSN_USE_LIB
00092 # include <vaucanson/algorithms/krat_exp_linearize.hxx>
00093 # endif // VCSN_USE_INTERFACE_ONLY
00094
00095 #endif // ! VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH