Vaucanson  1.4.1
krat_conversion.hh
1 // krat_conversion.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 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_CONVERSION_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_CONVERSION_HH
19 
20 # include <vaucanson/algebra/implementation/series/krat.hh>
21 
22 namespace vcsn {
23 
24  namespace algebra {
25 
26  /*------------------.
27  | ExpConvertVisitor |
28  `------------------*/
29  template<typename Tm, typename Tw, typename oTm, typename oTw,
30  typename Series_>
31  class ExpConvertVisitor : public rat::ConstNodeVisitor<oTm, oTw>
32  {
33  protected:
34  typedef rat::Node<oTm, oTw> node_t;
35  typedef rat::exp<Tm, Tw> exp_t;
36 
37  exp_t exp_;
38  const Series_& series_;
39 
40  public:
41  ExpConvertVisitor(const Series_& s);
42  ~ExpConvertVisitor();
43 
44  virtual void
45  product(const node_t* left_, const node_t* right_);
46 
47  virtual void
48  sum(const node_t* left_, const node_t* right_);
49 
50  virtual void
51  star(const node_t* node_);
52 
53  virtual void
54  left_weight(const oTw& w, const node_t* node_);
55 
56  virtual void
57  right_weight(const oTw& w, const node_t* node_);
58 
59  virtual void
60  constant(const oTm& m_);
61 
62  virtual void
63  one();
64 
65  virtual void
66  zero();
67 
68  const exp_t&
69  get() const;
70  };
71 
72 
73  template<typename Tm, typename Tw, typename W, typename M,
74  typename oTm, typename oTw>
75  rat::exp<Tm, Tw>
76  convert_exp(SELECTOR2(rat::exp<Tm, Tw>),
77  const Series<W, M>& s,
78  const rat::exp<oTm, oTw>& arg);
79 
80  template<typename W, typename M, typename Tm, typename Tw,
81  typename oTm, typename oTw>
82  Element<Series<W, M>, rat::exp<Tm, Tw> >
83  convert_exp(SELECTOR4(Element<Series<W, M>, rat::exp<Tm, Tw> >),
84  const Element<Series<W, M>, rat::exp<oTm, oTw> >& arg);
85 
86  } // algebra
87 
88 } // vcsn
89 
90 
91 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
92 # include <vaucanson/algebra/implementation/series/krat_conversion.hxx>
93 #endif // VCSN_USE_INTERFACE_ONLY
94 
95 
96 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_CONVERSION_HH