-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmapping.hh
48 lines (33 loc) · 854 Bytes
/
mapping.hh
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
#ifndef mapping_hh
#define mapping_hh
#include <map>
#include <ostream>
#include "bottom.hh"
class Mapping
{
public:
typedef std::map<TStringIndex, TStringIndex> TMapping;
typedef TMapping::const_iterator TConstIter;
private:
friend std::ostream &operator<<(std::ostream &os, const Mapping &m);
TMapping mapping;
public:
// returns 0 when from not mapped
TStringIndex get(TStringIndex from) const;
TConstIter begin() const;
TConstIter end() const;
void set(TStringIndex from, TStringIndex to);
void ensure_no_cycle();
private:
void check_from(TStringIndex from);
};
inline Mapping::TConstIter Mapping::begin() const
{
return mapping.begin();
}
inline Mapping::TConstIter Mapping::end() const
{
return mapping.end();
}
std::ostream &operator<<(std::ostream &os, const Mapping &m);
#endif