5 #include <unordered_map> 18 template <Automaton Aut>
19 class permutation_automaton_impl
20 :
public automaton_decorator<fresh_automaton_t_of<Aut>>
27 template <
typename Ctx = context_t>
49 static auto res =
symbol{
"permutation_automaton<" 56 o <<
"permutation_automaton<";
61 bool state_has_name(state_t) const 67 print_state_name(state_t s, std::ostream& o, 69 bool delimit = false) const 71 return input_->print_state_name(origins().at(s), o, fmt, delimit); 77 // Benches show that the map_.emplace technique is slower, and 78 // then that operator[] is faster than emplace. 80 auto i = map_.find(s); 81 if (i == std::end(map_)) 83 res = super_t::new_state(); 93 using origins_t = std::map<state_t, state_name_t>; 100 for (const auto& p: map_) 101 origins_[p.second] = p.first; 105 using pair_t = std::pair<state_name_t, state_t>; 106 std::queue<pair_t> todo_; 109 std::unordered_map<state_name_t, state_t> map_; 111 mutable origins_t origins_; 114 const automaton_t input_; 116 } // namespace detail Aut automaton_t
Input automaton type.
typename detail::state_t_of_impl< base_t< ValueSet > >::type state_t_of
state_t_of< fresh_automaton_t<> > state_t
Sorted automaton state type.
std::queue< pair_t > todo_
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
context_t_of< automaton_t > context_t
typename detail::context_t_of_impl< base_t< ValueSet > >::type context_t_of
static constexpr auto post(Args &&... args) -> decltype(element_type::post(std::forward< Args >(args)...))
An input/output format for valuesets.
state_t_of< automaton_t > state_name_t
Symbolic state name: input automaton state type.
static constexpr auto pre(Args &&... args) -> decltype(element_type::pre(std::forward< Args >(args)...))
static symbol sname()
Static name.
AutOut make_fresh_automaton(const AutIn &model)
Create an empty, mutable, automaton, based on another one.
Aggregate an automaton, and forward calls to it.
permutation_automaton_impl(const automaton_t &input)
std::ostream & print_set(std::ostream &o, format fmt={}) const
fresh_automaton_t_of< automaton_t, Ctx > fresh_automaton_t
Generated automaton type.
const automaton_t input_
Input automaton.
typename Aut::element_type::template fresh_automaton_t< Context > fresh_automaton_t_of
Given an automaton type, the type of its copies.
std::unordered_map< state_name_t, state_t > map_
Input-state -> sorted-state.