MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / PopulateStaticData

Method PopulateStaticData

src/storage/storage.cpp:382–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382void Storage::PopulateStaticData(const SharedDataIndex &index)
383{
384 // read actual data into shared memory object //
385
386 // store the filename of the on-disk portion of the RTree
387 {
388 const auto file_index_path_ptr = index.GetBlockPtr<char>("/common/rtree/file_index_path");
389 // make sure we have 0 ending
390 std::fill(file_index_path_ptr,
391 file_index_path_ptr + index.GetBlockSize("/common/rtree/file_index_path"),
392 0);
393 const auto absolute_file_index_path =
394 std::filesystem::absolute(config.GetPath(".osrm.fileIndex")).string();
395 BOOST_ASSERT(static_cast<std::size_t>(index.GetBlockSize(
396 "/common/rtree/file_index_path")) >= absolute_file_index_path.size());
397 std::copy(
398 absolute_file_index_path.begin(), absolute_file_index_path.end(), file_index_path_ptr);
399 }
400
401 // Timestamp mark
402 {
403 auto timestamp_ref = make_timestamp_view(index, "/common/timestamp");
404 std::string ts;
405 extractor::files::readTimestamp(config.GetPath(".osrm.timestamp"), ts);
406 if (!ts.empty())
407 {
408 memcpy(const_cast<char *>(timestamp_ref.data()), ts.data(), ts.size());
409 }
410 }
411
412 // Turn lane data
413 if (config.IsRequiredConfiguredInput(".osrm.tld"))
414 {
415 auto turn_lane_data = make_lane_data_view(index, "/common/turn_lanes");
416 extractor::files::readTurnLaneData(config.GetPath(".osrm.tld"), turn_lane_data);
417 }
418
419 // Turn lane descriptions
420 if (config.IsRequiredConfiguredInput(".osrm.tls"))
421 {
422 auto views = make_turn_lane_description_views(index, "/common/turn_lanes");
423 extractor::files::readTurnLaneDescriptions(
424 config.GetPath(".osrm.tls"), std::get<0>(views), std::get<1>(views));
425 }
426
427 // Load intersection data
428 if (config.IsRequiredConfiguredInput(".osrm.icd"))
429 {
430 auto intersection_bearings_view =
431 make_intersection_bearings_view(index, "/common/intersection_bearings");
432 auto entry_classes = make_entry_classes_view(index, "/common/entry_classes");
433 extractor::files::readIntersections(
434 config.GetPath(".osrm.icd"), intersection_bearings_view, entry_classes);
435 }
436
437 // Name data
438 if (config.IsRequiredConfiguredInput(".osrm.names"))
439 {

Callers 1

Calls 15

copyFunction · 0.85
make_timestamp_viewFunction · 0.85
readTimestampFunction · 0.85
make_lane_data_viewFunction · 0.85
readTurnLaneDataFunction · 0.85
readTurnLaneDescriptionsFunction · 0.85
make_entry_classes_viewFunction · 0.85
readIntersectionsFunction · 0.85
make_string_table_viewFunction · 0.85
readNamesFunction · 0.85

Tested by

no test coverage detected