rename osrm_input_path to osrm_path, clang-format

This commit is contained in:
Pepijn Schoen 2017-05-05 10:23:09 +02:00 committed by Daniel J. H
parent 1b31099f73
commit 67fae1d1f0
11 changed files with 52 additions and 58 deletions

View File

@ -52,7 +52,7 @@ struct ContractorConfig final : storage::IOConfig
void UseDefaultOutputNames() void UseDefaultOutputNames()
{ {
IOConfig::UseDefaultOutputNames(); IOConfig::UseDefaultOutputNames();
updater_config.osrm_input_path = osrm_input_path; updater_config.osrm_path = osrm_path;
updater_config.UseDefaultOutputNames(); updater_config.UseDefaultOutputNames();
} }

View File

@ -6,8 +6,8 @@
#include <array> #include <array>
#include <string> #include <string>
#include "updater/updater_config.hpp"
#include "storage/io_config.hpp" #include "storage/io_config.hpp"
#include "updater/updater_config.hpp"
namespace osrm namespace osrm
{ {
@ -21,7 +21,7 @@ struct CustomizationConfig final : storage::IOConfig
void UseDefaultOutputNames() void UseDefaultOutputNames()
{ {
IOConfig::UseDefaultOutputNames(); IOConfig::UseDefaultOutputNames();
updater_config.osrm_input_path = osrm_input_path; updater_config.osrm_path = osrm_path;
updater_config.UseDefaultOutputNames(); updater_config.UseDefaultOutputNames();
} }

View File

@ -57,7 +57,7 @@ class ExtractionContainers
ExtractionContainers(); ExtractionContainers();
void PrepareData(ScriptingEnvironment &scripting_environment, void PrepareData(ScriptingEnvironment &scripting_environment,
const std::string &osrm_input_path, const std::string &osrm_path,
const std::string &restrictions_file_name, const std::string &restrictions_file_name,
const std::string &names_data_path); const std::string &names_data_path);
}; };

View File

@ -61,7 +61,7 @@ struct ExtractorConfig final : storage::IOConfig
} }
} }
osrm_input_path = basepath + ".osrm"; osrm_path = basepath + ".osrm";
IOConfig::UseDefaultOutputNames(); IOConfig::UseDefaultOutputNames();
} }

View File

@ -1,5 +1,5 @@
#ifndef IO_CONFIG_HPP #ifndef OSRM_IO_CONFIG_HPP
#define IO_CONFIG_HPP #define OSRM_IO_CONFIG_HPP
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
@ -11,45 +11,42 @@ struct IOConfig
{ {
IOConfig() = default; IOConfig() = default;
IOConfig(const boost::filesystem::path &base) : osrm_input_path(base) IOConfig(const boost::filesystem::path &base) : osrm_path(base) { UseDefaultOutputNames(); }
{
UseDefaultOutputNames();
}
// Infer the output names from the path of the .osrm file // Infer the output names from the path of the .osrm file
void UseDefaultOutputNames() void UseDefaultOutputNames()
{ {
ram_index_path = {osrm_input_path.string() + ".ramIndex"}; ram_index_path = {osrm_path.string() + ".ramIndex"};
file_index_path = {osrm_input_path.string() + ".fileIndex"}; file_index_path = {osrm_path.string() + ".fileIndex"};
hsgr_data_path = {osrm_input_path.string() + ".hsgr"}; hsgr_data_path = {osrm_path.string() + ".hsgr"};
nodes_data_path = {osrm_input_path.string() + ".nodes"}; nodes_data_path = {osrm_path.string() + ".nodes"};
edges_data_path = {osrm_input_path.string() + ".edges"}; edges_data_path = {osrm_path.string() + ".edges"};
core_data_path = {osrm_input_path.string() + ".core"}; core_data_path = {osrm_path.string() + ".core"};
geometries_path = {osrm_input_path.string() + ".geometry"}; geometries_path = {osrm_path.string() + ".geometry"};
timestamp_path = {osrm_input_path.string() + ".timestamp"}; timestamp_path = {osrm_path.string() + ".timestamp"};
turn_weight_penalties_path = {osrm_input_path.string() + ".turn_weight_penalties"}; turn_weight_penalties_path = {osrm_path.string() + ".turn_weight_penalties"};
turn_duration_penalties_path = {osrm_input_path.string() + ".turn_duration_penalties"}; turn_duration_penalties_path = {osrm_path.string() + ".turn_duration_penalties"};
turn_penalties_index_path = {osrm_input_path.string() + ".turn_penalties_index"}; turn_penalties_index_path = {osrm_path.string() + ".turn_penalties_index"};
datasource_names_path = {osrm_input_path.string() + ".datasource_names"}; datasource_names_path = {osrm_path.string() + ".datasource_names"};
names_data_path = {osrm_input_path.string() + ".names"}; names_data_path = {osrm_path.string() + ".names"};
properties_path = {osrm_input_path.string() + ".properties"}; properties_path = {osrm_path.string() + ".properties"};
intersection_class_path = {osrm_input_path.string() + ".icd"}; intersection_class_path = {osrm_path.string() + ".icd"};
turn_lane_data_path = {osrm_input_path.string() + ".tld"}; turn_lane_data_path = {osrm_path.string() + ".tld"};
turn_lane_description_path = {osrm_input_path.string() + ".tls"}; turn_lane_description_path = {osrm_path.string() + ".tls"};
mld_partition_path = {osrm_input_path.string() + ".partition"}; mld_partition_path = {osrm_path.string() + ".partition"};
mld_storage_path = {osrm_input_path.string() + ".cells"}; mld_storage_path = {osrm_path.string() + ".cells"};
mld_graph_path = {osrm_input_path.string() + ".mldgr"}; mld_graph_path = {osrm_path.string() + ".mldgr"};
level_path = {osrm_input_path.string() + ".level"}; level_path = {osrm_path.string() + ".level"};
node_path = {osrm_input_path.string() + ".enw"}; node_path = {osrm_path.string() + ".enw"};
edge_based_nodes_data_path = {osrm_input_path.string() + ".nodes_data"}; edge_based_nodes_data_path = {osrm_path.string() + ".nodes_data"};
edge_based_graph_path = {osrm_input_path.string() + ".ebg"}; edge_based_graph_path = {osrm_path.string() + ".ebg"};
compressed_node_based_graph_path = {osrm_input_path.string() + ".cnbg"}; compressed_node_based_graph_path = {osrm_path.string() + ".cnbg"};
cnbg_ebg_mapping_path = {osrm_input_path.string() + ".cnbg_to_ebg"}; cnbg_ebg_mapping_path = {osrm_path.string() + ".cnbg_to_ebg"};
restriction_path = {osrm_input_path.string() + ".restrictions"}; restriction_path = {osrm_path.string() + ".restrictions"};
intersection_class_data_path = {osrm_input_path.string() + ".icd"}; intersection_class_data_path = {osrm_path.string() + ".icd"};
} }
boost::filesystem::path osrm_input_path; boost::filesystem::path osrm_path;
boost::filesystem::path ram_index_path; boost::filesystem::path ram_index_path;
boost::filesystem::path file_index_path; boost::filesystem::path file_index_path;
@ -80,8 +77,6 @@ struct IOConfig
boost::filesystem::path cnbg_ebg_mapping_path; boost::filesystem::path cnbg_ebg_mapping_path;
boost::filesystem::path restriction_path; boost::filesystem::path restriction_path;
boost::filesystem::path intersection_class_data_path; boost::filesystem::path intersection_class_data_path;
}; };
} }
} }

View File

@ -125,12 +125,11 @@ ExtractionContainers::ExtractionContainers()
* *
*/ */
void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environment, void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environment,
const std::string &osrm_input_path, const std::string &osrm_path,
const std::string &restrictions_file_name, const std::string &restrictions_file_name,
const std::string &name_file_name) const std::string &name_file_name)
{ {
storage::io::FileWriter file_out(osrm_input_path, storage::io::FileWriter file_out(osrm_path, storage::io::FileWriter::GenerateFingerprint);
storage::io::FileWriter::GenerateFingerprint);
PrepareNodes(); PrepareNodes();
WriteNodes(file_out); WriteNodes(file_out);

View File

@ -240,7 +240,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
util::Log() << "timestamp: " << timestamp; util::Log() << "timestamp: " << timestamp;
extraction_containers.PrepareData(scripting_environment, extraction_containers.PrepareData(scripting_environment,
config.osrm_input_path.string(), config.osrm_path.string(),
config.restriction_path.string(), config.restriction_path.string(),
config.names_data_path.string()); config.names_data_path.string());
@ -339,7 +339,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
auto profile_properties = scripting_environment.GetProfileProperties(); auto profile_properties = scripting_environment.GetProfileProperties();
SetClassNames(classes_map, profile_properties); SetClassNames(classes_map, profile_properties);
files::writeProfileProperties(config.profile_properties_output_path, profile_properties); files::writeProfileProperties(config.profile_properties_path, profile_properties);
TIMER_STOP(extracting); TIMER_STOP(extracting);
util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s"; util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s";
@ -414,7 +414,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
std::vector<util::Coordinate> &coordiantes, std::vector<util::Coordinate> &coordiantes,
extractor::PackedOSMIDs &osm_node_ids) extractor::PackedOSMIDs &osm_node_ids)
{ {
storage::io::FileReader file_reader(config.osrm_input_path, storage::io::FileReader file_reader(config.osrm_path,
storage::io::FileReader::VerifyFingerprint); storage::io::FileReader::VerifyFingerprint);
auto barriers_iter = inserter(barriers, end(barriers)); auto barriers_iter = inserter(barriers, end(barriers));
@ -431,7 +431,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
if (edge_list.empty()) if (edge_list.empty())
{ {
throw util::exception("Node-based-graph (" + config.osrm_input_path.string() + throw util::exception("Node-based-graph (" + config.osrm_path.string() +
") contains no edges." + SOURCE_REF); ") contains no edges." + SOURCE_REF);
} }

View File

@ -79,7 +79,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
boost::program_options::options_description hidden_options("Hidden options"); boost::program_options::options_description hidden_options("Hidden options");
hidden_options.add_options()( hidden_options.add_options()(
"input,i", "input,i",
boost::program_options::value<boost::filesystem::path>(&contractor_config.osrm_input_path), boost::program_options::value<boost::filesystem::path>(&contractor_config.osrm_path),
"Input file in .osm, .osm.bz2 or .osm.pbf format"); "Input file in .osm, .osm.bz2 or .osm.pbf format");
// positional option // positional option
@ -169,14 +169,14 @@ int main(int argc, char *argv[]) try
<< "! This setting may have performance side-effects."; << "! This setting may have performance side-effects.";
} }
if (!boost::filesystem::is_regular_file(contractor_config.osrm_input_path)) if (!boost::filesystem::is_regular_file(contractor_config.osrm_path))
{ {
util::Log(logERROR) << "Input file " << contractor_config.osrm_input_path.string() util::Log(logERROR) << "Input file " << contractor_config.osrm_path.string()
<< " not found!"; << " not found!";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
util::Log() << "Input file: " << contractor_config.osrm_input_path.filename().string(); util::Log() << "Input file: " << contractor_config.osrm_path.filename().string();
util::Log() << "Threads: " << contractor_config.requested_num_threads; util::Log() << "Threads: " << contractor_config.requested_num_threads;
tbb::task_scheduler_init init(contractor_config.requested_num_threads); tbb::task_scheduler_init init(contractor_config.requested_num_threads);

View File

@ -72,7 +72,7 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
boost::program_options::options_description hidden_options("Hidden options"); boost::program_options::options_description hidden_options("Hidden options");
hidden_options.add_options()( hidden_options.add_options()(
"input,i", "input,i",
boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_input_path), boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_path),
"Input file in .osrm format"); "Input file in .osrm format");
// positional option // positional option
@ -153,9 +153,9 @@ int main(int argc, char *argv[]) try
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (!boost::filesystem::is_regular_file(customization_config.osrm_input_path)) if (!boost::filesystem::is_regular_file(customization_config.osrm_path))
{ {
util::Log(logERROR) << "Input file " << customization_config.osrm_input_path.string() util::Log(logERROR) << "Input file " << customization_config.osrm_path.string()
<< " not found!"; << " not found!";
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -114,7 +114,7 @@ return_code parseArguments(int argc, char *argv[], partition::PartitionConfig &c
boost::program_options::options_description hidden_options("Hidden options"); boost::program_options::options_description hidden_options("Hidden options");
hidden_options.add_options()( hidden_options.add_options()(
"input,i", "input,i",
boost::program_options::value<boost::filesystem::path>(&config.osrm_input_path), boost::program_options::value<boost::filesystem::path>(&config.osrm_path),
"Input file in .osrm format"); "Input file in .osrm format");
// positional option // positional option

View File

@ -108,7 +108,7 @@ void checkWeightsConsistency(
extractor::files::readSegmentData(config.geometries_path, segment_data); extractor::files::readSegmentData(config.geometries_path, segment_data);
extractor::EdgeBasedNodeDataContainer node_data; extractor::EdgeBasedNodeDataContainer node_data;
extractor::files::readNodeData(config.osrm_input_path.string() + ".ebg_nodes", node_data); extractor::files::readNodeData(config.osrm_path.string() + ".ebg_nodes", node_data);
extractor::TurnDataContainer turn_data; extractor::TurnDataContainer turn_data;
extractor::files::readTurnData(config.edges_data_path, turn_data); extractor::files::readTurnData(config.edges_data_path, turn_data);