Vcsn  2.2a
Be Rational
vcsn::rat::dot_printer< ExpSet > Class Template Reference

Pretty-printer for rational expressions. More...

#include <dot.hh>

Inheritance diagram for vcsn::rat::dot_printer< ExpSet >:
Collaboration diagram for vcsn::rat::dot_printer< ExpSet >:

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)
 A 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...
 
std::ostream & print (const value_t &v)
 Print an expression as a tree. More...
 

Static Public Member Functions

static constexpr const charme ()
 Name of this algorithm, for error messages. More...
 

Private Types

using tuple_t = typename super_t::tuple_t
 

Private Member Functions

std::ostream & print_ (const node_t &v)
 Easy recursion: print an expression. More...
 
 VCSN_RAT_VISIT (atom, v)
 
 VCSN_RAT_VISIT (complement, v)
 
 VCSN_RAT_VISIT (conjunction, v)
 
 VCSN_RAT_VISIT (infiltration, v)
 
 VCSN_RAT_VISIT (ldiv, v)
 
 VCSN_RAT_VISIT (lweight, v)
 
 VCSN_RAT_VISIT (one, v)
 
 VCSN_RAT_VISIT (prod, v)
 
 VCSN_RAT_VISIT (rweight, v)
 
 VCSN_RAT_VISIT (shuffle, v)
 
 VCSN_RAT_VISIT (star, v)
 
 VCSN_RAT_VISIT (sum, v)
 
 VCSN_RAT_VISIT (transposition, v)
 
 VCSN_RAT_VISIT (zero, v)
 
void visit (const tuple_t &v, std::true_type) override
 
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 constant_t< Type > &n, const char *op)
 Print a nullary node. More...
 
template<rat::exp::type_t Type>
void print_ (const variadic_t< Type > &n, const char *op)
 Print a variadic node. More...
 
std::ostream & 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_trs_
 The expressionset. More...
 
const bool debug_ = !!getenv("VCSN_PARENS")
 Whether to be overly verbose. More...
 
const charlgroup_ = nullptr
 Left and right boundaries (typically braces for LaTeX). More...
 
const charrgroup_ = nullptr
 
const charlangle_ = nullptr
 Left and right angle brackets for weights. More...
 
const charrangle_ = nullptr
 
const charlparen_ = nullptr
 Left and right parentheses. More...
 
const charrparen_ = nullptr
 
const charlexponent_ = nullptr
 Left and right braces for exponents. More...
 
const charrexponent_ = nullptr
 
const charlmul_ = nullptr
 External product. More...
 
const charrmul_ = nullptr
 
const charldiv_ = nullptr
 Quotient. More...
 
const charstar_ = nullptr
 The expression operators. More...
 
const charcomplement_ = nullptr
 
const chartransposition_ = nullptr
 
const charconjunction_ = nullptr
 
const charinfiltration_ = nullptr
 
const charshuffle_ = nullptr
 
const charproduct_ = nullptr
 
const charsum_ = nullptr
 
const chartuple_left = nullptr
 Left tuple delimiter. More...
 
const chartuple_middle = nullptr
 Tuple tape separator. More...
 
const chartuple_right = nullptr
 Right tuple delimiter. More...
 
const charzero_ = nullptr
 The constants. More...
 
const charone_ = nullptr
 
unsigned int exponent_threshold_ = 0
 

Detailed Description

template<typename ExpSet>
class vcsn::rat::dot_printer< ExpSet >

Pretty-printer for rational expressions.

Definition at line 16 of file dot.hh.

Member Typedef Documentation

template<typename ExpSet >
template<type_t Type>
using vcsn::rat::dot_printer< ExpSet >::constant_t = typename super_t::template constant_t<Type>

Definition at line 35 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::context_t = context_t_of<expressionset_t>

Definition at line 24 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::expressionset_t = ExpSet

Definition at line 20 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::identities_t = typename expressionset_t::identities_t

Definition at line 25 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::label_t = label_t_of<context_t>

Definition at line 27 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::labelset_t = labelset_t_of<context_t>

Definition at line 26 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::node_t = typename super_t::node_t

Actual node, without indirection.

Definition at line 31 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::self_t = dot_printer

Definition at line 22 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::super_t = typename expressionset_t::const_visitor

Definition at line 21 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::tuple_t = typename super_t::tuple_t
private

