17 #ifndef AWALI_CORE_TUPLE_AUTOMATON_HH
18 # define AWALI_CORE_TUPLE_AUTOMATON_HH
31 namespace awali {
namespace sttc {
45 template <
typename Aut,
typename... Auts>
56 return "tuple_automaton" +
sname_();
74 using label_t =
typename labelset_t::value_t;
75 using weight_t =
typename weightset_t::value_t;
98 const std::string& fmt =
"text")
const
104 using pair_t = std::tuple<state_t_of<Auts>...>;
113 for (
const auto& p:
pmap_)
114 origins_.emplace(p.second, p.first);
120 template <std::size_t... I>
130 std::string res =
"<" + Aut::element_type::sname() +
", ";
131 const char* sep =
"";
132 using swallow =
int[];
135 (res += sep + Auts::element_type::sname(), sep =
", ", 0)...
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>
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[];
227 std::get<I>(
auts_)->print_state_name(std::get<I>(i->second),
240 using map = std::map<pair_t, state_t>;
251 template <
typename... Auts>
255 template <
typename... Auts>
262 return make_shared_ptr<res_t>(auts...);
Aggregate an automaton, and forward calls to it.
Definition: automaton_decorator.hh:36
Aut automaton_t
The type of automaton to wrap.
Definition: automaton_decorator.hh:39
auto print_state(Args &&... args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:154
typename labelset_t::value_t label_t
Definition: automaton_decorator.hh:50
Context context_t
Definition: automaton_decorator.hh:45
typename weightset_t::value_t weight_t
Definition: automaton_decorator.hh:54
typename context_t::labelset_t labelset_t
Definition: automaton_decorator.hh:48
automaton_t aut_
The wrapped automaton, possibly const.
Definition: automaton_decorator.hh:90
typename context_t::weightset_t weightset_t
Definition: automaton_decorator.hh:52
An automaton whose states are tuples of states of automata.
Definition: tuple_automaton.hh:48
map pmap_
Definition: tuple_automaton.hh:241
static std::string sname_()
The sname of the sub automata.
Definition: tuple_automaton.hh:128
std::map< pair_t, state_t > map
Map state-tuple -> result-state.
Definition: tuple_automaton.hh:240
state_t state(pair_t state)
The state in the product corresponding to a pair of states of operands.
Definition: tuple_automaton.hh:195
pair_t post_() const
The name of the post of the output automaton.
Definition: tuple_automaton.hh:176
static constexpr indices_t indices
Definition: tuple_automaton.hh:125
std::string vname_(bool full=true) const
The vname of the sub automata.
Definition: tuple_automaton.hh:142
const origins_t & origins() const
A map from result state to tuple of original states.
Definition: tuple_automaton.hh:110
static std::string sname()
Definition: tuple_automaton.hh:54
std::tuple< Auts... > automata_t
The type of input automata.
Definition: tuple_automaton.hh:79
pair_t pre_(seq< I... >) const
Definition: tuple_automaton.hh:168
pair_t pre_() const
The name of the pre of the output automaton.
Definition: tuple_automaton.hh:162
internal::base_t< typename std::tuple_element< I, automata_t >::type > input_automaton_t
The type of the Ith input automaton, unqualified.
Definition: tuple_automaton.hh:84
origins_t origins_
Definition: tuple_automaton.hh:246
automata_t auts_
Input automata, supplied at construction time.
Definition: tuple_automaton.hh:237
std::ostream & print_state_name_(typename super_t::state_t s, std::ostream &o, const std::string &fmt, seq< I... >) const
Definition: tuple_automaton.hh:213
std::map< state_t, pair_t > origins_t
A map from result state to tuple of original states.
Definition: tuple_automaton.hh:107
std::string vname(bool full=true) const
Definition: tuple_automaton.hh:59
std::deque< pair_t > todo_
Worklist of state tuples.
Definition: tuple_automaton.hh:244
state_t state(state_t_of< Auts >... ss)
Definition: tuple_automaton.hh:206
std::tuple< state_t_of< Auts >... > pair_t
Tuple of states of input automata.
Definition: tuple_automaton.hh:104
automaton_t aut_
The wrapped automaton, possibly const.
Definition: automaton_decorator.hh:90
std::string vname_(bool full, seq< I... >) const
Definition: tuple_automaton.hh:148
pair_t post_(seq< I... >) const
Definition: tuple_automaton.hh:182
tuple_automaton_impl(const automaton_t &aut, const Auts &... auts)
Definition: tuple_automaton.hh:88
std::ostream & print_state_name(typename super_t::state_t s, std::ostream &o, const std::string &fmt="text") const
Definition: tuple_automaton.hh:97
typename std::remove_cv< typename std::remove_reference< T >::type >::type base_t
T without reference or const/volatile qualifiers.
Definition: traits.hh:30
std::shared_ptr< internal::tuple_automaton_impl< Auts... > > tuple_automaton
A product automaton as a shared pointer.
Definition: tuple_automaton.hh:253
typename internal::context_t_of_impl< internal::base_t< ValueSet > >::type context_t_of
Helper to retrieve the type of the context of a value set.
Definition: traits.hh:66
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
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
auto make_tuple_automaton(const Auts &... auts) -> tuple_automaton< Auts... >
Definition: tuple_automaton.hh:258
static const std::string full
Completely version of Awali as a std::string.
Definition: version.hh:42
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21