Vaucanson  1.4.1
krat_exp_linearize.hh
Go to the documentation of this file.
1 // krat_exp_linearize.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH
18 # define VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH
19 
30 # include <vaucanson/design_pattern/design_pattern.hh>
31 # include <vaucanson/algebra/concept/series_base.hh>
32 # include <vaucanson/algebra/implementation/series/series.hh>
33 # include <vaucanson/algebra/implementation/alphabets/alphabets.hh>
34 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
35 # include <vaucanson/algebra/implementation/letter/couple_letter.hh>
37 # include <vaucanson/algebra/implementation/series/krat.hh>
38 
39 # include <utility>
40 
41 namespace vcsn {
42 
45 // The following line is a potential INTERFACE lines which has been disabled because of the LinExp pseudo-type.
46 // Interface: LinExp linearize(const Exp& e) { return vcsn::linearize(e); }
47 
49  template <typename S, typename T>
51  {
52  // Get types which are useful to build the new type
53  typedef typename T::semiring_elt_value_t orig_semiring_elt_value_t;
54  typedef typename S::semiring_t orig_semiring_t;
55  typedef typename S::monoid_t orig_monoid_t;
56  typedef typename orig_monoid_t::letter_t orig_letter_t;
57 
58  // Build it!
59  typedef int index_t;
60  typedef std::pair<orig_letter_t, index_t> letter_t;
61  // FIXME: Here, we want X<letter_t> where X is the type of the alphabet
62  // FIXME: concept. See next FIXME.
64  typedef std::set<letter_t> alphabet_impl_t;
66  // FIXME: in fact, here we want X<alphabet_t> where X is the type of
67  // FIXME: the monoid concept. For the moment, we just have FreeMonoid, so
68  // FIXME: it is not important but in the future, we will have to introduce
69  // FIXME: a convenient way of substituting types parameters ...
71  // FIXME: same remark here.
73  typedef std::basic_string<letter_t, misc::char_traits<letter_t> >
74  monoid_elt_value_t;
77  // And the resulting type:
79  element_t;
80  };
81 
83  template <class Series, class T>
85  linearize(const Element<Series, T>& exp);
86 
89 } // vcsn
90 
91 # if !defined VCSN_USE_INTERFACE_ONLY && !defined VCSN_USE_LIB
92 # include <vaucanson/algorithms/krat_exp_linearize.hxx>
93 # endif // VCSN_USE_INTERFACE_ONLY
94 
95 #endif // ! VCSN_ALGORITHMS_KRAT_EXP_LINEARIZE_HH