Vcsn  2.3a
Be Rational
visitor.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/core/rat/fwd.hh>
4 #include <vcsn/misc/builtins.hh>
5 #include <vcsn/misc/raise.hh>
6 
7 namespace vcsn
8 {
9  namespace rat
10  {
11 
12  template <typename Context>
13  class const_visitor
14  {
15  public:
16  using context_t = Context;
21  template <type_t Type>
24  template <type_t Type>
27  template <type_t Type>
30  template <type_t Type>
32 
33  void visit(const tuple<context_t>& v)
34  {
36  }
37 
39  virtual void visit(const tuple_t& v, std::true_type) = 0;
40 
41  void visit(const tuple<context_t>&, std::false_type)
42  {
44  }
45 
46 #define DEFINE(Type) \
47  using Type ## _t = Type<context_t>; \
48  virtual void visit(const Type ## _t& v)
49 
65 #undef DEFINE
66  };
67  } // namespace rat
68 } // namespace vcsn
69 
70 #define VCSN_RAT_VISIT(Type, Val) \
71  using Type ## _t = typename super_t::Type ## _t; \
72  void visit(const Type ## _t& Val) override
73 
74 #define VCSN_RAT_UNSUPPORTED(Type) \
75  VCSN_RAT_VISIT(Type, e) \
76  { \
77  raise(me(), ": operator " #Type " not supported: ", \
78  to_string(rs_, e.shared_from_this())); \
79  }
80 
#define DEFINE(Type)
Definition: visitor.hh:46
Implementation of nodes of tuple of rational expressions.
Definition: expression.hh:182
return v
Definition: multiply.hh:361
Definition: a-star.hh:8
void visit(const tuple< context_t > &, std::false_type)
Definition: visitor.hh:41
An inner node implementing a weight.
Definition: expression.hh:264
void visit(const tuple< context_t > &v)
Definition: visitor.hh:33
std::integral_constant< bool, B > bool_constant
Definition: type_traits.hh:12
An inner node with multiple children.
Definition: expression.hh:118
The root from which to derive the final node types.
Definition: expression.hh:302
#define BUILTIN_UNREACHABLE()
Definition: builtins.hh:13
An inner node.
Definition: expression.hh:101
The abstract parameterized, root for all rational expression types.
Definition: expression.hh:80