forked from SF-Zhou/field-ii-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargs.hpp
49 lines (44 loc) · 1.19 KB
/
args.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
48
49
#include <iostream>
#include <string>
#include <cassert>
#include "para.hpp"
using namespace std;
struct Args {
bool has_config = false;
bool has_method = false;
bool has_file = false;
bool has_stdin = true;
int times = 1;
string signal_path;
string config_path;
string method;
void process(int argc, char* argv[]) {
fff (i, 1, argc - 1) {
string arg = argv[i];
if (arg == "-c") {
++ i;
assert(i < argc);
config_path = argv[i];
has_config = true;
} else if (arg == "-i") {
++ i;
assert(i < argc);
signal_path = argv[i];
has_file = true;
has_stdin = false;
} else if (arg == "-m") {
++ i;
assert(i < argc);
method = argv[i];
has_method = true;
} else if (arg == "-t") {
++ i;
assert(i < argc);
times = stoi(argv[i]);
} else {
cerr << "unkonwn arg: " << arg << endl;
assert(false);
}
}
}
};