Vaucanson  1.4.1
automata/concept/handlers.hh
1 // handlers.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_AUTOMATA_CONCEPT_HANDLERS_HH
18 # define VCSN_AUTOMATA_CONCEPT_HANDLERS_HH
19 
20 # include <iostream>
22 
23 namespace vcsn {
24 
25  struct state_h
26  {};
27 
28  struct transition_h
29  {};
30 
31  template<typename Tag, typename Type>
32  class handler
33  {
34  public:
35  typedef Tag kind;
36  typedef handler<Tag, Type> self_t;
37 
38  handler();
39 
40  explicit handler(const Type& h);
41 
42  handler(const self_t& h);
43 
44  self_t& operator=(const self_t& h);
45 
46  Type value() const;
47 
48  operator unsigned() const;
49 
50  bool is_valid() const;
51 
52  protected:
53  Type v_;
54  };
55 
56 
57  template<typename Tag, typename Type>
58  bool operator==(const handler<Tag, Type>& h1,
59  const handler<Tag, Type>& h2);
60 
61  template<typename Tag, typename Type>
62  bool operator!=(const handler<Tag, Type>& h1,
63  const handler<Tag, Type>& h2);
64 
65  template<typename Tag, typename Type>
66  bool operator<(const handler<Tag, Type>& h1,
67  const handler<Tag, Type>& h2);
68 
69  template<typename Tag, typename Type>
70  bool operator>(const handler<Tag, Type>& h1,
71  const handler<Tag, Type>& h2);
72 
73  template<typename Tag, typename Type>
74  bool operator<=(const handler<Tag, Type>& h1,
75  const handler<Tag, Type>& h2);
76 
77  template<typename Tag, typename Type>
78  bool operator>=(const handler<Tag, Type>& h1,
79  const handler<Tag, Type>& h2);
80 
81 } // vcsn
82 
83 namespace std {
84 
85  template <typename Tag, typename Type>
86  std::ostream&
87  operator<<(std::ostream& out, const vcsn::handler<Tag, Type>& h);
88 
89 } // std
90 
91 
92 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
93 # include <vaucanson/automata/concept/handlers.hxx>
94 #endif // VCSN_USE_INTERFACE_ONLY
95 
96 
97 #endif // ! VCSN_AUTOMATA_CONCEPT_HANDLERS_HH