-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.cpp
63 lines (51 loc) · 2.43 KB
/
demo.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
59
60
61
62
63
#include <iostream>
#include <chrono>
#include "include/fileresolver.hpp"
#define STARTTIMING { std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
#define ENDTIMING(FOLDER) \
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); \
std::cout << "Elapse to find the folder " << FOLDER << " = " << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count() << "[µs]" << std::endl; }
int main(int, char**) {
// ├── CMakeLists.txt
// ├── include
// │ └── fileresolver.hpp
// ├── LICENSE
// ├── demo.cpp
// ├── README.md
// ├── tests
// │ ├── folder1
// │ │ ├── file1
// │ │ └── file2
// │ └── folder2
// │ ├── file3
// │ ├── sub1
// │ │ └── sub1.txt
// │ ├── sub2
// │ │ └── sub2.txt
// │ └── sub3
// │ ├── sub3.txt
// │ └── sub4
// │ └── myfile
// └── tests.cpp
STARTTIMING
printf("recursive file resolver:\n");
Grapix::FileResolver* resolver = Grapix::FileResolverFactory::makeRecursiveResolverPtr("folder1");
printf("--> origin path %s\n", resolver->getOriginPath().c_str());
printf("--> absolute to file1 %s\n", resolver->getAbsolute("file1").c_str());
printf("tostring: %s\n", resolver->toString().c_str());
ENDTIMING("folder1")
STARTTIMING
printf("recursive file resolver:\n");
Grapix::FileResolver* resolver = Grapix::FileResolverFactory::makeRecursiveResolverPtr("sub2");
printf("--> origin path %s\n", resolver->getOriginPath().c_str());
printf("--> absolute to file1 %s\n", resolver->getAbsolute("sub2.txt").c_str());
printf("tostring: %s\n", resolver->toString().c_str());
ENDTIMING("sub2")
STARTTIMING
printf("recursive file resolver:\n");
Grapix::FileResolver* resolver = Grapix::FileResolverFactory::makeRecursiveResolverPtr("sub4");
printf("--> origin path %s\n", resolver->getOriginPath().c_str());
printf("--> absolute to file1 %s\n", resolver->getAbsolute("myfile").c_str());
printf("tostring: %s\n", resolver->toString().c_str());
ENDTIMING("sub4")
}