2 #define __STDC_FORMAT_MACROS
5 string replacer(
string& s,
const string& toReplace,
const string& replaceWith) {
9 pos = s.find(toReplace,
pos);
10 if (
pos == std::string::npos) {
13 s = s.replace(
pos, toReplace.length(), replaceWith);
25 while (*p <'0' || *p >
'9') p++;
33 FILE* fi = fopen(
"/proc/self/status",
"r");
37 while (fgets(line, 128, fi) != NULL){
38 if (strncmp(line,
"VmRSS:", 6) == 0){
49 printf(
"# Caught signal %d\n", s);
50 auto now = std::chrono::high_resolution_clock::now();
51 mseconds = std::chrono::duration<double, std::milli>(now-
start).count();
52 printf(
"#end (before hibernate): %.f ms\n",
mseconds);
63 struct sigaction sigIntHandler;
65 sigemptyset(&sigIntHandler.sa_mask);
66 sigIntHandler.sa_flags = 0;
67 sigaction(SIGINT, &sigIntHandler, NULL);
72 printf(
"# cores: %12d\n", thread::hardware_concurrency());
73 printf(
"# items in a single file: %12d\n",
FILE_ITEMS);
75 printf(
"# swap into %12d files\n",
FILE_MULTI);
76 printf(
"# use %12d Bloom bits for a key in a file bitmask\n",
BBITS);
77 printf(
"# use a bitmask with %12d bits for each file\n",
BMASK);
81 void logEntry(
double & msec, std::chrono::time_point<std::chrono::system_clock> & old, atomic<bool> & isprnt) {
84 auto now = std::chrono::high_resolution_clock::now();
85 msec = std::chrono::duration<double, std::milli>(now-old).count();
129 if (tags.find(
"place") == tags.end())
return false;
131 string pt = tags.at(
"place");
134 if (pt.compare(
"village") == 0) {
136 }
else if (pt.compare(
"town") == 0) {
138 }
else if (pt.compare(
"city") == 0) {
144 if (tags.find(
"name") != tags.end()) {
145 pt = tags.at(
"name");
151 pt = (string)
"Dingenskirchen";
153 snprintf(dummy.
_name, 256,
"%s", pt.c_str());
159 if (tags.find(
"highway") == tags.end())
return false;
162 string wt = tags.at(
"highway");
164 if (wt.compare(
"motorway") == 0) {
166 }
else if (wt.compare(
"motorway_link") == 0) {
168 }
else if (wt.compare(
"trunk") == 0) {
170 }
else if (wt.compare(
"trunk_link") == 0) {
172 }
else if (wt.compare(
"primary") == 0) {
174 }
else if (wt.compare(
"primary_link") == 0) {
176 }
else if (wt.compare(
"secondary") == 0) {
178 }
else if (wt.compare(
"unclassified") == 0) {
180 }
else if (wt.compare(
"tertiary") == 0) {
182 }
else if (wt.compare(
"residential") == 0) {
186 if (dummy.
_type == 0)
return false;
189 if(tags.find(
"name") != tags.end()){
190 wayName = tags.at(
"name");
191 }
else if (tags.find(
"ref") != tags.end()) {
192 wayName = tags.at(
"ref");
193 }
else if (tags.find(
"destination:ref") != tags.end() && tags.find(
"destination") != tags.end()) {
194 wayName = tags.at(
"destination:ref") + (string)
" Richtung " + tags.at(
"destination");
196 wayName =
replacer(wayName,
"&",
"und");
197 wayName =
replacer(wayName,
"\"",
"'");
198 wayName =
replacer(wayName,
"<",
"");
199 wayName =
replacer(wayName,
">",
"");
201 snprintf(dummy.
_name, 256,
"%s", wayName.c_str());
SwappyItemsPLACES * places
Definition: ReadPbfData.cpp:56
double mseconds
Definition: ReadPbfData.cpp:61
std::chrono::time_point< std::chrono::system_clock > start
Definition: ReadPbfData.cpp:60
struct statistic_s getStatistic(void)
Definition: SwappyItems.hpp:288
std::map< std::string, std::string > Tags
Definition: osmpbfreader.hpp:51
#define RAM_MULTI
Definition: osm2graph.cpp:15
Ways_t * ways
Definition: osm2graph.cpp:84
#define BBITS
Definition: osm2graph.cpp:16
#define FILE_ITEMS
Definition: osm2graph.cpp:13
#define FILE_MULTI
Definition: osm2graph.cpp:14
#define BMASK
Definition: osm2graph.cpp:17
Nodes_t * nodes
Definition: osm2graph.cpp:85
double pos
Definition: osm2graph_bitmap.cpp:125
Definition: ReadPbfData.cpp:44
double _lat
Definition: ReadPbfData.cpp:47
uint8_t _type
Definition: ReadPbfData.cpp:45
char _name[256]
Definition: ReadPbfData.cpp:48
double _lon
Definition: ReadPbfData.cpp:46
Definition: osm2graph.cpp:60
uint8_t _type
Definition: ReadPbfData.cpp:40
char _name[256]
Definition: ReadPbfData.cpp:41