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/free_monoid/words.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 template <typename S, typename T>
00047 struct linearize_element
00048 {
00049
00050 typedef typename T::semiring_elt_value_t orig_semiring_elt_value_t;
00051 typedef typename S::semiring_t orig_semiring_t;
00052 typedef typename S::monoid_t orig_monoid_t;
00053 typedef typename orig_monoid_t::letter_t orig_letter_t;
00054
00055
00056 typedef int index_t;
00057 typedef std::pair<orig_letter_t, index_t> letter_t;
00058
00059
00060 typedef algebra::AlphabetSet<letter_t> alphabets_t;
00061 typedef std::set<letter_t> alphabet_impl_t;
00062 typedef Element<alphabets_t, alphabet_impl_t> alphabet_t;
00063
00064
00065
00066
00067 typedef algebra::FreeMonoid<alphabet_t> monoid_t;
00068
00069 typedef algebra::Series<orig_semiring_t, monoid_t> series_set_t;
00070 typedef std::basic_string<letter_t, utility::char_traits<letter_t> >
00071 monoid_elt_value_t;
00072 typedef rat::exp<monoid_elt_value_t, orig_semiring_elt_value_t>
00073 series_set_elt_value_t;
00074
00075 typedef Element<series_set_t, series_set_elt_value_t>
00076 element_t;
00077 };
00078
00080 template <class Series, class T>
00081 typename linearize_element<Series, T>::element_t
00082 linearize(const Element<Series, T>& exp);
00083
00086 }
00087
00088 # ifndef VCSN_USE_INTERFACE_ONLY
00089 # include <vaucanson/algorithms/krat_exp_linearize.hxx>
00090 # endif // VCSN_USE_INTERFACE_ONLY
00091
00092 #endif // ! VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH