-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoesenc_example.cpp
38 lines (30 loc) · 1.09 KB
/
oesenc_example.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
#include <filesystem>
#include <fstream>
#include <oesenc/chartfile.h>
#include <oesenc/keylistreader.h>
#include <oesenc/servercontrol.h>
#include <oesenc/serverreader.h>
using namespace std;
using namespace oesenc;
int main(int argc, char *argv[])
{
filesystem::path chartFileName = "C:/Path/to/chartdir/chartfile.oesenc";
string key = KeyListReader::readOesencKey(chartFileName.parent_path().string());
ServerControl serverControl;
if (!serverControl.waitUntilReady()) {
cerr << "Failed to establish server connection\n";
return -1;
}
unique_ptr<istream> inputStream = ServerReader::openOesenc(serverControl.pipeName(),
chartFileName.string(),
key);
if (!inputStream) {
cerr << "Failed to open " << chartFileName << "\n";
return -1;
}
ChartFile chartFile(*inputStream);
chartFile.read();
vector<S57> s57Objects = chartFile.s57();
cout << "Num objects " << s57Objects.size() << "\n";
return 0;
}