Awali
Another Weighted Automata library
read.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef AWALI_ALGOS_READ_HH
18 # define AWALI_ALGOS_READ_HH
19 
21 
22 namespace awali { namespace sttc {
23 
24 
25  /*-------------.
26  | read_label. |
27  `-------------*/
28 
29  template <typename Context>
30  inline
31  auto
32  read_label(std::istream& is, const Context& ctx)
34  {
35  return ctx.labelset()->conv(is);
36  }
37 
38  /*------------------.
39  | read_polynomial. |
40  `------------------*/
41 
42  template <typename Context>
43  inline
44  auto
45  read_polynomial(const Context& ctx, std::istream& is)
47  {
48  return polynomialset<Context>(ctx).conv(is);
49  }
50 
51  /*--------------.
52  | read_weight. |
53  `--------------*/
54 
55  template <typename Context>
56  inline
57  auto
58  read_weight(const Context& ctx, std::istream& is)
60  {
61  return ctx.weightset()->conv(is);
62  }
63 
64 }}//end of ns awali::stc
65 
66 #endif // !AWALI_ALGOS_READ_HH
Linear combination of labels: map labels to weights.
Definition: polynomialset.hh:69
std::map< label_t, weight_t, internal::less< labelset_t > > value_t
Definition: polynomialset.hh:83
static value_t conv(self_type, value_t v)
Conversion from (this and) other weightsets.
Definition: polynomialset.hh:373
typename internal::label_t_of_impl< internal::base_t< ValueSet > >::type label_t_of
Helper to retrieve the type of the labels of a value set.
Definition: traits.hh:71
typename internal::weight_t_of_impl< internal::base_t< ValueSet > >::type weight_t_of
Helper to retrieve the type of the weights of a value set.
Definition: traits.hh:81
auto read_label(std::istream &is, const Context &ctx) -> label_t_of< Context >
Definition: read.hh:32
auto read_polynomial(const Context &ctx, std::istream &is) -> typename polynomialset< Context >::value_t
Definition: read.hh:45
auto read_weight(const Context &ctx, std::istream &is) -> weight_t_of< Context >
Definition: read.hh:58
Main namespace of Awali.
Definition: ato.hh:22