Vaucanson  1.4.1
star_height_visitor.hh
1 // star_height_visitor.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2005 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_STAR_HEIGHT_VISITOR_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_STAR_HEIGHT_VISITOR_HH
19 
20 
21 # include <cstddef>
22 
23 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
24 
25 namespace vcsn {
26 
27  namespace rat {
28 
29  template<typename M_, typename W_>
30  class StarHeightVisitor : public ConstNodeVisitor<M_, W_>
31  {
32  protected:
33  void
34  sum_or_product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
35  void
36  weight_or_star(const Node<M_, W_>* node);
37 
38  public:
39  StarHeightVisitor() :
40  h_(0)
41  {}
42 
43  virtual void
44  product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
45 
46  virtual void
47  sum(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
48 
49  virtual void
50  star(const Node<M_, W_>* node);
51 
52  virtual void
53  left_weight(const W_&, const Node<M_, W_>* node);
54 
55  virtual void
56  right_weight(const W_&, const Node<M_, W_>* node);
57 
58  virtual void
59  constant(const M_& m);
60 
61  virtual void zero();
62 
63  virtual void one();
64 
65  size_t get() const;
66 
67  //FIXME!!!
68  size_t set(size_t v)
69  {
70  this->h_ = v;
71  return this->h_;
72  }
73 
74  protected:
75  size_t h_;
76  };
77 
78  } // rat
79 
80 } // vcsn
81 
82 # include <vaucanson/algebra/implementation/series/rat/star_height_visitor.hxx>
83 
84 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_STAR_HEIGHT_VISITOR_HH