00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_REVERSE_VISITOR_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_REVERSE_VISITOR_HH
00019
00020 # include <vaucanson/algebra/concept/series_base.hh>
00021 # include <vaucanson/algebra/concept/semiring_base.hh>
00022 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
00023
00024 namespace vcsn
00025 {
00026
00027 namespace rat
00028 {
00029
00030 template <class Semiring, class Word, class Weight>
00031 class ReverseVisitor :
00032 public rat::DefaultMutableNodeVisitor<Word, Weight>
00033 {
00034 public:
00035 ReverseVisitor(const algebra::SemiringBase<Semiring>& s);
00036
00037 virtual
00038 void
00039 product(rat::Node<Word, Weight>* lhs,
00040 rat::Node<Word, Weight>* rhs);
00041
00042 virtual
00043 void
00044 constant(Word& w);
00045
00046 virtual
00047 void
00048 left_weight(Weight& w);
00049
00050 virtual
00051 void
00052 right_weight(Weight& w);
00053
00054 protected:
00055 template <class S>
00056 static
00057 Weight
00058 transpose(const algebra::SeriesBase<S>&, const Weight&);
00059
00060 template <class S>
00061 static
00062 Weight
00063 transpose(const algebra::SemiringBase<S>&, const Weight&);
00064
00065 const Semiring& s_;
00066 };
00067
00068 }
00069
00070 namespace algebra
00071 {
00072
00073 template <typename S, typename T>
00074 struct DefaultTransposeFun;
00075
00076 template <typename S, typename Word, typename Weight>
00077 struct DefaultTransposeFun< S, rat::exp<Word, Weight> >
00078 {
00079 rat::exp<Word, Weight>&
00080 operator () (const S&, const rat::exp<Word, Weight>& exp);
00081 };
00082
00083 }
00084
00085 }
00086
00087 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00088 # include <vaucanson/algebra/implementation/series/rat/reverse_visitor.hxx>
00089 # endif // ! VCSN_USE_INTERFACE_ONLY
00090
00091 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_REVERSE_VISITOR_HH