Awali
Another Weighted Automata library
fwd.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_CORE_RAT_FWD_HH
18 # define AWALI_CORE_RAT_FWD_HH
19 
20 # include <memory>
21 
24 
25 namespace awali { namespace sttc
26 {
27  namespace rat
28  {
29 
31  class exp;
32  using exp_t = std::shared_ptr<const exp>;
33 
34  // info.hh
35  template <typename Context>
36  class info;
37 
38  // printer.hh.
39  template <typename Context>
40  class printer;
41 
47  enum class type_t
48  {
49  zero,
50  one,
51  atom,
52  sum,
53  prod,
54  ldiv,
56  shuffle,
57  star,
59  lweight,
60  rweight,
61  complement,
62  };
63 
65  inline constexpr bool is_constant(type_t t)
66  {
67  return (t == type_t::one
68  || t == type_t::zero);
69  }
70 
72  inline constexpr bool is_unary(type_t t)
73  {
74  return (t == type_t::complement
75  || t == type_t::star
76  || t == type_t::transposition);
77  }
78 
80  inline constexpr bool is_variadic(type_t t)
81  {
82  return (t == type_t::conjunction
83  || t == type_t::ldiv
84  || t == type_t::prod
85  || t == type_t::shuffle
86  || t == type_t::sum);
87  }
88 
89  std::ostream&
90  operator<<(std::ostream& o, type_t t);
91 
92 # define DEFINE(Node) \
93  template <typename Label, typename Weight> \
94  class Node
95 
96  DEFINE(node);
97  DEFINE(leaf);
98  DEFINE(atom);
99  DEFINE(inner);
100 
101  DEFINE(const_visitor);
102 
103 # undef DEFINE
104 
105  /*-----------.
106  | constant. |
107  `-----------*/
108 
109  template <type_t Type, typename Label, typename Weight>
110  class constant;
111 
112  template <typename Label, typename Weight>
114 
115  template <typename Label, typename Weight>
117 
118  /*--------.
119  | unary. |
120  `--------*/
121 
122  template <type_t Type, typename Label, typename Weight>
123  class unary;
124 
125  template <typename Label, typename Weight>
127 
128  template <typename Label, typename Weight>
130 
131  template <typename Label, typename Weight>
133 
134  /*-----------.
135  | variadic. |
136  `-----------*/
137 
138  template <type_t Type, typename Label, typename Weight>
139  class variadic;
140 
141  template <typename Label, typename Weight>
143 
144  template <typename Label, typename Weight>
146 
147  template <typename Label, typename Weight>
149 
150  template <typename Label, typename Weight>
152 
153  template <typename Label, typename Weight>
155 
156  /*--------------.
157  | weight_node. |
158  `--------------*/
159 
160  template <type_t Type, typename Label, typename Weight>
161  class weight_node;
162 
163  template <typename Label, typename Weight>
165 
166  template <typename Label, typename Weight>
168 
169 
170 
171  template <typename Label, typename Weight>
172  using ratexp = std::shared_ptr<const node<Label, Weight>>;
173 
174 
175  // ratexpset.hh.
176  template <typename Context>
177  class ratexpset_impl;
178 
179  } // namespace rat
180 
181  template <typename Context>
183 
184 }}//end of ns awali::stc
185 
186 #endif // !AWALI_CORE_RAT_FWD_HH
Definition: ratexp.hh:262
Definition: info.hh:31
Definition: printer.hh:36
A typed ratexp set.
Definition: ratexpset.hh:46
Definition: ratexp.hh:176
An inner node with multiple children.
Definition: ratexp.hh:115
An inner node implementing a weight.
Definition: ratexp.hh:208
#define DEFINE(Node)
Definition: fwd.hh:92
constexpr bool is_unary(type_t t)
Whether star, complement.
Definition: fwd.hh:72
constexpr bool is_constant(type_t t)
Whether is a constant (\z or \e).
Definition: fwd.hh:65
type_t
The possible types of ratexps.
Definition: fwd.hh:48
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
Definition: fwd.hh:80
std::shared_ptr< const node< Label, Weight > > ratexp
Definition: fwd.hh:172
std::ostream & operator<<(std::ostream &o, type_t t)
Definition: printer.hxx:31
std::shared_ptr< const exp > exp_t
Definition: fwd.hh:32
Main namespace of Awali.
Definition: ato.hh:22
Provide a variadic mul on top of a binary mul(), and one().
Definition: weightset.hh:38