Vaucanson  1.4.1
krat_exp_transpose.hxx
1 // krat_exp_transpose.hxx: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2004, 2005, 2011 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_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_TRANSPOSE_HXX
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_TRANSPOSE_HXX
19 
20 # include <vaucanson/algebra/concept/series_base.hh>
21 # include <vaucanson/algebra/implementation/series/krat_exp_pattern.hh>
22 
23 
24 namespace vcsn {
25 
26  namespace algebra {
27 
28  template <class Series, class T, class Dispatch>
29  struct KRatExpTranspose : algebra::KRatExpIdentity<
30  KRatExpTranspose<Series, T, Dispatch>,
31  Series,
32  T,
33  Dispatch
34  >
35  {
36  typedef KRatExpTranspose<Series, T, Dispatch> self_t;
37  typedef Element<Series, T> return_type;
38  typedef typename Element<Series, T>::semiring_elt_t semiring_elt_t;
39  typedef typename semiring_elt_t::value_t semiring_elt_value_t;
40  typedef typename Element<Series, T>::monoid_elt_t monoid_elt_t;
41  typedef typename monoid_elt_t::value_t monoid_elt_value_t;
42  typedef typename monoid_elt_t::set_t monoid_t;
43  typedef typename monoid_t::alphabet_t alphabet_t;
44  typedef typename alphabet_t::letter_t letter_t;
45  INHERIT_CONSTRUCTORS(self_t, T, semiring_elt_t, Dispatch);
46 
47  KRatExpTranspose(const Element<Series, T>& exp) :
48  KRatExpIdentity<KRatExpTranspose<Series, T, Dispatch>,
49  Series,
50  T,
51  Dispatch
52  >(exp)
53  {}
54 
55  MATCH__(Product, lhs, rhs)
56  {
57  return this->match(rhs) * this->match(lhs);
58  }
59  END
60 
61  MATCH_(Constant, m)
62  {
63  monoid_elt_t melt (this->exp_.structure().monoid(), m);
64  melt.mirror();
65  return Element<Series, T> (this->exp_.structure(), melt);
66  }
67  END
68 
69  };
70 
71 
72  } // algebra
73 
74 }
75 
76 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_TRANSPOSE_HXX