Go to the source code of this file.
|
| string | replacer (string &s, const string &toReplace, const string &replaceWith) |
| |
| int | parseLine (char *line) |
| |
| int | getUsedKB () |
| |
| void | my_handler (int s) |
| |
| void | catchSig () |
| |
| void | logHead () |
| |
| void | logEntry (double &msec, std::chrono::time_point< std::chrono::system_clock > &old, atomic< bool > &isprnt) |
| |
| bool | catchTown (PlaceData &dummy, const uint64_t &osmid, double &lon, double &lat, const Tags &tags) |
| |
| bool | catchWay (WayData &dummy, const uint64_t &osmid, const Tags &tags) |
| |
◆ __STDC_FORMAT_MACROS
| #define __STDC_FORMAT_MACROS |
◆ catchSig()
- Examples
- ReadPbfData.cpp.
63 struct sigaction sigIntHandler;
65 sigemptyset(&sigIntHandler.sa_mask);
66 sigIntHandler.sa_flags = 0;
67 sigaction(SIGINT, &sigIntHandler, NULL);
◆ catchTown()
| bool catchTown |
( |
PlaceData & |
dummy, |
|
|
const uint64_t & |
osmid, |
|
|
double & |
lon, |
|
|
double & |
lat, |
|
|
const Tags & |
tags |
|
) |
| |
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());
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
◆ catchWay()
| bool catchWay |
( |
WayData & |
dummy, |
|
|
const uint64_t & |
osmid, |
|
|
const Tags & |
tags |
|
) |
| |
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());
uint8_t _type
Definition: ReadPbfData.cpp:40
char _name[256]
Definition: ReadPbfData.cpp:41
◆ getUsedKB()
33 FILE* fi = fopen(
"/proc/self/status",
"r");
37 while (fgets(line, 128, fi) != NULL){
38 if (strncmp(line,
"VmRSS:", 6) == 0){
◆ logEntry()
| 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();
struct statistic_s getStatistic(void)
Definition: SwappyItems.hpp:288
Nodes_t * nodes
Definition: osm2graph.cpp:85
◆ logHead()
- Examples
- ReadPbfData.cpp.
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);
#define RAM_MULTI
Definition: osm2graph.cpp:15
#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
◆ my_handler()
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);
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
Ways_t * ways
Definition: osm2graph.cpp:84
◆ parseLine()
| int parseLine |
( |
char * |
line | ) |
|
25 while (*p <'0' || *p >
'9') p++;
◆ replacer()
| 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);
double pos
Definition: osm2graph_bitmap.cpp:125