19 template <Automaton Aut>
28 template <
typename Ctx = context_t>
64 static auto res =
symbol{
"partition_automaton<" 71 o <<
"partition_automaton<";
76 bool state_has_name(state_t) const 82 print_state_name(state_t s, std::ostream& o, 84 bool delimit = false) const 86 const auto& set = origins_.at(s); 87 const char* separator = ""; 93 input_->print_state_name(s, o, fmt, true); 102 const origins_t& origins() const 108 const automaton_t& input_automaton() const 113 using super_t::new_state; 117 state_t new_state(const state_name_t& set) 119 state_t res = new_state(); 124 template <typename States> 125 auto new_state(const States& ss) 126 -> decltype(*begin(ss) == std::declval<state_t>(), 129 return new_state(state_name_t{begin(ss), end(ss)}); 134 const automaton_t input_; 137 }; // partition_automaton_impl 138 } // namespace detail 141 template <Automaton Aut> 142 using partition_automaton 143 = std::shared_ptr<detail::partition_automaton_impl<Aut>>; 150 template <Automaton Aut> 151 struct origins_t_of_impl; 155 template <Automaton Aut> 156 using origins_t_of = typename origins_t_of_impl<Aut>::type; 158 template <Automaton Aut> 159 struct origins_t_of_impl<partition_automaton<Aut>> 161 using type = typename partition_automaton<Aut>::element_type::origins_t; 164 template <Automaton Aut> 165 struct origins_t_of_impl<transpose_automaton<Aut>> 167 using type = origins_t_of<Aut>; 180 template <Automaton Aut> 181 struct partition_automaton_t_impl 183 using type = partition_automaton<Aut>; 186 template <Automaton Aut> 187 struct partition_automaton_t_impl<partition_automaton<Aut>> 188 : partition_automaton_t_impl<Aut> 191 template <Automaton Aut> 192 struct partition_automaton_t_impl<transpose_automaton<Aut>> 195 = transpose_automaton<typename partition_automaton_t_impl<Aut>::type>; 200 template <Automaton Aut> 201 using partition_automaton_t 202 = typename detail::partition_automaton_t_impl<Aut>::type; 210 template <Automaton Aut> 212 make_partition_automaton(const fresh_automaton_t_of<Aut>& res, 214 const typename detail::partition_automaton_impl<Aut>::origins_t origins) 215 -> partition_automaton_t<Aut> 217 return make_shared_ptr<partition_automaton<Aut>>(res, input, origins); 226 template <Automaton Aut> 228 make_partition_automaton(const fresh_automaton_t_of<Aut>& res, 229 const partition_automaton<Aut>& input, 230 const typename detail::partition_automaton_impl<Aut>::origins_t origins) 231 -> partition_automaton_t<Aut> 233 const auto& input_origins = input->origins(); 235 = typename detail::partition_automaton_impl<Aut>::origins_t; 236 auto new_origins = origins_t{}; 238 for (const auto& p: origins) 239 for (auto s: p.second) 241 .insert(begin(input_origins.at(s)), end(input_origins.at(s))); 243 return make_partition_automaton(res, input->input_automaton(), new_origins); 252 template <Automaton Aut> 254 make_partition_automaton(const fresh_automaton_t_of<transpose_automaton<Aut>>& res, 255 const transpose_automaton<Aut>& input, 256 const typename detail::partition_automaton_impl<Aut>::origins_t origins) 257 -> transpose_automaton<partition_automaton_t<Aut>> 259 return transpose(make_partition_automaton(res->naked_automaton(), 260 input->naked_automaton(), typename detail::state_t_of_impl< base_t< ValueSet > >::type state_t_of
partition_automaton_impl(const fresh_automaton_t<> &res, const automaton_t &input, const origins_t &origins)
std::ostream & print_set(std::ostream &o, format fmt={}) const
partition_automaton_impl(const automaton_t &input)
std::map< state_t, state_name_t > origins_t
A map from each state to the origin state set it stands for.
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
label_t_of< automaton_t > label_t
Aut automaton_t
Input automaton type.
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.
const automaton_t input_
The input automaton.
const origins_t & origins() const
Accessor to the states' origins.
static constexpr auto pre(Args &&... args) -> decltype(element_type::pre(std::forward< Args >(args)...))
origins_t origins_
A map from each state to the origin state set it stands for.
An automaton wrapper whose states form a partition of the state set of another automaton.
typename detail::label_t_of_impl< base_t< ValueSet > >::type label_t_of
static symbol sname()
Static name.
std::set< state_t > state_name_t
The state names: a set of the original automaton states.
state_t_of< automaton_t > state_t
The underlying state type.
Aggregate an automaton, and forward calls to it.
context_t_of< automaton_t > context_t
typename Aut::element_type::template fresh_automaton_t< Context > fresh_automaton_t_of
Given an automaton type, the type of its copies.
fresh_automaton_t_of< automaton_t, Ctx > fresh_automaton_t
Generated automaton type.