-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.cpp
More file actions
47 lines (40 loc) · 972 Bytes
/
Copy pathcommand.cpp
File metadata and controls
47 lines (40 loc) · 972 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
#include "command.hpp"
using namespace std;
// コンストラクタ
Command::Command(Mnemonic mnemonic, optional<int> operand) {
this->mnemonic = mnemonic;
this->operand = operand;
}
// ニモニックのゲッタ
Mnemonic Command::get_mnemonic(void) {
return mnemonic;
}
// ニモニックのセッタ
void Command::set_mnemonic(Mnemonic mnemonic) {
this->mnemonic = mnemonic;
}
// オペランドのゲッタ
optional<int> Command::get_operand(void) {
return operand;
}
// オペランドのセッタ
void Command::set_operand(optional<int> operand) {
this->operand = operand;
}
// ニモニックの列挙型と文字列の対応表
map<int, string> Command::mnemonic2string_map = {
{GET, "GET"},
{PUT, "PUT"},
{LOD, "LOD"},
{LDC, "LDC"},
{STR, "STR"},
{ADD, "ADD"},
{SUB, "SUB"},
{MLT, "MLT"},
{DIV, "DIV"},
{EQL, "EQL"},
{GRT, "GRT"},
{LET, "LET"},
{CJP, "CJP"},
{UJP, "UJP"},
};