Vcsn  2.3
Be Rational
stateset.hh
Go to the documentation of this file.
1 #pragma once
2 
4 #include <vcsn/ctx/traits.hh>
5 #include <vcsn/misc/format.hh>
6 
7 namespace vcsn
8 {
9 
13  template <Automaton Aut>
14  class stateset
15  {
16  public:
17  using automaton_t = Aut;
19 
20  stateset(const automaton_t& aut)
21  : aut_(aut)
22  {}
23 
24  using value_t = state_t;
25 
26  // So that we don't try to print ranges of states.
27  static constexpr bool
29  {
30  return false;
31  }
32 
33  using kind_t = void;
34  static bool equal(state_t l, state_t r)
35  {
36  return l == r;
37  }
38 
39  static bool less(state_t l, state_t r)
40  {
41  return l < r;
42  }
43 
44  static size_t hash(state_t s)
45  {
46  return hash_value(s);
47  }
48 
49  std::ostream&
50  print(state_t s, std::ostream& out, format fmt = {}) const
51  {
52  return aut_->print_state_name(s, out, fmt);
53  }
54 
55  private:
57  };
58 }
std::ostream & print(state_t s, std::ostream &out, format fmt={}) const
Definition: stateset.hh:50
state_t_of< Aut > state_t
Definition: stateset.hh:18
state_t value_t
Definition: stateset.hh:24
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Definition: automaton.hh:64
auto hash_value(const T &v) -> decltype(std::hash< T >
Following the naming convention of Boost.
Definition: functional.hh:30
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
Definition: traits.hh:64
static size_t hash(state_t s)
Definition: stateset.hh:44
static bool less(state_t l, state_t r)
Definition: stateset.hh:39
automaton_t aut_
Definition: stateset.hh:56
Definition: a-star.hh:8
An input/output format for valuesets.
Definition: format.hh:13
State labelset.
Definition: stateset.hh:14
static bool equal(state_t l, state_t r)
Definition: stateset.hh:34
static constexpr bool is_letterized()
Definition: stateset.hh:28
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
weightset_mixin< detail::r_impl > r
Definition: fwd.hh:54
stateset(const automaton_t &aut)
Definition: stateset.hh:20