3 #include <unordered_map>
5 #include <vcsn/algos/fwd.hh>
33 template <
typename AutIn,
typename AutOut = AutIn>
42 using state_map_t = std::unordered_map<in_state_t, out_state_t>;
55 template <
typename KeepState,
typename KeepTrans>
56 void operator()(KeepState keep_state, KeepTrans keep_trans,
62 for (
auto s:
in_->states())
66 for (
auto t :
in_->all_transitions())
74 out_->new_transition_copy(src->second, dst->second,
77 out_->add_transition_copy(src->second, dst->second,
114 template <
typename AutIn,
typename AutOut>
123 template <
typename AutIn,
typename AutOut,
124 typename KeepState,
typename KeepTrans>
127 KeepState keep_state, KeepTrans keep_trans)
130 return copy(keep_state, keep_trans);
135 template <
typename AutIn,
typename AutOut,
typename KeepState>
138 copy_into(
const AutIn& in, AutOut& out, KeepState keep_state)
146 template <
typename AutIn,
typename AutOut>
158 template <
typename AutIn,
typename AutOut>
175 template <
typename Aut>
180 template <
typename Aut>
185 template <
typename Aut>
189 -> decltype(aut->context())
191 return aut->context();
195 template <std::
size_t Tape,
typename Aut>
199 -> decltype(aut->full_context())
201 return aut->full_context();
209 template <
typename Aut>
219 template <
typename Aut>
236 template <
typename AutIn,
237 typename AutOut = fresh_automaton_t_of<AutIn>>
249 template <
typename AutIn,
250 typename AutOut = fresh_automaton_t_of<AutIn>,
251 typename KeepState,
typename KeepTrans>
254 copy(
const AutIn& input, KeepState keep_state, KeepTrans keep_trans)
256 auto res = make_fresh_automaton<AutIn, AutOut>(input);
262 template <
typename AutIn,
263 typename AutOut = fresh_automaton_t_of<AutIn>,
267 copy(
const AutIn& input, KeepState keep_state)
269 return ::vcsn::copy<AutIn, AutOut>(
277 template <
typename AutIn,
278 typename AutOut = fresh_automaton_t_of<AutIn>>
283 return ::vcsn::copy<AutIn, AutOut>(
292 template <
typename AutIn,
293 typename AutOut = fresh_automaton_t_of<AutIn>>
298 return ::vcsn::copy<AutIn, AutOut>
305 template <
typename AutIn,
306 typename AutOut = fresh_automaton_t_of<AutIn>>
311 return ::vcsn::copy<AutIn, AutOut>
321 template <
typename Aut,
typename Ctx>
326 const auto& a = aut->as<Aut>();
327 const auto& c = ctx->as<Ctx>();
334 template <
typename Aut>
339 const auto& a = aut->as<Aut>();
354 template <
typename ExpSet,
typename Context,
typename Identities>
360 const auto&
r = exp->as<ExpSet>();
361 const auto& c = ctx->as<Context>();
static auto context(const focus_automaton< Tape, Aut > &aut) -> decltype(aut->full_context())
void copy_into(const AutIn &in, AutOut &out, bool safe)
Copy an automaton.
std::shared_ptr< const detail::context_base > context
A dyn::context.
detail::copier< AutIn, AutOut > make_copier(const AutIn &in, AutOut &out)
Build an automaton copier.
void operator()(bool safe=true)
Copy all the states, and all the transitions.
AutOut make_fresh_automaton(const AutIn &model)
Create an empty, mutable, automaton, based on another one.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
OutExpSet::value_t copy(const InExpSet &in_rs, const OutExpSet &out_rs, const typename InExpSet::value_t &v)
Copy/convert a rational expression.
auto real_context(const Aut &aut) -> decltype(real_context_impl< Aut >::context(aut))
For a focus automaton, its genuine context (not the visible one), and for all the other automata...
Aggregate an automaton, and forward calls to it.
copier(const in_automaton_t &in, out_automaton_t &out)
const state_map_t & state_map() const
A map from original state to result state.
KeepTrans void operator()(KeepState keep_state, KeepTrans keep_trans, bool safe=true)
static auto context(const automaton_decorator< Aut > &aut) -> decltype(real_context(aut->strip()))
std::unordered_map< in_state_t, out_state_t > state_map_t
input state -> output state.
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
state_t_of< in_automaton_t > in_state_t
static dyn::context ctx(const driver &d)
Get the context of the driver.
AutOut copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans)
A copy of input keeping only its states that are accepted by keep_state.
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
out_automaton_t out_
Output automaton.
Provide a variadic mul on top of a binary mul(), and one().
std::shared_ptr< detail::automaton_base > automaton
static identities ids(const driver &d)
Get the identities of the driver.
static auto context(const Aut &aut) -> decltype(aut->context())
void copy_into(const AutIn &in, AutOut &out, KeepState keep_state, KeepTrans keep_trans)
Copy selected states and transitions of an automaton.
state_map_t & state_map()
A map from original state to result state.
expression copy_expression(const expression &exp, const context &ctx, rat::identities ids)
Bridge (copy).
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
expressionset< Context > make_expressionset(const Context &ctx, rat::identities identities={})
Shorthand to expressionset constructor.
An expressionset can implement several different sets of identities on expressions.
expression make_expression(const ExpSet &rs, const typename ExpSet::value_t &r)
state_map_t out_state_
input state -> output state.
std::shared_ptr< detail::focus_automaton_impl< Tape, Aut >> focus_automaton
A focus automaton as a shared pointer.
ATTRIBUTE_PURE bool has(const std::deque< T, Allocator > &s, const T &e)
Whether e is member of s.
std::shared_ptr< detail::expression_base > expression
automaton copy(const automaton &aut)
Bridge.
state_t_of< out_automaton_t > out_state_t
When we copy a focus automaton, create another focus automaton.
automaton copy_convert(const automaton &aut, const context &ctx)
Bridge (copy).
in_automaton_t in_
Input automaton.