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