Vaucanson 1.4
krat_conversion.hh
00001 // krat_conversion.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_CONVERSION_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_CONVERSION_HH
00019 
00020 # include <vaucanson/algebra/implementation/series/krat.hh>
00021 
00022 namespace vcsn {
00023 
00024   namespace algebra {
00025 
00026     /*------------------.
00027     | ExpConvertVisitor |
00028     `------------------*/
00029     template<typename Tm, typename Tw, typename oTm, typename oTw,
00030              typename Series_>
00031     class ExpConvertVisitor : public rat::ConstNodeVisitor<oTm, oTw>
00032     {
00033     protected:
00034       typedef rat::Node<oTm, oTw>               node_t;
00035       typedef rat::exp<Tm, Tw>                  exp_t;
00036 
00037       exp_t                                     exp_;
00038       const Series_&                            series_;
00039 
00040     public:
00041       ExpConvertVisitor(const Series_& s);
00042       ~ExpConvertVisitor();
00043 
00044       virtual void
00045       product(const node_t* left_, const node_t* right_);
00046 
00047       virtual void
00048       sum(const node_t* left_, const node_t* right_);
00049 
00050       virtual void
00051       star(const node_t* node_);
00052 
00053       virtual void
00054       left_weight(const oTw& w, const node_t* node_);
00055 
00056       virtual void
00057       right_weight(const oTw& w, const node_t* node_);
00058 
00059       virtual void
00060       constant(const oTm& m_);
00061 
00062       virtual void
00063       one();
00064 
00065       virtual void
00066       zero();
00067 
00068       const exp_t&
00069       get() const;
00070     };
00071 
00072 
00073     template<typename Tm, typename Tw, typename W, typename M,
00074              typename oTm, typename oTw>
00075     rat::exp<Tm, Tw>
00076     convert_exp(SELECTOR2(rat::exp<Tm, Tw>),
00077                 const Series<W, M>& s,
00078                 const rat::exp<oTm, oTw>& arg);
00079 
00080     template<typename W, typename M, typename Tm, typename Tw,
00081              typename oTm, typename oTw>
00082     Element<Series<W, M>, rat::exp<Tm, Tw> >
00083     convert_exp(SELECTOR4(Element<Series<W, M>, rat::exp<Tm, Tw> >),
00084                 const Element<Series<W, M>, rat::exp<oTm, oTw> >& arg);
00085 
00086   } // algebra
00087 
00088 } // vcsn
00089 
00090 
00091 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00092 # include <vaucanson/algebra/implementation/series/krat_conversion.hxx>
00093 #endif // VCSN_USE_INTERFACE_ONLY
00094 
00095 
00096 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_CONVERSION_HH