Vaucanson  1.4.1
hash_visitor.hh
1 // hash_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_HASH_VISITOR_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_HASH_VISITOR_HH
19 
20 # include <ostream>
21 # include <string>
22 # include <set>
23 
24 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
25 
26 namespace vcsn
27 {
28 
29  namespace rat
30  {
31 
32  template <class Word, class Weight>
33  class HashVisitor : public ConstNodeVisitor<Word, Weight>
34  {
35  public:
36 
37  typedef Word monoid_elt_value_t;
38  typedef Weight semiring_elt_value_t;
39  typedef Node<Word, Weight> node_t;
40 
41  public:
42 
43  HashVisitor();
44  virtual ~HashVisitor();
45 
46  virtual void product(const node_t* lhs, const node_t* rhs);
47  virtual void sum(const node_t* lhs, const node_t* rhs);
48  virtual void star(const node_t* node);
49  virtual void left_weight(const semiring_elt_value_t& w, const node_t* node);
50  virtual void right_weight(const semiring_elt_value_t& w, const node_t* node);
51  virtual void constant(const monoid_elt_value_t& m);
52  virtual void zero();
53  virtual void one();
54 
55  std::size_t hash_value();
56 
57  protected:
58  std::size_t seed_;
59  };
60  } // End of namespace rat.
61 
62 } // End of namespace vcsn.
63 
64 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
65 # include <vaucanson/algebra/implementation/series/rat/hash_visitor.hxx>
66 # endif // VCSN_USE_INTERFACE_ONLY
67 
68 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_DUMP_VISITOR_HH