17 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_NODES_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_NODES_HH
25 template<
typename M_,
typename W_>
32 template<
typename M_,
typename W_>
33 class ConstNodeVisitor
36 virtual ~ConstNodeVisitor() {}
37 virtual void product(
const Node<M_, W_>*,
const Node<M_, W_>*) = 0;
38 virtual void sum(
const Node<M_, W_>*,
const Node<M_, W_>*) = 0;
39 virtual void star(
const Node<M_, W_>*) = 0;
40 virtual void left_weight(
const W_&,
const Node<M_, W_>*) = 0;
41 virtual void right_weight(
const W_&,
const Node<M_, W_>*) = 0;
42 virtual void constant(
const M_&) = 0;
43 virtual void zero() = 0;
44 virtual void one() = 0;
47 template<
typename M_,
typename W_>
48 class DefaultMutableNodeVisitor :
public ConstNodeVisitor<M_, W_>
51 virtual void product( Node<M_, W_>* lhs, Node<M_, W_>* rhs);
52 virtual void sum( Node<M_, W_>* lhs, Node<M_, W_>* rhs);
53 virtual void star( Node<M_, W_>* n);
54 virtual void left_weight(W_&, Node<M_, W_>* n);
55 virtual void right_weight( W_&, Node<M_, W_>* n);
56 virtual void constant( M_&);
64 template<
typename M_,
typename W_>
81 virtual type what()
const = 0;
82 virtual Node<M_, W_>* clone()
const = 0;
83 virtual void accept(ConstNodeVisitor<M_, W_> &)
const = 0;
84 virtual bool operator!=(
const Node<M_, W_>& other)
const = 0;
85 virtual bool operator<(const Node<M_, W_>& other)
const = 0;
97 template<
typename M_,
typename W_>
98 class Zero :
public Node<M_, W_>
104 typename Node<M_, W_>::type
108 Node<M_, W_>* clone()
const;
109 virtual void accept(ConstNodeVisitor<M_, W_>& v)
const;
110 virtual bool operator!=(
const Node<M_, W_>& other)
const;
111 virtual bool operator<(const Node<M_, W_>& other)
const;
119 template<
typename M_,
typename W_>
120 class One :
public Node<M_, W_>
124 virtual typename Node<M_, W_>::type
126 virtual Node<M_, W_>*
129 accept(ConstNodeVisitor<M_, W_>& v)
const;
131 operator!=(
const Node<M_, W_>& other)
const;
133 operator<(const Node<M_, W_>& other)
const;
142 template<
typename M_,
typename W_>
143 class Constant :
public Node<M_, W_>
146 Constant(
const M_ &v);
147 virtual typename Node<M_, W_>::type what()
const;
148 virtual Node<M_, W_>* clone()
const;
150 accept(ConstNodeVisitor<M_, W_>& v)
const;
152 operator!=(
const Node<M_, W_>& other)
const;
154 operator<(const Node<M_, W_>& other)
const;
165 template<
typename M_,
typename W_>
166 class LeftWeighted :
public Node<M_, W_>
171 LeftWeighted(
const W_& w,
const Node<M_, W_>& c);
172 LeftWeighted(
const W_& w, Node<M_, W_>* c);
173 LeftWeighted(
const W_& w);
174 virtual typename Node<M_, W_>::type
176 virtual Node<M_, W_>*
179 accept(ConstNodeVisitor<M_, W_>& v)
const;
181 operator!=(
const Node<M_, W_>& other)
const;
183 operator<(const Node<M_, W_>& other)
const;
189 Node<M_, W_>* child_;
195 template<
typename M_,
typename W_>
196 class RightWeighted :
public Node<M_, W_>
200 RightWeighted(
const W_& w,
const Node<M_, W_>& c);
201 RightWeighted(
const W_& w, Node<M_, W_>* c);
202 RightWeighted(
const W_& w);
203 virtual typename Node<M_, W_>::type
205 virtual Node<M_, W_>*
208 accept(ConstNodeVisitor<M_, W_>& v)
const;
210 operator!=(
const Node<M_, W_>& other)
const;
212 operator<(const Node<M_, W_>& other)
const;
218 Node<M_, W_>* child_;
224 template<
typename M_,
typename W_>
225 class Star :
public Node<M_, W_>
230 Star(
const Node<M_, W_>& other);
231 Star(Node<M_, W_>* other);
232 virtual typename Node<M_, W_>::type
234 virtual Node<M_, W_>*
237 accept(ConstNodeVisitor<M_, W_>& v)
const;
239 operator!=(
const Node<M_, W_>& other)
const;
241 operator<(const Node<M_, W_>& other)
const;
247 Node<M_, W_>* child_;
253 template<
typename M_,
typename W_>
254 class Product :
public Node<M_, W_>
259 Product(
const Node<M_, W_>& left,
const Node<M_, W_>& right);
260 Product(Node<M_, W_>* left, Node<M_, W_>* right);
261 virtual typename Node<M_, W_>::type
263 virtual Node<M_, W_>*
266 accept(ConstNodeVisitor<M_, W_>& v)
const;
268 operator!=(
const Node<M_, W_>& other)
const;
270 operator<(const Node<M_, W_>& other)
const;
277 Node<M_, W_>* right_;
283 template<
typename M_,
typename W_>
284 class Sum :
public Node<M_, W_>
287 Sum(
const Node<M_, W_>& left,
const Node<M_, W_>& right);
288 Sum(Node<M_, W_>* left, Node<M_, W_>* right);
290 accept(ConstNodeVisitor<M_, W_>& v)
const;
291 virtual typename Node<M_, W_>::type
293 virtual Node<M_, W_>*
296 operator!=(
const Node<M_, W_>& other)
const;
298 operator<(const Node<M_, W_>& other)
const;
304 Node<M_, W_> *right_;
311 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
312 # include <vaucanson/algebra/implementation/series/rat/nodes.hxx>
313 # endif // VCSN_USE_INTERFACE_ONLY
315 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_NODES_HH