Vcsn
2.3
Be Rational
|
Pretty-printer for rational expressions. More...
#include <dot.hh>
Classes | |
struct | visit_tuple |
struct | visit_tuple< false, Dummy > |
Public Types | |
using | expressionset_t = ExpSet |
using | super_t = typename expressionset_t::const_visitor |
using | self_t = dot_printer |
using | context_t = context_t_of< expressionset_t > |
using | identities_t = typename expressionset_t::identities_t |
using | labelset_t = labelset_t_of< context_t > |
using | label_t = label_t_of< context_t > |
using | weight_t = weight_t_of< context_t > |
using | node_t = typename super_t::node_t |
Actual node, without indirection. More... | |
using | value_t = typename node_t::value_t |
A shared_ptr to node_t. More... | |
template<type_t Type> | |
using | constant_t = typename super_t::template constant_t< Type > |
template<type_t Type> | |
using | unary_t = typename super_t::template unary_t< Type > |
template<type_t Type> | |
using | variadic_t = typename super_t::template variadic_t< Type > |
Public Member Functions | |
dot_printer (const expressionset_t &rs, std::ostream &out, bool physical=false) | |
A printer. More... | |
template<typename OtherExpSet > | |
dot_printer (const expressionset_t &rs, dot_printer< OtherExpSet > &other) | |
Construct from another dot_printer. More... | |
void | format (format fmt) |
Set output format. More... | |
std::ostream & | operator() (const value_t &v) |
Entry point: print v as a complete Dot graph. More... | |
Static Public Member Functions | |
static constexpr const char * | me () |
Name of this algorithm, for error messages. More... | |
Private Types | |
using | name_t = unsigned |
A type to label the node. More... | |
using | tuple_t = typename super_t::tuple_t |
using | names_t = std::unordered_map< const void *, name_t > |
If physical_ is enabled, register the identifiers of the nodes. More... | |
Private Member Functions | |
name_t | print_ (const value_t &v) |
Easy recursion: print an expression and return its ID. More... | |
name_t | print_ (const node_t &v) |
Easy recursion: print an expression and return its ID. More... | |
VCSN_RAT_VISIT (add, v) | |
VCSN_RAT_VISIT (atom, v) | |
VCSN_RAT_VISIT (complement, v) | |
VCSN_RAT_VISIT (compose, v) | |
VCSN_RAT_VISIT (conjunction, v) | |
VCSN_RAT_VISIT (infiltrate, v) | |
VCSN_RAT_VISIT (ldivide, v) | |
VCSN_RAT_VISIT (lweight, v) | |
VCSN_RAT_VISIT (mul, v) | |
VCSN_RAT_VISIT (one, v) | |
VCSN_RAT_VISIT (rweight, v) | |
VCSN_RAT_VISIT (shuffle, v) | |
VCSN_RAT_VISIT (star, v) | |
VCSN_RAT_VISIT (transposition, v) | |
VCSN_RAT_VISIT (zero, v) | |
void | visit (const tuple_t &v, std::true_type) override |
template<typename Node > | |
std::pair< name_t, bool > | name_ (const Node &n) |
The identifier for this node, and a Boolean stating whether we should traverse (again) this node. More... | |
template<rat::exp::type_t Type> | |
void | print_ (const constant_t< Type > &n, const char *op) |
Print a nullary node. More... | |
template<rat::exp::type_t Type> | |
void | print_ (const unary_t< Type > &n, const char *op) |
Print a unary node. More... | |
template<rat::exp::type_t Type> | |
void | print_ (const variadic_t< Type > &n, const char *op) |
Print a variadic node. More... | |
name_t | print_ (const weight_t &w) |
Print a weight. More... | |
void | print_ (const lweight_t &n) |
Print a left-weight. More... | |
void | print_ (const rweight_t &n) |
Print a right-weight. More... | |
void | print_ (const atom_t &n) |
Print a label. More... | |
Private Attributes | |
std::ostream & | out_ |
Output stream. More... | |
class format | fmt_ |
Output format. More... | |
const expressionset_t & | rs_ |
The expressionset. More... | |
bool | physical_ = false |
Whether to display the physical DAG rather than the logical tree. More... | |
std::shared_ptr< names_t > | names_ = std::make_shared<names_t>() |
A shared_ptr, to support tuples. More... | |
std::shared_ptr< unsigned > | count_ = std::make_shared<unsigned>(0) |
The node counter, used to name the nodes. More... | |
name_t | last_name_ |
The name of the last visited node. More... | |
const char * | lweight_ = nullptr |
External product. More... | |
const char * | rweight_ = nullptr |
const char * | ldivide_ = nullptr |
Quotient. More... | |
const char * | add_ = nullptr |
The expression operators. More... | |
const char * | complement_ = nullptr |
const char * | compose_ = nullptr |
const char * | conjunction_ = nullptr |
const char * | infiltrate_ = nullptr |
const char * | mul_ = nullptr |
const char * | shuffle_ = nullptr |
const char * | star_ = nullptr |
const char * | transposition_ = nullptr |
const char * | tuple_ = nullptr |
Tuple tape separator. More... | |
const char * | zero_ = nullptr |
The constants. More... | |
const char * | one_ = nullptr |
Friends | |
template<typename OtherExpSet > | |
class | dot_printer |
Make it possible to view members from dot_printer's with a different template parameter. More... | |
Pretty-printer for rational expressions.
using vcsn::rat::dot_printer< ExpSet >::constant_t = typename super_t::template constant_t<Type> |
using vcsn::rat::dot_printer< ExpSet >::context_t = context_t_of<expressionset_t> |
using vcsn::rat::dot_printer< ExpSet >::expressionset_t = ExpSet |
using vcsn::rat::dot_printer< ExpSet >::identities_t = typename expressionset_t::identities_t |
using vcsn::rat::dot_printer< ExpSet >::label_t = label_t_of<context_t> |
using vcsn::rat::dot_printer< ExpSet >::labelset_t = labelset_t_of<context_t> |
|
private |
|
private |
using vcsn::rat::dot_printer< ExpSet >::node_t = typename super_t::node_t |
using vcsn::rat::dot_printer< ExpSet >::self_t = dot_printer |
using vcsn::rat::dot_printer< ExpSet >::super_t = typename expressionset_t::const_visitor |
|
private |
using vcsn::rat::dot_printer< ExpSet >::unary_t = typename super_t::template unary_t<Type> |
using vcsn::rat::dot_printer< ExpSet >::value_t = typename node_t::value_t |
using vcsn::rat::dot_printer< ExpSet >::variadic_t = typename super_t::template variadic_t<Type> |
using vcsn::rat::dot_printer< ExpSet >::weight_t = weight_t_of<context_t> |
|
inline |
|
inline |
Construct from another dot_printer.
Used to "fork" new printers in the case of tuples, with sharing of the state.
Definition at line 66 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::out_.
|
inline |
Set output format.
Definition at line 83 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::add_, vcsn::rat::dot_printer< ExpSet >::complement_, vcsn::rat::dot_printer< ExpSet >::compose_, vcsn::rat::dot_printer< ExpSet >::conjunction_, vcsn::rat::dot_printer< ExpSet >::fmt_, vcsn::rat::dot_printer< ExpSet >::infiltrate_, vcsn::format::latex, vcsn::rat::dot_printer< ExpSet >::ldivide_, vcsn::rat::dot_printer< ExpSet >::lweight_, vcsn::rat::dot_printer< ExpSet >::mul_, vcsn::rat::dot_printer< ExpSet >::one_, vcsn::rat::dot_printer< ExpSet >::rs_, vcsn::rat::dot_printer< ExpSet >::rweight_, vcsn::rat::dot_printer< ExpSet >::shuffle_, vcsn::rat::dot_printer< ExpSet >::star_, vcsn::format::text, vcsn::rat::dot_printer< ExpSet >::transposition_, vcsn::rat::dot_printer< ExpSet >::tuple_, vcsn::format::utf8, and vcsn::rat::dot_printer< ExpSet >::zero_.
|
inlinestatic |
|
inlineprivate |
The identifier for this node, and a Boolean stating whether we should traverse (again) this node.
Definition at line 258 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::names_, and vcsn::rat::dot_printer< ExpSet >::physical_.
Referenced by vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::operator()(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
inline |
Entry point: print v as a complete Dot graph.
Definition at line 146 of file dot.hh.
References vcsn::decendl(), vcsn::iendl(), vcsn::incendl(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print_().
|
inlineprivate |
Easy recursion: print an expression and return its ID.
Definition at line 163 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::operator()(), vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::print_(), vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
inlineprivate |
Easy recursion: print an expression and return its ID.
Definition at line 169 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::last_name_.
|
inlineprivate |
Print a nullary node.
Definition at line 273 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::name_(), and vcsn::rat::dot_printer< ExpSet >::out_.
|
inlineprivate |
Print a unary node.
Definition at line 286 of file dot.hh.
References vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print_().
|
inlineprivate |
Print a variadic node.
Definition at line 302 of file dot.hh.
References vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::transform().
|
inlineprivate |
Print a weight.
Definition at line 323 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::fmt_, vcsn::format::for_weights(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, vcsn::res, and vcsn::rat::dot_printer< ExpSet >::rs_.
|
inlineprivate |
Print a left-weight.
Definition at line 334 of file dot.hh.
References vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::lweight_, vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print_().
|
inlineprivate |
Print a right-weight.
Definition at line 350 of file dot.hh.
References vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::rat::dot_printer< ExpSet >::rweight_.
|
inlineprivate |
Print a label.
Definition at line 366 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::fmt_, vcsn::format::for_labels(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::last_name_, vcsn::rat::dot_printer< ExpSet >::name_(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::rs_.
|
inlineprivate |
Definition at line 175 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::add_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 176 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 177 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::complement_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 178 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::compose_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 179 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::conjunction_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 180 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::infiltrate_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 181 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::ldivide_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 182 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 183 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::mul_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 184 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::one_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 185 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::v.
|
inlineprivate |
Definition at line 186 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::shuffle_, and vcsn::v.
|
inlineprivate |
Definition at line 187 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::star_, and vcsn::v.
|
inlineprivate |
Definition at line 188 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::transposition_, and vcsn::v.
|
inlineprivate |
Definition at line 189 of file dot.hh.
References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::v, and vcsn::rat::dot_printer< ExpSet >::zero_.
|
inlineoverrideprivate |
Make it possible to view members from dot_printer's with a different template parameter.
|
private |
The expression operators.
Definition at line 407 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 408 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 409 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 410 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
|
private |
Output format.
Definition at line 382 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Definition at line 411 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
The name of the last visited node.
Definition at line 399 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::operator()(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Quotient.
Definition at line 405 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
External product.
Definition at line 402 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Definition at line 412 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
A shared_ptr, to support tuples.
Definition at line 393 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::name_().
|
private |
Definition at line 422 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Output stream.
Definition at line 380 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::dot_printer(), vcsn::rat::dot_printer< ExpSet >::operator()(), vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::operator()(), vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::print_(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Whether to display the physical DAG rather than the logical tree.
Definition at line 388 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::name_().
|
private |
The expressionset.
Definition at line 384 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::print_(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Definition at line 403 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::print_().
|
private |
Definition at line 413 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 414 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 415 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().
|
private |
Tuple tape separator.
Definition at line 418 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::operator()().
|
private |
The constants.
Definition at line 421 of file dot.hh.
Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().