Vcsn  2.3a
Be Rational
fwd.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
6 #include <vcsn/misc/type_traits.hh> // detect
8 
9 namespace vcsn
10 {
11  namespace rat
12  {
13 
15  class exp;
16  using exp_t = std::shared_ptr<const exp>;
17 
18  // info.hh
19  template <typename ExpSet>
20  class info;
21 
22  template <typename ExpSet>
24  make_info(const typename ExpSet::value_t& r);
25 
26  // printer.hh.
27  template <typename ExpSet>
28  class printer;
29 
30  template <typename ExpSet>
32  make_printer(const ExpSet& rs, std::ostream& out);
33 
39  enum class type_t
40  {
41  zero,
42  one,
43  atom,
44  add,
45  mul,
46  ldivide,
48  shuffle,
49  infiltrate,
50  star,
52  lweight,
53  rweight,
54  complement,
55  tuple,
56  compose,
57  };
58 
60  inline constexpr bool is_constant(type_t t)
61  {
62  return (t == type_t::one
63  || t == type_t::zero);
64  }
65 
67  inline constexpr bool is_unary(type_t t)
68  {
69  return (t == type_t::complement
70  || t == type_t::star
71  || t == type_t::transposition);
72  }
73 
75  inline constexpr bool is_variadic(type_t t)
76  {
77  return (t == type_t::compose
78  || t == type_t::conjunction
79  || t == type_t::infiltrate
80  || t == type_t::ldivide
81  || t == type_t::mul
82  || t == type_t::shuffle
83  || t == type_t::add);
84  }
85 
87  std::ostream& operator<<(std::ostream& o, type_t t);
88 
89 #define DEFINE(Node) \
90  template <typename Context> \
91  class Node
92 
93  DEFINE(atom);
94  DEFINE(inner);
95  DEFINE(leaf);
96  DEFINE(node);
97 
99 
100 #undef DEFINE
101 
102  /*-----------.
103  | constant. |
104  `-----------*/
105 
106  template <type_t Type, typename Context>
107  class constant;
108 
109  template <typename Context>
111 
112  template <typename Context>
114 
115  /*--------.
116  | unary. |
117  `--------*/
118 
119  template <type_t Type, typename Context>
120  class unary;
121 
122  template <typename Context>
124 
125  template <typename Context>
127 
128  template <typename Context>
130 
131  /*-----------.
132  | variadic. |
133  `-----------*/
134 
135  template <type_t Type, typename Context>
136  class variadic;
137 
138  template <typename Context>
140 
141  template <typename Context>
143 
144  template <typename Context>
146 
147  template <typename Context>
149 
150  template <typename Context>
152 
153  template <typename Context>
155 
156  template <typename Context>
158 
159 
160 
161  /*---------.
162  | tuple. |
163  `---------*/
164 
166  template <typename Context,
167  bool Enable = Context::is_lat>
168  class tuple;
169 
170 
171  /*--------------.
172  | weight_node. |
173  `--------------*/
174 
175  template <type_t Type, typename Context>
176  class weight_node;
177 
178  template <typename Context>
180 
181  template <typename Context>
183 
184 
185 
186  template <typename Context>
187  using expression = std::shared_ptr<const node<Context>>;
188 
189 
190  // expansionset.hh.
191  template <typename ExpSet>
192  struct expansionset;
193 
194  // expressionset.hh.
195  template <typename Context>
196  class expressionset_impl;
197 
198  // size.hh.
199  template <typename ExpSet>
200  size_t size(const ExpSet& rs, const typename ExpSet::value_t& r);
201 
202  } // namespace rat
203 
204  template <typename Context>
206 
207  template <typename ExpSet>
209 
210 } // namespace vcsn
std::shared_ptr< const exp > exp_t
Definition: fwd.hh:16
Implementation of nodes of tuple of rational expressions.
Definition: expression.hh:182
constexpr bool is_unary(type_t t)
Whether star, complement.
Definition: fwd.hh:67
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Definition: automaton.hh:84
Definition: a-star.hh:8
Pretty-printer for rational expressions.
Definition: fwd.hh:28
Gather information of the number of the different node types.
Definition: fwd.hh:20
constexpr bool is_constant(type_t t)
Whether is a constant (\\z or \\e).
Definition: fwd.hh:60
printer< ExpSet > make_printer(const ExpSet &rs, std::ostream &out)
Definition: printer.hh:373
An inner node implementing a weight.
Definition: expression.hh:264
A typed expression set.
std::ostream & operator<<(std::ostream &o, type_t t)
Print a expression type.
Definition: printer.hxx:13
std::shared_ptr< const node< Context >> expression
Definition: fwd.hh:187
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
Definition: fwd.hh:75
An inner node with multiple children.
Definition: expression.hh:118
auto rs
Definition: lift.hh:152
#define DEFINE(Node)
Definition: fwd.hh:89
info< ExpSet > make_info(const typename ExpSet::value_t &r)
Definition: info.hh:195
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
type_t
The possible types of expressions.
Definition: fwd.hh:39
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46