Vcsn  2.2
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  sum,
45  prod,
46  ldiv,
48  shuffle,
50  star,
52  lweight,
53  rweight,
54  complement,
55  tuple,
56  };
57 
59  inline constexpr bool is_constant(type_t t)
60  {
61  return (t == type_t::one
62  || t == type_t::zero);
63  }
64 
66  inline constexpr bool is_unary(type_t t)
67  {
68  return (t == type_t::complement
69  || t == type_t::star
70  || t == type_t::transposition);
71  }
72 
74  inline constexpr bool is_variadic(type_t t)
75  {
76  return (t == type_t::conjunction
77  || t == type_t::infiltration
78  || t == type_t::ldiv
79  || t == type_t::prod
80  || t == type_t::shuffle
81  || t == type_t::sum);
82  }
83 
84  std::ostream&
85  operator<<(std::ostream& o, type_t t);
86 
87 #define DEFINE(Node) \
88  template <typename Context> \
89  class Node
90 
91  DEFINE(atom);
92  DEFINE(inner);
93  DEFINE(leaf);
94  DEFINE(node);
95 
97 
98 #undef DEFINE
99 
100  /*-----------.
101  | constant. |
102  `-----------*/
103 
104  template <type_t Type, typename Context>
105  class constant;
106 
107  template <typename Context>
109 
110  template <typename Context>
112 
113  /*--------.
114  | unary. |
115  `--------*/
116 
117  template <type_t Type, typename Context>
118  class unary;
119 
120  template <typename Context>
122 
123  template <typename Context>
125 
126  template <typename Context>
128 
129  /*-----------.
130  | variadic. |
131  `-----------*/
132 
133  template <type_t Type, typename Context>
134  class variadic;
135 
136  template <typename Context>
138 
139  template <typename Context>
141 
142  template <typename Context>
144 
145  template <typename Context>
147 
148  template <typename Context>
150 
151  template <typename Context>
153 
154 
155 
156  /*---------.
157  | tuple. |
158  `---------*/
159 
161  template <typename Context,
162  bool Enable = Context::is_lat>
163  class tuple;
164 
165 
166  /*--------------.
167  | weight_node. |
168  `--------------*/
169 
170  template <type_t Type, typename Context>
171  class weight_node;
172 
173  template <typename Context>
175 
176  template <typename Context>
178 
179 
180 
181  template <typename Context>
182  using expression = std::shared_ptr<const node<Context>>;
183 
184 
185  // expansionset.hh.
186  template <typename ExpSet>
187  struct expansionset;
188 
189  // expressionset.hh.
190  template <typename Context>
191  class expressionset_impl;
192 
193  // size.hh.
194  template <typename ExpSet>
195  size_t size(const ExpSet& rs, const typename ExpSet::value_t& r);
196 
197  } // namespace rat
198 
199  template <typename Context>
201 
202  template <typename ExpSet>
204 
205 } // namespace vcsn
info< ExpSet > make_info(const typename ExpSet::value_t &r)
Definition: info.hh:201
type_t
The possible types of expressions.
Definition: fwd.hh:39
Definition: a-star.hh:8
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
Definition: fwd.hh:74
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
An inner node with multiple children.
Definition: expression.hh:118
std::shared_ptr< const exp > exp_t
Definition: fwd.hh:16
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Definition: automaton.hh:56
std::ostream & operator<<(std::ostream &o, type_t t)
Definition: printer.hxx:14
constexpr bool is_constant(type_t t)
Whether is a constant (\z or \e).
Definition: fwd.hh:59
Gather information of the number of the different node types.
Definition: fwd.hh:20
auto rs
Definition: lift.hh:151
printer< ExpSet > make_printer(const ExpSet &rs, std::ostream &out)
Definition: printer.hh:367
std::shared_ptr< const node< Context >> expression
Definition: fwd.hh:182
A typed expression set.
An inner node implementing a weight.
Definition: expression.hh:264
constexpr bool is_unary(type_t t)
Whether star, complement.
Definition: fwd.hh:66
#define DEFINE(Node)
Definition: fwd.hh:87
Implementation of nodes of tuple of rational expressions.
Definition: expression.hh:182
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)