- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# random_visitor.hh

    00001 // random_visitor.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_RAT_RANDOM_VISITOR_HH
    00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_RANDOM_VISITOR_HH
    00019
    00020 # include <algorithm>
    00021 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
    00022
    00023 namespace vcsn {
    00024
    00025   namespace rat {
    00026
    00027     template<typename M_, typename W_>
    00028     class RandomVisitor : public ConstNodeVisitor<M_, W_>
    00029     {
    00030     public:
    00031       enum { nb_star_max_default = 5 };
    00032
    00033       RandomVisitor(unsigned nb_star_max);
    00034       RandomVisitor();
    00035
    00036       virtual void
    00037       product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
    00038       virtual void
    00039       sum(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
    00040
    00041       virtual void
    00042       star(const Node<M_, W_>* node);
    00043
    00044       virtual void left_weight(const W_&, const Node<M_, W_>*);
    00045       virtual void right_weight(const W_&, const Node<M_, W_>*);
    00046
    00047       virtual void
    00048       constant(const M_& m);
    00049       virtual void zero();
    00050       virtual void one();
    00051
    00052       M_ get() const;
    00053
    00054     protected:
    00055       M_                w_;
    00056       bool              not_empty;
    00057       unsigned          nb_star_max_;
    00058     };
    00059
    00060   } // rat
    00061
    00062 } // vcsn
    00063
    00064
    00065 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00066 # include <vaucanson/algebra/implementation/series/rat/random_visitor.hxx>
    00067 #endif // VCSN_USE_INTERFACE_ONLY
    00068
    00069
    00070 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_RANDOM_VISITOR_HH