1 #ifndef VCSN_CORE_TUPLE_AUTOMATON_HH
2 # define VCSN_CORE_TUPLE_AUTOMATON_HH
29 template <
typename Aut,
typename... Auts>
40 return "tuple_automaton" +
sname_();
43 std::string
vname(
bool full =
true)
const
45 return "tuple_automaton" +
vname_(full);
58 using label_t =
typename labelset_t::value_t;
59 using weight_t =
typename weightset_t::value_t;
90 const std::string& fmt =
"text",
bool delimit =
false)
113 for (
const auto& p:
pmap_)
114 origins_.emplace(p.second, p.first);
120 template <std::size_t... I>
131 const char* sep =
"";
132 using swallow =
int[];
142 std::string
vname_(
bool full =
true)
const
147 template <
size_t... I>
150 std::string res =
"<" +
aut_->vname(full) +
", ";
151 const char* sep =
"";
152 using swallow =
int[];
155 (res += sep + std::get<I>(
auts_)->
vname(full), sep =
", ", 0)...
167 template <
size_t... I>
181 template <
size_t... I>
197 auto lb =
pmap_.lower_bound(state);
200 lb =
pmap_.emplace_hint(lb, state,
aut_->new_state());
201 todo_.emplace_back(state);
208 return state(std::make_tuple(ss...));
211 template <
size_t... I>
214 const std::string& fmt,
222 const char* sep =
"";
223 using swallow =
int[];
240 using map = std::map<state_name_t, state_t>;
251 template <
typename... Auts>
255 template <
typename... Auts>
262 return make_shared_ptr<res_t>(auts...);
266 #endif // !VCSN_CORE_TUPLE_AUTOMATON_HH
state_t state(state_t_of< Auts >...ss)
bool state_has_name(typename super_t::state_t s) const
std::tuple< state_t_of< Auts >...> state_name_t
State names: Tuple of states of input automata.
std::map< state_t, state_name_t > origins_t
A map from result state to tuple of original states.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
base_t< typename std::tuple_element< I, automata_t >::type > input_automaton_t
The type of the Ith input automaton, unqualified.
state_name_t post_() const
The name of the post of the output automaton.
const origins_t & origins() const
A map from result state to tuple of original states.
state_t state(state_name_t state)
The state in the product corresponding to a pair of states of operands.
auto make_tuple_automaton(const Auts &...auts) -> tuple_automaton< Auts...>
typename labelset_t::value_t label_t
tuple_automaton_impl(const automaton_t &aut, const Auts &...auts)
typename context_t::weightset_t weightset_t
std::ostream & print_state_name(typename super_t::state_t s, std::ostream &o, const std::string &fmt="text", bool delimit=false) const
state_t_of< automaton_t > state_t
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
std::deque< state_name_t > todo_
Worklist of state tuples.
typename context_t::labelset_t labelset_t
An automaton whose states are tuples of states of automata.
Aggregate an automaton, and forward calls to it.
static std::string sname_()
The sname of the sub automata.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
state_name_t pre_() const
The name of the pre of the output automaton.
std::string vname(bool full=true) const
static std::string sname()
std::string vname_(bool full, seq< I...>) const
typename weightset_t::value_t weight_t
state_name_t post_(seq< I...>) const
std::map< state_name_t, state_t > map
Map state-tuple -> result-state.
state_name_t pre_(seq< I...>) const
static constexpr indices_t indices
std::string vname_(bool full=true) const
The vname of the sub automata.
static constexpr auto pre(Args &&...args) -> decltype(automaton_t::element_type::pre(std::forward< Args >(args)...))
std::ostream & print_state_name_(typename super_t::state_t s, std::ostream &o, const std::string &fmt, seq< I...>) const
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
std::shared_ptr< detail::tuple_automaton_impl< Auts...>> tuple_automaton
A product automaton as a shared pointer.
typename std::remove_cv< typename std::remove_reference< T >::type >::type base_t
T without reference or const/volatile qualifiers.
std::tuple< Auts...> automata_t
The type of input automata.
automata_t auts_
Input automata, supplied at construction time.
auto print_state(Args &&...args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...))
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)...))
Aut automaton_t
The type of automaton to wrap.
automaton_t aut_
The wrapped automaton, possibly const.