Vcsn  2.5.dev
Be Rational
normalize-expansion.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/dyn/algos.hh>
4 #include <vcsn/dyn/value.hh>
5 
6 namespace vcsn
7 {
8  /*--------------.
9  | Expansions. |
10  `--------------*/
11 
13  template <typename ExpansionSet>
14  typename ExpansionSet::value_t
15  denormalize(const ExpansionSet& xs, typename ExpansionSet::value_t x)
16  {
17  return xs.denormalize(x);
18  }
19 
21  template <typename ExpansionSet>
22  bool
23  is_normal(const ExpansionSet& xs, const typename ExpansionSet::value_t& x)
24  {
25  return xs.is_normal(x);
26  }
27 
29  template <typename ExpansionSet>
30  typename ExpansionSet::value_t
31  normalize(const ExpansionSet& xs, typename ExpansionSet::value_t x)
32  {
33  return xs.normalize(x);
34  }
35 
36  namespace dyn
37  {
38  namespace detail
39  {
41  template <typename ExpansionSet>
42  expansion
43  denormalize(const expansion& xpn)
44  {
45  const auto& x = xpn->as<ExpansionSet>();
46  return {x.valueset(), denormalize(x.valueset(), x.value())};
47  }
48 
50  template <typename ExpansionSet>
51  bool
52  is_normal(const expansion& xpn)
53  {
54  const auto& x = xpn->as<ExpansionSet>();
55  return x.valueset().is_normal(x.value());
56  }
57 
59  template <typename ExpansionSet>
60  expansion
62  {
63  const auto& x = xpn->as<ExpansionSet>();
64  return {x.valueset(), normalize(x.valueset(), x.value())};
65  }
66  }
67  }
68 } // vcsn::
auto & as()
Extract wrapped typed value.
Definition: value.hh:55
A dyn Value/ValueSet.
Definition: fwd.hh:29
automaton normalize(const automaton &aut)
Bridge.
Definition: normalize.hh:45
ExpansionSet::value_t normalize(const ExpansionSet &xs, typename ExpansionSet::value_t x)
Normalize an expansion.
bool is_normal(const ExpansionSet &xs, const typename ExpansionSet::value_t &x)
Normalize an expansion.
value_impl< detail::expansion_tag > expansion
Definition: fwd.hh:30
expansion denormalize(const expansion &xpn)
Bridge.
Definition: a-star.hh:8
expansion normalize_expansion(const expansion &xpn)
Bridge (normalize).
bool is_normal(const expansion &xpn)
Bridge.
ExpansionSet::value_t denormalize(const ExpansionSet &xs, typename ExpansionSet::value_t x)
Denormalize an expansion.