-
Notifications
You must be signed in to change notification settings - Fork 1
/
VarMap.h
executable file
·53 lines (43 loc) · 874 Bytes
/
VarMap.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* VarMap.h
*
* Created on: Sep 1, 2008
* Author: tdillig
*/
#ifndef VARMAP_H_
#define VARMAP_H_
#include <map>
#include <unordered_map>
#include <string>
#include <set>
using namespace std;
#define NUM_BITS_RESERVED 5
namespace il{
class type;
}
namespace sail{
class Variable;
}
class Term;
class CNode;
/*
* Since string's can take too much space, we associate every
* variable or function with a unique identifier. VarMap is needed
* for pretty printing.
*/
class VarMap {
private:
unordered_map<string, int> name_to_id_map;
unordered_map<int, string> id_to_name_map;
int cur_id;
public:
VarMap();
int get_id(string name, bool invertible=false);
int get_attrib(int id);
string get_name(int id);
bool contains_name(string name);
void get_all_vars(set<string>& var_names);
virtual ~VarMap();
void clear();
};
#endif /* VARMAP_H_ */