-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
58 lines (43 loc) · 1.15 KB
/
main.cpp
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
#include "CubeRegionInfo.h"
#include "CubeReader.h"
#include <iostream>
#include <fstream>
#include <algorithm>
struct IDFilter {
bool operator()(const std::string &s) { return true; }
};
struct IsDirectory {
bool operator()(const std::string &s) { return s[0] == '/'; }
};
template <typename T, typename U>
void toOStream(T cont, std::ostream &o, U filter) {
for (const auto &e : cont) {
if (filter(e)) {
o << e << "\n";
}
}
}
int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "Need parameter .cubex file!" << std::endl;
return -1;
}
std::string cubeFileName = std::string(argv[1]);
regioninfo::RegionInfoManager rim;
std::cout << "Reading cube file" << std::endl;
cube_reader::build(cubeFileName, rim);
cube_reader::attachRuntimeInfo(cubeFileName, rim);
rim.printAll();
{
auto filenames = rim.getAllFilenames();
toOStream(filenames, std::cout, IDFilter());
std::ofstream out("filenames");
toOStream(filenames, out, IsDirectory());
}
{
auto funcNames = rim.getAllFunctionNames();
std::ofstream out("functionNames");
toOStream(funcNames, out, IDFilter());
}
return 0;
}