17 #ifndef AWALI_ALGOS_DRAW_EXP_HH
18 # define AWALI_ALGOS_DRAW_EXP_HH
29 namespace awali {
namespace sttc {
35 template <
typename RatExpSet>
37 :
public RatExpSet::context_t::const_visitor
50 constexpr
static const char*
me() {
return "draw_exp"; }
60 res_->set_initial(initial_);
61 return std::move(res_);
66 initial_ = res_->add_state();
67 res_->set_state_name(initial_,
"[z]");
72 initial_ = res_->add_state();
73 res_->set_state_name(initial_,
"[e]");
78 std::ostringstream oss;
79 ls_.print(e.value(), oss);
80 initial_ = res_->add_state();
81 res_->set_state_name(initial_,oss.str());
86 state_t initial = res_->add_state();
92 res_->new_transition(initial, initial_, l);
95 res_->set_state_name(initial_,
"[+]");
106 state_t initial = res_->add_state();
112 res_->new_transition(initial, initial_, l);
115 res_->set_state_name(initial_,
"[.]");
120 e.sub()->accept(*
this);
121 state_t initial = res_->add_state();
122 res_->new_transition(initial, initial_,
" ");
124 res_->set_state_name(initial_,
"[*]");
129 e.sub()->accept(*
this);
130 std::ostringstream oss;
132 ws_.print(e.weight(), oss)<<
">";
133 res_->print_state(initial_, oss);
134 res_->set_state_name(initial_,oss.str());
139 e.sub()->accept(*
this);
140 std::ostringstream oss;
141 res_->print_state(initial_, oss) <<
"<";
142 ws_.print(e.weight(), oss)<<
">";
143 res_->set_state_name(initial_,oss.str());
151 return make_shared_ptr<automaton_t>(ct);
158 const label_t epsilon_ = res_->labelset()->special();
159 state_t initial_ = automaton_t::element_type::null_state();
178 template <
typename RatExpSet>
179 mutable_automaton<context<ctx::law_char, b>>
180 draw_exp(
const RatExpSet& rs,
const typename RatExpSet::ratexp_t& exp)
The Boolean semring.
Definition: b.hh:38
The semiring of complex numbers.
Definition: c.hh:44
carries the algebraic settings of automata
Definition: context.hh:40
Definition: ratexp.hh:280
Definition: ratexp.hh:262
Definition: draw_exp.hh:38
drawexp_visitor(const RatExpSet &rs)
Definition: draw_exp.hh:52
ctx::law_char aut_labelset_t
Definition: draw_exp.hh:40
AWALI_RAT_VISIT(one,)
Definition: draw_exp.hh:70
weight_t_of< context_t > weight_t
Definition: draw_exp.hh:46
typename RatExpSet::context_t context_t
Definition: draw_exp.hh:43
AWALI_RAT_VISIT(sum, e)
Definition: draw_exp.hh:84
context< aut_labelset_t, b > aut_context_t
Definition: draw_exp.hh:41
typename context_t::const_visitor super_type
Definition: draw_exp.hh:47
AWALI_RAT_VISIT(star, e)
Definition: draw_exp.hh:118
AWALI_RAT_VISIT(lweight, e)
Definition: draw_exp.hh:127
sttc::mutable_automaton< aut_context_t > automaton_t
Definition: draw_exp.hh:42
constexpr static const char * me()
Definition: draw_exp.hh:50
automaton_t operator()(const typename RatExpSet::ratexp_t &v)
Definition: draw_exp.hh:57
AWALI_RAT_VISIT(rweight, e)
Definition: draw_exp.hh:137
AWALI_RAT_VISIT(zero,)
Definition: draw_exp.hh:64
label_t_of< automaton_t > label_t
Definition: draw_exp.hh:48
AWALI_RAT_VISIT(atom, e)
Definition: draw_exp.hh:76
weightset_t_of< context_t > weightset_t
Definition: draw_exp.hh:44
labelset_t_of< context_t > labelset_t
Definition: draw_exp.hh:45
Definition: ratexp.hh:176
An inner node with multiple children.
Definition: ratexp.hh:115
An inner node implementing a weight.
Definition: ratexp.hh:208
Implementation of labels are words.
Definition: wordset.hh:35
GenSet genset_t
Definition: wordset.hh:37
wordset< sttc::set_alphabet< sttc::char_letters > > law_char
Definition: law_char.hh:28
typename internal::label_t_of_impl< internal::base_t< ValueSet > >::type label_t_of
Helper to retrieve the type of the labels of a value set.
Definition: traits.hh:71
typename internal::weight_t_of_impl< internal::base_t< ValueSet > >::type weight_t_of
Helper to retrieve the type of the weights of a value set.
Definition: traits.hh:81
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
mutable_automaton< context< ctx::law_char, b > > draw_exp(const RatExpSet &rs, const typename RatExpSet::ratexp_t &exp)
Definition: draw_exp.hh:180
std::shared_ptr< internal::mutable_automaton_impl< Context > > mutable_automaton
Definition: mutable_automaton.hh:45
typename internal::weightset_t_of_impl< internal::base_t< ValueSet > >::type weightset_t_of
Helper to retrieve the type of the weightset of a value set.
Definition: traits.hh:86
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21
#define AWALI_RAT_UNSUPPORTED(Type)
Definition: visitor.hh:73