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