Vcsn  2.1
Be Rational
weight-series.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/algos/distance.hh>
4 #include <vcsn/dyn/fwd.hh>
5 #include <vcsn/dyn/automaton.hh>
6 #include <vcsn/dyn/weight.hh>
7 
8 namespace vcsn
9 {
10  template <typename Aut>
11  inline
12  auto
13  weight_series(const Aut& a)
15  {
17  return d(a->pre(), a->post());
18  }
19 
20  namespace dyn
21  {
22  namespace detail
23  {
25  template <typename Aut>
26  weight
28  {
29  const auto& a = aut->as<Aut>();
30  auto res = ::vcsn::weight_series(a);
31  const auto& ctx = a->context();
32  return make_weight(*ctx.weightset(), res);
33  }
34  }
35  }
36 } // namespace vcsn
auto weight_series(const Aut &a) -> weight_t_of< Aut >
weight weight_series(const automaton &aut)
Bridge.
static dyn::context ctx(const driver &d)
Get the context of the driver.
Definition: parse.cc:80
std::shared_ptr< const detail::weight_base > weight
Definition: fwd.hh:86
weight make_weight(const WeightSet &ws, const typename WeightSet::value_t &w)
Definition: weight.hh:79
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69
Wrapper struct to provide the state distance function.
Definition: distance.hh:64
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
Definition: traits.hh:50