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

Function parseArguments

src/tools/contract.cpp:30–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28};
29
30return_code parseArguments(int argc,
31 char *argv[],
32 std::string &verbosity,
33 contractor::ContractorConfig &contractor_config)
34{
35 // declare a group of options that will be allowed only on command line
36 boost::program_options::options_description generic_options("Options");
37 generic_options.add_options()("version,v", "Show version")("help,h", "Show this help message")(
38 "list-inputs", "List required and optional input file extensions")(
39 "verbosity,l",
40 boost::program_options::value<std::string>(&verbosity)->default_value("INFO"),
41 std::string("Log verbosity level: " + util::LogPolicy::GetLevels()).c_str());
42
43 // declare a group of options that will be allowed on command line
44 boost::program_options::options_description config_options("Configuration");
45 config_options.add_options()(
46 "threads,t",
47 boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
48 ->default_value(std::thread::hardware_concurrency()),
49 "Number of threads to use")(
50 "segment-speed-file",
51 boost::program_options::value<std::vector<std::string>>(
52 &contractor_config.updater_config.segment_speed_lookup_paths)
53 ->composing(),
54 "Lookup files containing nodeA, nodeB, speed data to adjust edge weights")(
55 "turn-penalty-file",
56 boost::program_options::value<std::vector<std::string>>(
57 &contractor_config.updater_config.turn_penalty_lookup_paths)
58 ->composing(),
59 "Lookup files containing from_, to_, via_nodes, and turn penalties to adjust turn weights")(
60 "edge-weight-updates-over-factor",
61 boost::program_options::value<double>(
62 &contractor_config.updater_config.log_edge_updates_factor)
63 ->default_value(0.0),
64 "Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge "
65 "weights updated by more than this factor")(
66 "parse-conditionals-from-now",
67 boost::program_options::value<std::time_t>(&contractor_config.updater_config.valid_now)
68 ->default_value(0),
69 "Optional for conditional turn restriction parsing, provide a UTC time stamp from "
70 "which "
71 "to evaluate the validity of conditional turn restrictions")(
72 "time-zone-file",
73 boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
74 "Required for conditional turn restriction parsing, provide a geojson file containing "
75 "time zone boundaries");
76
77 // hidden options, will be allowed on command line, but will not be shown to the user
78 boost::program_options::options_description hidden_options("Hidden options");
79 hidden_options.add_options()(
80 "input,i",
81 boost::program_options::value<std::filesystem::path>(&contractor_config.base_path),
82 "Input file in .osm, .osm.bz2 or .osm.pbf format");
83
84 // positional option
85 boost::program_options::positional_options_description positional_options;
86 positional_options.add("input", 1);
87

Callers 1

mainFunction · 0.70

Calls 6

LogClass · 0.85
addMethod · 0.80
whatMethod · 0.80
containsMethod · 0.80
ListInputFilesMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected