-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline.cpp
More file actions
79 lines (63 loc) · 990 Bytes
/
line.cpp
File metadata and controls
79 lines (63 loc) · 990 Bytes
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "stdafx.h"
#include <iostream>
#include "line.h"
line::line()
{
ntimes = 0;
}
line::~line()
{
}
void line::set_ntimes(int n){
ntimes = n;
}
void line::increment_ntimes(){
ntimes++;
}
int line::get_ntimes(){
return ntimes;
}
void line::set_line(vector<string> vec){
for (int i = 0; i < vec.size(); i++){
switch (i){
case 0:
set_add1(vec[i]);
break;
case 1:
set_add2(vec[i]);
break;
case 2:
inst.set_inst(vec[i]);
break;
default:
inst.insert_op(vec[i]);
break;
}
}
}
void line::set_add1(string str){
add1 = str;
}
void line::set_add2(string str){
add2 = str;
}
void line::set_inst(instruction ins){
inst = ins;
}
string line::get_add1(){
return add1;
}
string line::get_add2(){
return add2;
}
string line::get_str_inst(){
return inst.get_op_str();
}
instruction line::get_inst(){
return inst;
}
void line::print_line(){
cout << get_add1() << " ";
cout << get_str_inst() << " ";
cout << get_ntimes() << endl;
}