5 #include <boost/range/algorithm/sort.hpp>
27 template <
typename Aut>
74 std::vector<transition_t> ts;
75 for (
auto t :
aut_->out(s))
89 for (
auto s:
aut_->states())
107 for (
auto t:
aut_->initial_transitions())
108 res.emplace_back(
aut_->dst_of(t));
117 for (
auto t:
aut_->final_transitions())
118 res.emplace_back(
aut_->src_of(t));
148 template <
typename Aut>
152 "fado: requires letter or nullable labels");
154 "fado: requires Boolean weights");
166 using super_t::super_t;
174 os_ << (is_deter ?
"@DFA" :
"@NFA");
185 template <
typename A>
192 template <
typename A>
202 template <
typename Aut>
204 fado(
const Aut& aut, std::ostream& out)
224 template <
typename Aut>
228 "grail: requires letter or nullable labels");
230 "grail: requires Boolean weights");
245 using super_t::super_t;
252 const char* sep =
"";
257 aut_->print_state(s, os_);
264 aut_->print_state(s, os_) <<
" -| (FINAL)";
270 template <
typename Aut>
272 grail(
const Aut& aut, std::ostream& out)
automaton_t aut_
The automaton we have to output.
context_t_of< automaton_t > context_t
weightset_t_of< automaton_t > weightset_t
std::ostream & grail(const Aut &aut, std::ostream &out)
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
vcsn::enable_if_t< labelset_t_of< A >::is_free(), bool > is_deterministic_(const A &a)
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
typename std::enable_if< Cond, T >::type enable_if_t
label_t_of< automaton_t > label_t
std::vector< state_t > states_t
A list of states.
virtual void output_transition_(transition_t t) const
Output the transition t.
virtual std::string label_(const label_t &l) const
Convert a label to its representation.
std::ostream & fado(const Aut &aut, std::ostream &out)
states_t finals_()
The list of final states, sorted.
void list_states_(const states_t &ss)
List names of states in ss, preceded by ' '.
void output_transitions_()
Output transitions, sorted lexicographically.
state_t_of< automaton_t > state_t
Provide a variadic mul on top of a binary mul(), and one().
Format an automaton into Fado.
states_t initials_()
The list of initial states, sorted.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
std::string to_string(direction d)
Conversion to string.
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
vcsn::enable_if_t<!labelset_t_of< A >::is_free(), bool > is_deterministic_(const A &)
const polynomialset_t ps_
Short-hand to the polynomialset used to print the entries.
const weightset_t & ws_
Short-hand to the weightset.
outputter(const automaton_t &aut, std::ostream &out)
const labelset_t_of< automaton_t > & ls_
Short-hand to the labelset.
std::ostream & os_
Output stream.
bool is_deterministic(const Aut &aut, state_t_of< Aut > s)
Whether state s is deterministic in aut.
void output_state_(const state_t s)
Output transitions, sorted lexicographically on (Label, Dest).
transition_t_of< automaton_t > transition_t
typename polynomialset_t::value_t polynomial_t
weight_t_of< automaton_t > weight_t
Factor common bits in automaton formatting.
void operator()()
Actually output aut_ on os_.
void operator()()
Actually output aut_ on os_.
auto sort(const Aut &a) -> permutation_automaton< Aut >
Compare transitions of an automaton.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
Format an automaton into Fado.