Definition at line 183 of file dot.hh.

template<typename ExpSet >
template<type_t Type>
using vcsn::rat::dot_printer< ExpSet >::unary_t = typename super_t::template unary_t<Type>

Definition at line 37 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::value_t = typename node_t::value_t

A shared_ptr to node_t.

Definition at line 33 of file dot.hh.

template<typename ExpSet >
template<type_t Type>
using vcsn::rat::dot_printer< ExpSet >::variadic_t = typename super_t::template variadic_t<Type>

Definition at line 39 of file dot.hh.

template<typename ExpSet >
using vcsn::rat::dot_printer< ExpSet >::weight_t = weight_t_of<context_t>

Definition at line 28 of file dot.hh.

Constructor & Destructor Documentation

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::dot_printer ( const expressionset_t rs,
std::ostream &  out 
)
inline

A printer.

Definition at line 45 of file dot.hh.

Member Function Documentation

template<typename ExpSet >
static constexpr const char* vcsn::rat::dot_printer< ExpSet >::me ( )
inlinestatic

Name of this algorithm, for error messages.

Definition at line 42 of file dot.hh.

template<typename ExpSet >
std::ostream& vcsn::rat::dot_printer< ExpSet >::operator() ( const value_t v)
inline

Entry point: print v as a complete Dot graph.

Definition at line 144 of file dot.hh.

