-
Notifications
You must be signed in to change notification settings - Fork 2
/
tcwrapper.hpp
36 lines (33 loc) · 843 Bytes
/
tcwrapper.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <iostream>
#include "callback.hpp"
template < enum tree_code tc > class TCWrapper:public CallBack
{
public:
TCWrapper ()
{
save_callback (tc, this);}; const enum tree_code t_code ()const
{
return tc;
}
static const enum tree_code t_code_c = tc; virtual void check ()
{
std::cerr << "wrapper class for type (";
std::cerr << tc;
std::cerr << ",";
std::cerr << get_tree_code_name (tc);
std::cerr << ") "; std::cerr << std::endl;}
static bool check_node (tree f)
{
enum tree_code atc = f->typed.base.code;
// std::cerr << "check type "
// << get_tree_code_name (atc)
// << " vs type "
// << get_tree_code_name (tc)
// << std::endl;
return atc == tc;}
virtual tree_code get_treecode ()
{
return tc;
}
};