Vcsn  2.4
Be Rational
project-automaton.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/algos/copy.hh>
4 #include <vcsn/algos/focus.hh>
5 #include <vcsn/algos/project.hh>
8 #include <vcsn/dyn/name.hh> // integral_constant
9 
10 namespace vcsn
11 {
12 
13  /*----------------------.
14  | project(automaton). |
15  `----------------------*/
16 
17  template <std::size_t Tape, Automaton Aut>
18  auto project(const Aut& aut)
20  {
21  static_assert(Tape < labelset_t_of<Aut>::size(),
22  "project: invalid tape number");
23  auto res = make_mutable_automaton(detail::project<Tape>(aut->context()));
24  copy_into(focus<Tape>(aut), res, false);
25  return res;
26  }
27 
28  namespace dyn
29  {
30  namespace detail
31  {
33  template <Automaton Aut, typename Tape>
34  automaton
36  {
37  const auto& a = aut->as<Aut>();
38  return vcsn::project<Tape::value>(a);
39  }
40  }
41  }
42 }
void copy_into(const AutIn &in, AutOut &out, KeepState keep_state, KeepTrans keep_trans)
Copy selected states and transitions of an automaton.
Definition: copy.hh:267
return res
Definition: multiply.hh:398
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
Definition: fwd.hh:25
auto project(const Aut &aut) -> mutable_automaton< detail::project_context< Tape, context_t_of< Aut >>>
automaton project(const automaton &aut, integral_constant)
Bridge.
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
Definition: traits.hh:63
Definition: a-star.hh:8
A dyn automaton.
Definition: automaton.hh:17
A simple placeholder for integral constants.
Definition: name.hh:196
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37