5 #include <vcsn/dyn/fwd.hh>
20 template <Automaton Aut>
25 "fado: requires tuple, letter or nullable labels");
27 "fado: requires Boolean weights");
32 using super_t::finals_;
33 using super_t::initials_;
34 using super_t::is_transducer_;
35 using super_t::list_states_;
38 using super_t::print_transitions_;
40 using super_t::super_t;
41 using typename super_t::transition_t;
48 bool is_deter = is_deterministic_(
aut_);
60 template <
typename LS>
61 void print_label_(
const LS& ls,
const typename LS::value_t& l)
const
70 template <
typename Label>
71 void print_label_(
const Label& l, std::false_type)
const
77 template <
typename Label>
78 void print_label_(
const Label& l, std::true_type)
const
80 print_label_(
ls_.template set<0>(), std::get<0>(l));
82 print_label_(
ls_.template set<1>(), std::get<1>(l));
94 template <Automaton A>
95 std::enable_if_t<labelset_t_of<A>::is_free(),
bool>
96 is_deterministic_(
const A& a)
101 template <Automaton A>
102 std::enable_if_t<!labelset_t_of<A>::is_free(),
bool>
103 is_deterministic_(
const A&)
113 template <Automaton Aut>
115 fado(
const Aut& aut, std::ostream&
out = std::cout)
135 template <Automaton Aut>
139 "grail: requires letter or nullable labels");
141 "grail: requires Boolean weights");
145 using typename super_t::automaton_t;
146 using typename super_t::state_t;
147 using typename super_t::transition_t;
150 using super_t::finals_;
151 using super_t::initials_;
153 using super_t::print_transitions_;
155 using super_t::super_t;
162 const char* sep =
"";
174 aut_->print_state(s,
os_) <<
" -| (FINAL)";
183 template <Automaton Aut>
std::ostream & grail(const Aut &aut, std::ostream &out)
Print automaton in Grail format.
transition_t_of< automaton_t > transition_t
Print as is. For instance, don't try to escape labels.
std::ostream & fado(const Aut &aut, std::ostream &out=std::cout)
Format automaton to FAdo format.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
const is_transducer_t is_transducer_
states_t initials_()
The list of initial states, sorted.
bool is_deterministic(const Aut &aut, state_t_of< Aut > s)
Whether state s is deterministic in aut.
states_t finals_()
The list of final states, sorted.
automaton_t aut_
The automaton we have to output.
Provide a variadic mul on top of a binary mul(), and one().
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
const labelset_t_of< automaton_t > & ls_
Short-hand to the labelset.
std::ostream & os_
Output stream.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
Factor common bits in automaton formatting.
void list_states_(const states_t &ss)
List names of states in ss, preceded by ' '.
Print an automaton in Fado format.
Format an automaton into FAdo.
virtual void print_transition_(transition_t t) const
Output the transition t.
void print_transitions_()
Output transitions, sorted lexicographically.