Awali
Another Weighted Automata library
visitor.hxx
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2023 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 
19 #include <cassert>
20 
21 namespace awali { namespace sttc
22 {
23  namespace rat
24  {
25 #define VISIT(Type, Name) \
26  template <typename Label, typename Weight> \
27  inline \
28  void \
29  const_visitor<Label, Weight>::visit(const Type ## _t& Name)
30 
31  VISIT(prod, v)
32  {
33  for (auto t : v)
34  t->accept(*this);
35  }
36 
37  VISIT(conjunction, v)
38  {
39  for (auto t : v)
40  t->accept(*this);
41  }
42 
43  VISIT(shuffle, v)
44  {
45  for (auto t : v)
46  t->accept(*this);
47  }
48 
49  VISIT(ldiv, v)
50  {
51  for (auto t : v)
52  t->accept(*this);
53  }
54 
55  VISIT(sum, v)
56  {
57  for (auto t : v)
58  t->accept(*this);
59  }
60 
61  VISIT(star, v)
62  {
63  v.sub()->accept(*this);
64  }
65 
66  VISIT(maybe, v)
67  {
68  v.sub()->accept(*this);
69  }
70 
71  VISIT(plus, v)
72  {
73  v.sub()->accept(*this);
74  }
75 
77  {
78  v.sub()->accept(*this);
79  }
80 
81  VISIT(rweight, v)
82  {
83  v.sub()->accept(*this);
84  }
85 
86  VISIT(complement, v)
87  {
88  v.sub()->accept(*this);
89  }
90 
92  {
93  v.sub()->accept(*this);
94  }
95 
97  {}
98 
99  VISIT(zero, )
100  {}
101 
103  {}
104 
105 #undef VISIT
106 
107  } // namespace rat
108 }}//end of ns awali::stc
Definition: ratexp.hh:280
Definition: ratexp.hh:262
Definition: ratexp.hh:176
An inner node with multiple children.
Definition: ratexp.hh:115
An inner node implementing a weight.
Definition: ratexp.hh:208
variadic< type_t::sum, Label, Weight > sum
Definition: fwd.hh:164
unary< type_t::plus, Label, Weight > plus
Definition: fwd.hh:139
variadic< type_t::ldiv, Label, Weight > ldiv
Definition: fwd.hh:158
variadic< type_t::shuffle, Label, Weight > shuffle
Definition: fwd.hh:161
unary< type_t::transposition, Label, Weight > transposition
Definition: fwd.hh:142
unary< type_t::complement, Label, Weight > complement
Definition: fwd.hh:130
Main namespace of Awali.
Definition: ato.hh:22
#define VISIT(Type, Name)
Definition: visitor.hxx:25