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