References vcsn::decendl(), vcsn::iendl(), vcsn::incendl(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print().

Here is the call graph for this function:

template<typename ExpSet >
std::ostream& vcsn::rat::dot_printer< ExpSet >::print ( const value_t v)
inline

Print an expression as a tree.

Definition at line 155 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_().

Referenced by vcsn::rat::dot_printer< ExpSet >::operator()(), and vcsn::rat::dot_printer< ExpSet >::print_().

Here is the call graph for this function:

template<typename ExpSet >
std::ostream& vcsn::rat::dot_printer< ExpSet >::print_ ( const node_t v)
inlineprivate
template<typename ExpSet >
template<rat::exp::type_t Type>
void vcsn::rat::dot_printer< ExpSet >::print_ ( const unary_t< Type > &  n,
const char op 
)
inlineprivate

Print a unary node.

Definition at line 243 of file dot.hh.

References vcsn::address(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print().

Here is the call graph for this function:

template<typename ExpSet >
template<rat::exp::type_t Type>
void vcsn::rat::dot_printer< ExpSet >::print_ ( const constant_t< Type > &  n,
const char op 
)
inlineprivate

Print a nullary node.

Definition at line 254 of file dot.hh.

References vcsn::address(), and vcsn::rat::dot_printer< ExpSet >::out_.

Here is the call graph for this function:

template<typename ExpSet >
template<rat::exp::type_t Type>
void vcsn::rat::dot_printer< ExpSet >::print_ ( const variadic_t< Type > &  n,
const char op 
)
inlineprivate

Print a variadic node.

Definition at line 262 of file dot.hh.

References vcsn::address(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::print().

Here is the call graph for this function:

template<typename ExpSet >
std::ostream& vcsn::rat::dot_printer< ExpSet >::print_ ( const weight_t w)
inlineprivate

Print a weight.

Definition at line 278 of file dot.hh.

References vcsn::address(), vcsn::rat::dot_printer< ExpSet >::fmt_, vcsn::format::for_weights(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::rs_.

Here is the call graph for this function:

template<typename ExpSet >
void vcsn::rat::dot_printer< ExpSet >::print_ ( const lweight_t &  n)
inlineprivate

Print a left-weight.

Definition at line 286 of file dot.hh.

References vcsn::address(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::out_, vcsn::rat::dot_printer< ExpSet >::print(), and vcsn::rat::dot_printer< ExpSet >::print_().

Here is the call graph for this function:

template<typename ExpSet >
void vcsn::rat::dot_printer< ExpSet >::print_ ( const rweight_t &  n)
inlineprivate

Print a right-weight.

Definition at line 299 of file dot.hh.

References vcsn::address(), vcsn::iendl(), vcsn::rat::dot_printer< ExpSet >::out_, vcsn::rat::dot_printer< ExpSet >::print(), and vcsn::rat::dot_printer< ExpSet >::print_().

Here is the call graph for this function:

template<typename ExpSet >
void vcsn::rat::dot_printer< ExpSet >::print_ ( const atom_t &  n)
inlineprivate

Print a label.

Definition at line 312 of file dot.hh.

References vcsn::address(), vcsn::rat::dot_printer< ExpSet >::fmt_, vcsn::format::for_labels(), vcsn::rat::dot_printer< ExpSet >::out_, and vcsn::rat::dot_printer< ExpSet >::rs_.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( atom  ,
 
)
inlineprivate

Definition at line 168 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( complement  ,
 
)
inlineprivate

Definition at line 169 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::complement_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( conjunction  ,
 
)
inlineprivate

Definition at line 170 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::conjunction_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( infiltration  ,
 
)
inlineprivate

Definition at line 171 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::infiltration_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( ldiv  ,
 
)
inlineprivate

Definition at line 172 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::ldiv_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( lweight  ,
 
)
inlineprivate

Definition at line 173 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( one  ,
 
)
inlineprivate

Definition at line 174 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::one_, vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( prod  ,
 
)
inlineprivate

Definition at line 175 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::product_, and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( rweight  ,
 
)
inlineprivate

Definition at line 176 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( shuffle  ,
 
)
inlineprivate

Definition at line 177 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::shuffle_, and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( star  ,
 
)
inlineprivate

Definition at line 178 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::star_, and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( sum  ,
 
)
inlineprivate

Definition at line 179 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::sum_, and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( transposition  ,
 
)
inlineprivate

Definition at line 180 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::rat::dot_printer< ExpSet >::transposition_, and vcsn::detail::v.

Here is the call graph for this function:

template<typename ExpSet >
vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT ( zero  ,
 
)
inlineprivate

Definition at line 181 of file dot.hh.

References vcsn::rat::dot_printer< ExpSet >::print_(), vcsn::detail::v, and vcsn::rat::dot_printer< ExpSet >::zero_.

Here is the call graph for this function:

template<typename ExpSet >
void vcsn::rat::dot_printer< ExpSet >::visit ( const tuple_t v,
std::true_type   
)
inlineoverrideprivate

Definition at line 236 of file dot.hh.

References vcsn::detail::v.

Member Data Documentation

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::complement_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::conjunction_ = nullptr
private
template<typename ExpSet >
const bool vcsn::rat::dot_printer< ExpSet >::debug_ = !!getenv("VCSN_PARENS")
private

Whether to be overly verbose.

Definition at line 327 of file dot.hh.

template<typename ExpSet >
unsigned int vcsn::rat::dot_printer< ExpSet >::exponent_threshold_ = 0
private

Definition at line 369 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
class format vcsn::rat::dot_printer< ExpSet >::fmt_
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::infiltration_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::langle_ = nullptr
private

Left and right angle brackets for weights.

Definition at line 336 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::ldiv_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::lexponent_ = nullptr
private

Left and right braces for exponents.

Definition at line 342 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::lgroup_ = nullptr
private

Left and right boundaries (typically braces for LaTeX).

Used to group operand of unary operators, e.g. "a" -> "a", "a*" -> "{a}^{*}" and "a**" -> "{{a}^{*}}^{*}".

Definition at line 333 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::lmul_ = nullptr
private

External product.

Definition at line 345 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::lparen_ = nullptr
private

Left and right parentheses.

Definition at line 339 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::one_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::product_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::rangle_ = nullptr
private

Definition at line 337 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::rexponent_ = nullptr
private

Definition at line 343 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::rgroup_ = nullptr
private

Definition at line 334 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::rmul_ = nullptr
private

Definition at line 346 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::rparen_ = nullptr
private

Definition at line 340 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::shuffle_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::star_ = nullptr
private

The expression operators.

Definition at line 350 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::sum_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::transposition_ = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::tuple_left = nullptr
private

Left tuple delimiter.

Definition at line 360 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::tuple_middle = nullptr
private
template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::tuple_right = nullptr
private

Right tuple delimiter.

Definition at line 364 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format().

template<typename ExpSet >
const char* vcsn::rat::dot_printer< ExpSet >::zero_ = nullptr
private

The constants.

Definition at line 367 of file dot.hh.

Referenced by vcsn::rat::dot_printer< ExpSet >::format(), and vcsn::rat::dot_printer< ExpSet >::VCSN_RAT_VISIT().


The documentation for this class was generated from the following file: