1 #ifndef VCSN_CORE_RATEXP_AUTOMATON_HH
2 # define VCSN_CORE_RATEXP_AUTOMATON_HH
19 # define DEBUG_IFELSE(Then, Else) Then
21 # define DEBUG_IFELSE(Then, Else) Else
24 # define DEBUG_IF(Then) DEBUG_IFELSE(Then,)
31 template <
typename Aut>
32 class ratexp_automaton_impl
33 :
public automaton_decorator<Aut>
40 using ratexp_t =
typename ratexpset_t::value_t;
57 std::string
vname(
bool full =
true)
const
74 auto i =
map_.find(r);
75 if (i == std::end(
map_))
78 std::cerr <<
"New state: ";
79 rs_.print(r, std::cerr) <<
'\n';
122 const std::string& fmt =
"text",
129 rs_.print(i->second, o, fmt);
140 for (
const auto& p:
map_)
155 #endif // !VCSN_CORE_RATEXP_AUTOMATON_HH
void set_initial(const ratexp_t &s, const weight_t &w)
static constexpr auto sname(Args &&...args) -> decltype(automaton_t::element_type::sname(std::forward< Args >(args)...))
void new_transition(state_t src, const ratexp_t &dst, const label_t &l, const weight_t &w)
bool state_has_name(state_t s) const
state_t state(const ratexp_t &r)
The state for ratexp r.
std::string vname(bool full=true) const
Dynamic name.
typename ratexpset_t::value_t ratexp_t
weight_t_of< super_t > weight_t
auto vname(Args &&...args) const -> decltype(aut_-> vname(std::forward< Args >(args)...))
auto new_state(Args &&...args) -> decltype(aut_-> new_state(std::forward< Args >(args)...))
context_t_of< automaton_t > context_t
std::map< state_t, ratexp_t > origins_t
Ordered map: state -> its derived term.
auto set_initial(Args &&...args) -> decltype(aut_-> set_initial(std::forward< Args >(args)...))
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
void add_transition(state_t src, const ratexp_t &dst, const label_t &l, const weight_t &w)
Aggregate an automaton, and forward calls to it.
std::ostream & print_state_name(state_t s, std::ostream &o, const std::string &fmt="text", bool=false) const
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
Provide a variadic mul on top of a binary mul(), and one().
const origins_t & origins() const
ratexp_automaton_impl(const context_t &ctx)
ratexpset_t rs_
The ratexp's set.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
std::unordered_map< ratexp_t, state_t, vcsn::hash< ratexpset_t >, vcsn::equal_to< ratexpset_t >> smap
Symbolic states to state handlers.
label_t_of< super_t > label_t
static constexpr auto pre(Args &&...args) -> decltype(automaton_t::element_type::pre(std::forward< Args >(args)...))
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
auto add_transition(Args &&...args) -> decltype(aut_-> add_transition(std::forward< Args >(args)...))
smap map_
ratexp -> state.
static std::string sname()
Static name.
identities
A ratexpset can implement several different sets of identities on expressions.
state_t_of< super_t > state_t
auto new_transition(Args &&...args) -> decltype(aut_-> new_transition(std::forward< Args >(args)...))
auto print_state(Args &&...args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...))
variadic_mul_mixin< detail::r_impl > r
bool has(const std::map< Key, Value, Compare, Alloc > &s, const Key &e)
static constexpr auto post(Args &&...args) -> decltype(automaton_t::element_type::post(std::forward< Args >(args)...))
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
std::stack< ratexp_t > todo_
States to visit.