Vaucanson  1.4.1
kinds.hh
1 // kinds.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_KINDS_HH
18 # define VCSN_AUTOMATA_CONCEPT_KINDS_HH
19 
21 # include <iterator>
23 # include <algorithm>
24 
25 # include <vaucanson/algebra/concept/series_base.hh>
26 # include <vaucanson/design_pattern/design_pattern.hh>
27 # include <vaucanson/automata/concept/handlers.hh>
28 
29 namespace vcsn {
30 
31  template <
32  typename Kind,
33  typename Self,
34  typename Series,
35  typename SeriesT,
36  typename LabelT
37  >
38  class AutoKind {};
39 
40  namespace delta_kind {
41 
42  struct transitions
43  {};
44 
45  struct states
46  {};
47 
48  } // delta_kind
49 
50 
51  struct labels_are_series
52  {};
53 
54  template <
55  typename Series,
56  typename MonoidElt,
57  typename SemiringElt,
58  typename L
59  >
60  struct ls_delta_letter_query
61  {
62  ls_delta_letter_query(const Series& s, const L& l);
63 
64  template<typename Label>
65  bool operator()(const Label& label) const;
66 
67  protected:
68  SetSlot<Series> s_;
69  typename MonoidElt::value_t l_;
70  };
71 
72  /*--------------------------------.
73  | AutoKind<labels_are_series ...> |
74  `--------------------------------*/
76 
82  template <
83  typename Self,
84  typename Series,
85  typename SeriesT,
86  typename LabelT
87  >
88  class AutoKind<labels_are_series, Self, Series, SeriesT, LabelT>
89  {
90  protected:
91  typedef typename Self::hstate_t hstate_t;
92  typedef typename Self::htransition_t htransition_t;
94  typedef typename Series::monoid_t monoid_t;
95  typedef typename series_set_elt_t::monoid_elt_t monoid_elt_t;
96  typedef typename Series::semiring_t semiring_t;
97  typedef typename series_set_elt_t::semiring_elt_t semiring_elt_t;
98 
99  public:
100 
101  series_set_elt_t series_of(htransition_t e) const;
102 
103  const SeriesT& series_value_of(htransition_t e) const;
104 
105  bool is_spontaneous(htransition_t e) const;
106 
107  template<typename L>
108  L letter_of(SELECTOR(L), htransition_t e) const;
109 
110  monoid_elt_t word_of(htransition_t e) const;
111 
112  const typename monoid_elt_t::value_t& word_value_of(htransition_t e) const;
113 
114  template<typename S>
115  htransition_t add_series_transition(hstate_t from, hstate_t to,
116  const S& e);
117 
118  htransition_t add_spontaneous(hstate_t from, hstate_t to);
119 
120  template<typename L>
121  htransition_t add_letter_transition(hstate_t from, hstate_t to,
122  const L& l);
123 
124  protected:
125  Self& auto_self();
126  const Self& auto_self() const;
127  };
128 
129 }
130 
131 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
132 # include <vaucanson/automata/concept/kinds.hxx>
133 #endif // VCSN_USE_INTERFACE_ONLY
134 
135 
136 #endif // ! VCSN_AUTOMATA_CONCEPT_KINDS_HH