14 #include <vcsn/dyn/fwd.hh>
29 template <Automaton Aut>
31 = std::integral_constant<bool,
32 ((context_t_of<Aut>::is_lal
33 || context_t_of<Aut>::is_lan
34 || context_t_of<Aut>::is_lat)
36 template <Automaton Aut>
38 = std::integral_constant<bool,
44 template <Automaton Aut>
47 -> std::enable_if_t<has_fado_t<Aut>{},
void>
52 template <Automaton Aut>
56 -> std::enable_if_t<!has_fado_t<Aut>{},
void>
58 raise(
"print: FAdo requires tuple, letter or nullable labels,"
59 " and Boolean weights");
62 template <Automaton Aut>
65 -> std::enable_if_t<has_grail_t<Aut>{},
void>
70 template <Automaton Aut>
74 -> std::enable_if_t<!has_grail_t<Aut>{},
void>
76 raise(
"print: Grail requires letter or nullable labels,"
77 " and Boolean weights");
81 template <Automaton Aut>
84 std::ostream&
out = std::cout,
const std::string& fmt =
"default")
89 "automaton output format",
91 {
"debug", [](
const Aut& a, std::ostream& o){ a->print(o); }},
92 {
"daut", [](
const Aut& a, std::ostream& o){
daut(a, o); }},
93 {
"dot", [](
const Aut& a, std::ostream& o){
dot(a, o); }},
95 {
"dot,latex", [](
const Aut& a, std::ostream& o)
97 {
"dot,mathjax", [](
const Aut& a, std::ostream& o)
99 {
"dot,utf8", [](
const Aut& a, std::ostream& o)
101 {
"efsm", [](
const Aut& a, std::ostream& o){
efsm(a, o); }},
102 {
"fado", detail::fado_impl_<Aut>},
103 {
"grail", detail::grail_impl_<Aut>},
104 {
"info", [](
const Aut& a, std::ostream& o){
info(a, o, 2); }},
105 {
"info,detailed",[](
const Aut& a, std::ostream& o){
info(a, o, 3); }},
106 {
"info,size", [](
const Aut& a, std::ostream& o){
info(a, o, 1); }},
107 {
"null", [](
const Aut&, std::ostream&){}},
108 {
"tikz", [](
const Aut& a, std::ostream& o){
tikz(a, o); }},
120 template <Automaton Aut,
typename Ostream,
typename String>
122 const std::string& fmt)
124 const auto& a = aut->
as<Aut>();
125 return print(a, o, fmt);
139 template <
typename Context,
typename Ostream,
typename String>
141 const std::string& fmt)
143 const auto& c = ctx->
as<Context>();
144 return c.print_set(o,
format(fmt));
158 template <
typename ValueSet>
160 print(
const ValueSet& vs,
const typename ValueSet::value_t&
v,
161 std::ostream& o = std::cout,
format fmt = {})
163 return vs.print(v, o, format(fmt));
171 template <
typename ExpansionSet,
typename Ostream,
typename String>
174 const std::string& fmt)
176 const auto& e = expansion->
as<ExpansionSet>();
187 template <
typename Context>
191 std::ostream& o = std::cout,
192 const std::string& fmt =
"default")
194 if (fmt ==
"dot" || fmt ==
"dot,logical")
199 else if (fmt ==
"dot,physical")
213 template <
typename ExpSet,
typename Ostream,
typename String>
215 const std::string& fmt)
217 const auto& e = exp->as<ExpSet>();
218 return vcsn::print(e.valueset(), e.value(), o, fmt);
232 template <
typename LabelSet,
typename Ostream,
typename String>
234 const std::string& fmt)
236 const auto& l = label->
as<LabelSet>();
247 template <
typename PolynomialSet>
249 list(
const PolynomialSet& ps,
const typename PolynomialSet::value_t& p,
250 std::ostream& o = std::cout)
253 for (
const auto& m: p)
268 template <
typename PolynomialSet,
typename Ostream>
272 const auto& p = polynomial->
as<PolynomialSet>();
273 return vcsn::list(p.valueset(), p.value(), o);
287 template <
typename PolynomialSet,
typename Ostream,
typename String>
289 std::ostream& o,
const std::string& fmt)
291 const auto& p = polynomial->
as<PolynomialSet>();
307 template <
typename WeightSet,
typename Ostream,
typename String>
309 const std::string& fmt)
std::ostream & grail(const Aut &aut, std::ostream &out)
Print automaton in Grail format.
std::ostream & efsm(const Aut &aut, std::ostream &out=std::cout)
Print automaton to EFSM format, based on FSM format.
format for_labels() const
A copy of this format, but to print labels.
std::ostream & print_polynomial(const polynomial &polynomial, std::ostream &o, const std::string &fmt)
Bridge (print).
An input/output format for valuesets.
Provide a variadic mul on top of a binary mul(), and one().
std::ostream & list_polynomial(const polynomial &polynomial, std::ostream &o)
Bridge (list).
std::ostream & print_expansion(const expansion &expansion, std::ostream &o, const std::string &fmt)
Bridge (print).
auto & as()
Downcast to the exact type.
std::ostream & print_expression(const expression &exp, std::ostream &o, const std::string &fmt)
Bridge (print).
std::integral_constant< bool,((context_t_of< Aut >::is_lal||context_t_of< Aut >::is_lan||context_t_of< Aut >::is_lat)&&std::is_same< weightset_t_of< Aut >, b >::value)> has_fado_t
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
std::ostream & print(const automaton &aut, std::ostream &o, const std::string &fmt)
Bridge.
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_grail_t
Template-less root for contexts.
std::ostream & print_context(const context &ctx, std::ostream &o, const std::string &fmt)
Bridge (print).
std::ostream & fado(const Aut &aut, std::ostream &out=std::cout)
Format automaton to FAdo format.
dot_printer< ExpSet > make_dot_printer(const ExpSet &rs, std::ostream &out, bool physical=false)
std::ostream & dot(const Aut &aut, std::ostream &out=std::cout, format fmt={}, bool mathjax=false)
Print an automaton in Graphviz's Dot format.
auto fado_impl_(const Aut &aut, std::ostream &out) -> std::enable_if_t< has_fado_t< Aut >
std::ostream & print_label(const label &label, std::ostream &o, const std::string &fmt)
Bridge (print).
auto & as()
Extract wrapped typed value.
std::ostream & info(const Aut &aut, std::ostream &out=std::cout, unsigned details=2)
Print info about an automaton.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
std::ostream & daut(const Aut &aut, std::ostream &out=std::cout)
Print an automaton in Daut format.
std::ostream & print_weight(const weight &weight, std::ostream &o, const std::string &fmt)
Bridge (print).
A mapping from strings to Values.
value_impl< detail::expression_tag > expression
std::ostream & tikz(const AutPtr &aut, std::ostream &out)
Print automaton to TikZ format.
auto & as()
Extract wrapped typed automaton.
std::ostream & list(const PolynomialSet &ps, const typename PolynomialSet::value_t &p, std::ostream &o=std::cout)
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
auto grail_impl_(const Aut &aut, std::ostream &out) -> std::enable_if_t< has_grail_t< Aut >