-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsfsutils.cpp
More file actions
29 lines (25 loc) · 808 Bytes
/
sfsutils.cpp
File metadata and controls
29 lines (25 loc) · 808 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
#include "sfsutils.hpp"
bool operator<(const SFS &x, const SFS &y) { return x.s < y.s; }
map<string, vector<SFS>> parse_sfsfile(const string &sfs_path, int tau) {
map<string, vector<SFS>> SFSs;
string line;
ifstream inf(sfs_path);
if (inf.is_open()) {
string info[4];
while (getline(inf, line)) {
stringstream ssin(line);
int i = 0;
while (ssin.good() && i < 4) {
ssin >> info[i++];
}
if (stoi(info[3]) < tau) {
continue;
}
if (SFSs.find(info[0]) == SFSs.end()) {
SFSs[info[0]] = vector<SFS>();
}
SFSs[info[0]].push_back(SFS(stoi(info[1]), stoi(info[2]), stoi(info[3])));
}
}
return SFSs ;
}