Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fwd.hh
Go to the documentation of this file.
1 #ifndef VCSN_CORE_RAT_FWD_HH
2 # define VCSN_CORE_RAT_FWD_HH
3 
4 # include <memory>
5 
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 Context>
20  class info;
21 
22  // printer.hh.
23  template <typename Context>
24  class printer;
25 
31  enum class type_t
32  {
33  zero,
34  one,
35  atom,
36  sum,
37  prod,
38  ldiv,
40  shuffle,
41  star,
43  lweight,
44  rweight,
45  complement,
46  };
47 
49  inline constexpr bool is_constant(type_t t)
50  {
51  return (t == type_t::one
52  || t == type_t::zero);
53  }
54 
56  inline constexpr bool is_unary(type_t t)
57  {
58  return (t == type_t::complement
59  || t == type_t::star
60  || t == type_t::transposition);
61  }
62 
64  inline constexpr bool is_variadic(type_t t)
65  {
66  return (t == type_t::conjunction
67  || t == type_t::ldiv
68  || t == type_t::prod
69  || t == type_t::shuffle
70  || t == type_t::sum);
71  }
72 
73  std::ostream&
74  operator<<(std::ostream& o, type_t t);
75 
76 # define DEFINE(Node) \
77  template <typename Context> \
78  class Node
79 
84 
86 
87 # undef DEFINE
88 
89  /*-----------.
90  | constant. |
91  `-----------*/
92 
93  template <type_t Type, typename Context>
94  class constant;
95 
96  template <typename Context>
98 
99  template <typename Context>
101 
102  /*--------.
103  | unary. |
104  `--------*/
105 
106  template <type_t Type, typename Context>
107  class unary;
108 
109  template <typename Context>
111 
112  template <typename Context>
114 
115  template <typename Context>
117 
118  /*-----------.
119  | variadic. |
120  `-----------*/
121 
122  template <type_t Type, typename Context>
123  class variadic;
124 
125  template <typename Context>
127 
128  template <typename Context>
130 
131  template <typename Context>
133 
134  template <typename Context>
136 
137  template <typename Context>
139 
140  /*--------------.
141  | weight_node. |
142  `--------------*/
143 
144  template <type_t Type, typename Context>
145  class weight_node;
146 
147  template <typename Context>
149 
150  template <typename Context>
152 
153 
154 
155  template <typename Context>
156  using ratexp = std::shared_ptr<const node<Context>>;
157 
158 
159  // ratexpset.hh.
160  template <typename Context>
162 
163  } // namespace rat
164 
165  template <typename Context>
167 
168 } // namespace vcsn
169 
170 #endif // !VCSN_CORE_RAT_FWD_HH
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
Definition: fwd.hh:64
An inner node with multiple children.
Definition: fwd.hh:123
The abstract parameterized, root for all rational expression types.
Definition: fwd.hh:80
std::ostream & operator<<(std::ostream &o, type_t t)
Definition: printer.hxx:16
std::shared_ptr< const node< Context >> ratexp
Definition: fwd.hh:156
constexpr bool is_unary(type_t t)
Whether star, complement.
Definition: fwd.hh:56
type_t
The possible types of ratexps.
Definition: fwd.hh:31
#define DEFINE(Node)
Definition: fwd.hh:76
A typed ratexp set.
Definition: fwd.hh:161
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:36
std::shared_ptr< const exp > exp_t
Definition: fwd.hh:16
An inner node implementing a weight.
Definition: fwd.hh:145
The root from which to derive the final node types.
Definition: fwd.hh:81
An inner node.
Definition: fwd.hh:83
constexpr bool is_constant(type_t t)
Whether is a constant (\z or \e).
Definition: fwd.hh:49