superclass customizer_config with io_config
This commit is contained in:
parent
a9b6686725
commit
897518a297
@ -1,53 +1,30 @@
|
|||||||
#ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
#ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||||
#define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
#define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||||
|
|
||||||
#include "updater/updater_config.hpp"
|
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "updater/updater_config.hpp"
|
||||||
|
#include "storage/io_config.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace customizer
|
namespace customizer
|
||||||
{
|
{
|
||||||
|
|
||||||
struct CustomizationConfig
|
struct CustomizationConfig final : storage::IOConfig
|
||||||
{
|
{
|
||||||
CustomizationConfig() : requested_num_threads(0) {}
|
CustomizationConfig() : requested_num_threads(0) {}
|
||||||
|
|
||||||
void UseDefaults()
|
void UseDefaultOutputNames()
|
||||||
{
|
{
|
||||||
std::string basepath = base_path.string();
|
IOConfig::UseDefaultOutputNames();
|
||||||
|
updater_config.osrm_input_path = osrm_input_path;
|
||||||
const std::string ext = ".osrm";
|
|
||||||
const auto pos = basepath.find(ext);
|
|
||||||
if (pos != std::string::npos)
|
|
||||||
{
|
|
||||||
basepath.replace(pos, ext.size(), "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// unknown extension
|
|
||||||
}
|
|
||||||
|
|
||||||
edge_based_graph_path = basepath + ".osrm.ebg";
|
|
||||||
mld_partition_path = basepath + ".osrm.partition";
|
|
||||||
mld_storage_path = basepath + ".osrm.cells";
|
|
||||||
mld_graph_path = basepath + ".osrm.mldgr";
|
|
||||||
|
|
||||||
updater_config.osrm_input_path = basepath + ".osrm";
|
|
||||||
updater_config.UseDefaultOutputNames();
|
updater_config.UseDefaultOutputNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
// might be changed to the node based graph at some point
|
|
||||||
boost::filesystem::path base_path;
|
|
||||||
boost::filesystem::path edge_based_graph_path;
|
|
||||||
boost::filesystem::path mld_partition_path;
|
|
||||||
boost::filesystem::path mld_storage_path;
|
|
||||||
boost::filesystem::path mld_graph_path;
|
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads;
|
||||||
|
|
||||||
updater::UpdaterConfig updater_config;
|
updater::UpdaterConfig updater_config;
|
||||||
|
@ -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.base_path),
|
boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_input_path),
|
||||||
"Input file in .osrm format");
|
"Input file in .osrm format");
|
||||||
|
|
||||||
// positional option
|
// positional option
|
||||||
@ -145,7 +145,7 @@ int main(int argc, char *argv[]) try
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the default in/output names
|
// set the default in/output names
|
||||||
customization_config.UseDefaults();
|
customization_config.UseDefaultOutputNames();
|
||||||
|
|
||||||
if (1 > customization_config.requested_num_threads)
|
if (1 > customization_config.requested_num_threads)
|
||||||
{
|
{
|
||||||
@ -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.base_path))
|
if (!boost::filesystem::is_regular_file(customization_config.osrm_input_path))
|
||||||
{
|
{
|
||||||
util::Log(logERROR) << "Input file " << customization_config.base_path.string()
|
util::Log(logERROR) << "Input file " << customization_config.osrm_input_path.string()
|
||||||
<< " not found!";
|
<< " not found!";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user