-
Notifications
You must be signed in to change notification settings - Fork 54
/
node.hpp
47 lines (41 loc) · 872 Bytes
/
node.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
37
38
39
40
41
42
43
44
45
46
47
#ifndef NODE_H
#define NODE_H
#include <set>
#include <string>
#include <map>
typedef enum adj_type{
ADJ_CNT,
ADJ_JMP,
ADJ_JCC_T,
ADJ_JCC_C
} adj_type;
extern unsigned cur;
class node{
public:
node(std::string name, uint32_t pos, uint32_t label = 0);
void set_format(std::string format);
void merge();
void add_adj(unsigned n, adj_type type);
std::string get_name();
unsigned get_num();
void set_end(uint32_t end);
uint32_t get_pos();
uint32_t get_end();
std::string dump();
std::string dump_name();
void set_label(uint32_t l);
private:
std::string name;
std::string format;
uint32_t pos;
uint32_t label;
uint32_t end;
bool del;
unsigned num;
unsigned val;
std::map<unsigned, adj_type> adj;
};
extern std::map<unsigned, node> nodes;
node* get_node(std::string name, uint32_t pos);
node* get_node(unsigned num);
#endif