Vcsn  2.2
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;
20  template <type_t Type>
22  template <type_t Type>
24  template <type_t Type>
26 
27  void visit(const tuple<context_t>& v)
28  {
30  }
31 
33  virtual void visit(const tuple_t& v, std::true_type) = 0;
34 
35  void visit(const tuple<context_t>&, std::false_type)
36  {
38  }
39 
40 #define DEFINE(Type) \
41  using Type ## _t = Type<context_t>; \
42  virtual void visit(const Type ## _t& v)
43 
58 #undef DEFINE
59  };
60 
61  } // namespace rat
62 } // namespace vcsn
63 
64 #define VCSN_RAT_VISIT(Type, Val) \
65  using Type ## _t = typename super_t::Type ## _t; \
66  virtual void visit(const Type ## _t& Val) override
67 
68 #define VCSN_RAT_UNSUPPORTED(Type) \
69  VCSN_RAT_VISIT(Type,) \
70  { \
71  raise(me(), ": " #Type " is not supported"); \
72  }
73 
std::integral_constant< bool, B > bool_constant
Definition: type_traits.hh:12
An inner node.
Definition: expression.hh:101
Definition: a-star.hh:8
An inner node with multiple children.
Definition: expression.hh:118
#define BUILTIN_UNREACHABLE()
Definition: builtins.hh:13
#define DEFINE(Type)
Definition: visitor.hh:40
An inner node implementing a weight.
Definition: expression.hh:264
The root from which to derive the final node types.
Definition: expression.hh:302
void visit(const tuple< context_t > &v)
Definition: visitor.hh:27
Implementation of nodes of tuple of rational expressions.
Definition: expression.hh:182
The abstract parameterized, root for all rational expression types.
Definition: expression.hh:80
void visit(const tuple< context_t > &, std::false_type)
Definition: visitor.hh:35