Awali
Another Weighted Automata library
info.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_INFO_HH
18 # define AWALI_CORE_RAT_INFO_HH
19 
20 # include <iostream>
22 
23 namespace awali { namespace sttc
24 {
25  namespace rat
26  {
27 
28  template <typename RatExpSet>
29  class info
30  : public RatExpSet::const_visitor
31  {
32  public:
33  using ratexpset_t = RatExpSet;
34  using node_t = typename ratexpset_t::node_t;
35  using super_type = typename ratexpset_t::const_visitor;
36 
38  void operator()(const node_t& v);
39 
40 # define DEFINE(Type) \
41  public: \
42  using Type ## _t = typename super_type::Type ## _t; \
43  size_t Type = 0; \
44  \
45  private: \
46  void visit(const Type ## _t& v);
47 
61 
62 # undef DEFINE
63  };
64 
65  } // namespace rat
66 }}//end of ns awali::stc
67 
69 
70 #endif // !AWALI_CORE_RAT_INFO_HH
Definition: ratexp.hh:280
Definition: ratexp.hh:262
Definition: info.hh:31
RatExpSet ratexpset_t
Definition: info.hh:33
void operator()(const node_t &v)
For each node type, count its number of occurrences.
Definition: info.hxx:31
typename ratexpset_t::const_visitor super_type
Definition: info.hh:35
typename ratexpset_t::node_t node_t
Definition: info.hh:34
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(Type)
Definition: info.hh:40
Main namespace of Awali.
Definition: ato.hh:22