dispatch_visitor.hh

00001 // dispatch_visitor.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2004 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_RAT_DISPATCH_VISITOR_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_DISPATCH_VISITOR_HH
00019 
00020 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
00021 # include <vaucanson/misc/deferrer.hh>
00022 
00023 namespace vcsn
00024 {
00025 
00026   namespace algebra
00027   {
00028 
00029     template <class Matcher, class Monoid, class Semiring>
00030     class DispatchVisitor :
00031       public rat::DefaultMutableNodeVisitor<Monoid, Semiring>
00032     {
00033     public:
00034       typedef Matcher                                   matcher_t;
00035       typedef typename Matcher::return_type             return_type;
00036       typedef Monoid                                    monoid_elt_value_t;
00037       typedef Semiring                                  semiring_elt_value_t;
00038       typedef rat::Node<monoid_elt_value_t, semiring_elt_value_t>       node_t;
00039 
00040       DispatchVisitor(Matcher& m);
00041 
00042       virtual
00043       ~DispatchVisitor();
00044 
00045       virtual void
00046       product(const node_t* lhs, const node_t* rhs);
00047 
00048       virtual void
00049       sum(const node_t* lhs, const node_t* rhs);
00050 
00051       virtual void
00052       star(const node_t* node);
00053 
00054       virtual void
00055       left_weight(const semiring_elt_value_t& w, const node_t* node);
00056 
00057       virtual void
00058       right_weight(const semiring_elt_value_t& w, const node_t* node);
00059 
00060       virtual void
00061       constant(const monoid_elt_value_t& m);
00062 
00063       virtual void
00064       zero();
00065 
00066       virtual void
00067       one();
00068 
00069       return_type get_ret();
00070 
00071     private:
00072       matcher_t&                        matcher_;
00073       utility::Deferrer<return_type>    ret_;
00074     };
00075 
00076     template <class T>
00077     struct DispatchFunction;
00078 
00085     template <class M, class W>
00086     struct DispatchFunction< rat::exp<M, W> >
00087     {
00088       template <class Matcher>
00089       static
00090       typename Matcher::return_type
00091       d(Matcher& matcher, const rat::exp<M, W>& exp);
00092     };
00093 
00094   } // End of namespace algebra.
00095 
00096 } // End of namespace vcsn.
00097 
00098 # ifndef VCSN_USE_INTERFACE_ONLY
00099 #  include <vaucanson/algebra/implementation/series/rat/dispatch_visitor.hxx>
00100 # endif // ! VCSN_USE_INTERFACE_ONLY
00101 
00102 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_DISPATCH_VISITOR_HH

Generated on Fri Jul 28 12:18:31 2006 for Vaucanson by  doxygen 1.4.6