Vaucanson  1.4.1
random_visitor.hh
1 // random_visitor.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_RAT_RANDOM_VISITOR_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_RANDOM_VISITOR_HH
19 
20 # include <algorithm>
21 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
22 
23 namespace vcsn {
24 
25  namespace rat {
26 
27  template<typename M_, typename W_>
28  class RandomVisitor : public ConstNodeVisitor<M_, W_>
29  {
30  public:
31  enum { nb_star_max_default = 5 };
32 
33  RandomVisitor(unsigned nb_star_max);
34  RandomVisitor();
35 
36  virtual void
37  product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
38  virtual void
39  sum(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
40 
41  virtual void
42  star(const Node<M_, W_>* node);
43 
44  virtual void left_weight(const W_&, const Node<M_, W_>*);
45  virtual void right_weight(const W_&, const Node<M_, W_>*);
46 
47  virtual void
48  constant(const M_& m);
49  virtual void zero();
50  virtual void one();
51 
52  M_ get() const;
53 
54  protected:
55  M_ w_;
56  bool not_empty;
57  unsigned nb_star_max_;
58  };
59 
60  } // rat
61 
62 } // vcsn
63 
64 
65 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
66 # include <vaucanson/algebra/implementation/series/rat/random_visitor.hxx>
67 #endif // VCSN_USE_INTERFACE_ONLY
68 
69 
70 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_RANDOM_VISITOR_HH