Vcsn  2.2a
Be Rational
transition.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/misc/empty.hh>
4 
6 
7 namespace vcsn
8 {
9 
10  /*------------------------------------.
11  | possibly_labeled_transition_tuple. |
12  `------------------------------------*/
13 
15  template <typename State, class Label>
17  {
18  using label_t = Label;
20  : src{s}, dst{d}, label{l}
21  {}
22 
23  State src;
24  State dst;
25 
26  label_t get_label() const { return label; }
27  void set_label(label_t& l) { label = l; }
28 
29  private:
30  Label label;
31  };
32 
34  template <typename State>
36  {
37  using label_t = empty_t;
39  : src{s}, dst{d}
40  {}
41 
42  State src;
43  State dst;
44 
45  label_t get_label() const { return {}; }
46  void set_label(label_t) {}
47  };
48 
49 
50  /*-------------------.
51  | transition_tuple. |
52  `-------------------*/
53 
55  template <typename State, class Label, class Weight>
57  : possibly_labeled_transition_tuple<State, Label>
58  {
60  using weight_t = Weight;
61  transition_tuple(State s, State d, Label l, weight_t w)
62  : super_t{s, d, l}
63  , weight{w}
64  {}
65 
66  weight_t get_weight() const { return weight; }
67  void set_weight(weight_t& k) { weight = k; }
68 
69  private:
71  };
72 
79  template <typename State, class Label>
80  struct transition_tuple<State, Label, bool>
81  : possibly_labeled_transition_tuple<State, Label>
82  {
84  using weight_t = bool;
85  transition_tuple(State s, State d, Label l, weight_t)
86  : super_t{s, d, l}
87  {}
88  weight_t get_weight() const { return true; }
89  void set_weight(weight_t& k) ATTRIBUTE_PURE { (void) k; assert(k == true); }
90  };
91 
92 }
weight_t get_weight() const
Definition: transition.hh:66
transition_tuple(State s, State d, Label l, weight_t w)
Definition: transition.hh:61
Transition on non-empty label.
Definition: transition.hh:16
void set_weight(weight_t &k) ATTRIBUTE_PURE
Definition: transition.hh:89
possibly_labeled_transition_tuple(State s, State d, label_t)
Definition: transition.hh:38
possibly_labeled_transition_tuple(State s, State d, label_t l)
Definition: transition.hh:19
transition_tuple(State s, State d, Label l, weight_t)
Definition: transition.hh:85
Empty labels, for LAO.
Definition: empty.hh:8
void set_weight(weight_t &k)
Definition: transition.hh:67
Transition with label and non Boolean weight.
Definition: transition.hh:56
Definition: a-star.hh:8