13 #include <vcsn/dyn/fwd.hh>
28 template <Automaton Aut>
30 = std::integral_constant<bool,
31 ((context_t_of<Aut>::is_lal
32 || context_t_of<Aut>::is_lan)
35 template <Automaton Aut>
38 -> std::enable_if_t<has_fado_t<Aut>{},
void>
43 template <Automaton Aut>
47 -> std::enable_if_t<!has_fado_t<Aut>{},
void>
49 raise(
"print: FAdo requires letter or nullable labels,"
50 " and Boolean weights");
53 template <Automaton Aut>
56 -> std::enable_if_t<has_fado_t<Aut>{},
void>
61 template <Automaton Aut>
65 -> std::enable_if_t<!has_fado_t<Aut>{},
void>
67 raise(
"print: Grail requires letter or nullable labels,"
68 " and Boolean weights");
72 template <Automaton Aut>
75 std::ostream&
out = std::cout,
const std::string& fmt =
"default")
80 "automaton output format",
82 {
"debug", [](
const Aut& a, std::ostream& o){ a->print(o); }},
83 {
"dot", [](
const Aut& a, std::ostream& o){
dot(a, o); }},
85 {
"dot,latex", [](
const Aut& a, std::ostream& o)
87 {
"dot,utf8", [](
const Aut& a, std::ostream& o)
89 {
"efsm", [](
const Aut& a, std::ostream& o){
efsm(a, o); }},
90 {
"fado", detail::fado_impl_<Aut>},
91 {
"grail", detail::grail_impl_<Aut>},
92 {
"info", [](
const Aut& a, std::ostream& o){
info(a, o); }},
93 {
"info,detailed",[](
const Aut& a, std::ostream& o){
info(a, o,
true); }},
94 {
"null", [](
const Aut&, std::ostream&){}},
95 {
"tikz", [](
const Aut& a, std::ostream& o){
tikz(a, o); }},
107 template <Automaton Aut,
typename Ostream,
typename String>
109 const std::string& fmt)
111 const auto& a = aut->
as<Aut>();
112 return print(a, o, fmt);
126 template <
typename Context,
typename Ostream,
typename String>
128 const std::string& fmt)
130 const auto& c = ctx->
as<Context>();
131 return c.print_set(o,
format(fmt));
143 template <
typename ValueSet>
145 print(
const ValueSet& vs,
const typename ValueSet::value_t&
v,
146 std::ostream& o = std::cout,
format fmt = {})
148 return vs.print(v, o, format(fmt));
156 template <
typename ExpansionSet,
typename Ostream,
typename String>
159 const std::string& fmt)
161 const auto& e = expansion->
as<ExpansionSet>();
172 template <
typename Context>
176 std::ostream& o = std::cout,
177 const std::string& fmt =
"default")
179 if (fmt ==
"dot" || fmt ==
"dot,logical")
184 else if (fmt ==
"dot,physical")
198 template <
typename ExpSet,
typename Ostream,
typename String>
200 const std::string& fmt)
202 const auto& e = exp->as<ExpSet>();
203 return vcsn::print(e.valueset(), e.value(), o, fmt);
217 template <
typename LabelSet,
typename Ostream,
typename String>
219 const std::string& fmt)
221 const auto& l = label->
as<LabelSet>();
231 template <
typename PolynomialSet>
233 list(
const PolynomialSet& ps,
const typename PolynomialSet::value_t& p,
234 std::ostream& o = std::cout)
237 for (
const auto& m: p)
252 template <
typename PolynomialSet,
typename Ostream>
256 const auto& p = polynomial->
as<PolynomialSet>();
257 return vcsn::list(p.valueset(), p.value(), o);
271 template <
typename PolynomialSet,
typename Ostream,
typename String>
273 std::ostream& o,
const std::string& fmt)
275 const auto& p = polynomial->
as<PolynomialSet>();
291 template <
typename WeightSet,
typename Ostream,
typename String>
293 const std::string& fmt)
std::ostream & efsm(const Aut &aut, std::ostream &out=std::cout)
Print automaton to EFSM format, based on FSM format.
dot_printer< ExpSet > make_dot_printer(const ExpSet &rs, std::ostream &out, bool physical=false)
std::ostream & print_label(const label &label, std::ostream &o, const std::string &fmt)
Bridge (print).
std::ostream & list(const PolynomialSet &ps, const typename PolynomialSet::value_t &p, std::ostream &o=std::cout)
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
auto & as()
Downcast to the exact type.
std::ostream & print_expression(const expression &exp, std::ostream &o, const std::string &fmt)
Bridge (print).
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
Template-less root for contexts.
auto grail_impl_(const Aut &aut, std::ostream &out) -> std::enable_if_t< has_fado_t< Aut >
std::ostream & print_expansion(const expansion &expansion, std::ostream &o, const std::string &fmt)
Bridge (print).
std::ostream & tikz(const AutPtr &aut, std::ostream &out)
Print automaton to TikZ format.
std::ostream & list_polynomial(const polynomial &polynomial, std::ostream &o)
Bridge (list).
std::ostream & grail(const Aut &aut, std::ostream &out)
Print automaton in Grail format.
An input/output format for valuesets.
std::integral_constant< bool,((context_t_of< Aut >::is_lal||context_t_of< Aut >::is_lan)&&std::is_same< weightset_t_of< Aut >, b >::value)> has_fado_t
std::ostream & fado(const Aut &aut, std::ostream &out=std::cout)
Format automaton to FAdo format.
std::ostream & print_weight(const weight &weight, std::ostream &o, const std::string &fmt)
Bridge (print).
std::ostream & print(const automaton &aut, std::ostream &o, const std::string &fmt)
Bridge.
std::ostream & dot(const Aut &aut, std::ostream &out=std::cout, format fmt={})
Print an automaton in Graphviz's Dot format.
auto & as()
Extract wrapped typed value.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
auto & as()
Extract wrapped typed automaton.
A mapping from strings to Values.
std::ostream & info(const Aut &aut, std::ostream &out=std::cout, bool detailed=false)
Print info about an automaton.
Provide a variadic mul on top of a binary mul(), and one().
value_impl< detail::expression_tag > expression
std::ostream & print_polynomial(const polynomial &polynomial, std::ostream &o, const std::string &fmt)
Bridge (print).
auto fado_impl_(const Aut &aut, std::ostream &out) -> std::enable_if_t< has_fado_t< Aut >
std::ostream & print_context(const context &ctx, std::ostream &o, const std::string &fmt)
Bridge (print).