-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.h
51 lines (38 loc) · 1.06 KB
/
table.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
#ifndef TYPES
#define TYPES
#include "types.h"
#endif
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <unordered_map>
/*
Backpointer entry that can be either:
- string
- tuple of ((int, int, string), (int, int, string))
*/
class BPTableEntryItem{
public:
virtual bool is_single(){};
};
class BPSingleEntry: public BPTableEntryItem{
public:
BPSingleEntry(std::string _name): name(_name){};
std::string name;
bool is_single(){
return true;
}
};
class BPTupleEntry: public BPTableEntryItem{
public:
BPTupleEntry(int _l1, int _l2, std::string _lname, int _r1, int _r2, std::string _rname):
l1(_l1), l2(_l2), lname(_lname), r1(_r1), r2(_r2), rname(_rname){};
int l1, l2, r1, r2;
std::string lname, rname;
bool is_single(){
return false;
}
};
void print_dp_table(std::vector<std::vector<StringVector>> &table, int N);
typedef std::unordered_map<std::string, std::vector<BPTableEntryItem*>> BPTableEntry;