Only allow to specify the common base path
This commit is contained in:
@@ -228,31 +228,36 @@ class InternalDataFacade final : public BaseDataFacade
|
||||
}
|
||||
}
|
||||
|
||||
void LoadDatasourceInfo(const boost::filesystem::path &datasource_names_file,
|
||||
const boost::filesystem::path &datasource_indexes_file)
|
||||
void LoadDatasourceInfo(const std::string &datasource_names_file,
|
||||
const std::string &datasource_indexes_file)
|
||||
{
|
||||
std::ifstream datasources_stream(datasource_indexes_file.c_str(), std::ios::binary);
|
||||
if (datasources_stream)
|
||||
boost::filesystem::ifstream datasources_stream(datasource_indexes_file, std::ios::binary);
|
||||
if (!datasources_stream)
|
||||
{
|
||||
std::size_t number_of_datasources = 0;
|
||||
datasources_stream.read(reinterpret_cast<char *>(&number_of_datasources),
|
||||
sizeof(std::size_t));
|
||||
if (number_of_datasources > 0)
|
||||
{
|
||||
m_datasource_list.resize(number_of_datasources);
|
||||
datasources_stream.read(reinterpret_cast<char *>(&(m_datasource_list[0])),
|
||||
number_of_datasources * sizeof(uint8_t));
|
||||
}
|
||||
throw util::exception("Could not open " + datasource_indexes_file + " for reading!");
|
||||
}
|
||||
BOOST_ASSERT(datasources_stream);
|
||||
|
||||
std::size_t number_of_datasources = 0;
|
||||
datasources_stream.read(reinterpret_cast<char *>(&number_of_datasources),
|
||||
sizeof(std::size_t));
|
||||
if (number_of_datasources > 0)
|
||||
{
|
||||
m_datasource_list.resize(number_of_datasources);
|
||||
datasources_stream.read(reinterpret_cast<char *>(&(m_datasource_list[0])),
|
||||
number_of_datasources * sizeof(uint8_t));
|
||||
}
|
||||
|
||||
std::ifstream datasourcenames_stream(datasource_names_file.c_str(), std::ios::binary);
|
||||
if (datasourcenames_stream)
|
||||
boost::filesystem::ifstream datasourcenames_stream(datasource_names_file, std::ios::binary);
|
||||
if (!datasourcenames_stream)
|
||||
{
|
||||
std::string name;
|
||||
while (std::getline(datasourcenames_stream, name))
|
||||
{
|
||||
m_datasource_names.push_back(name);
|
||||
}
|
||||
throw util::exception("Could not open " + datasource_names_file + " for reading!");
|
||||
}
|
||||
BOOST_ASSERT(datasourcenames_stream);
|
||||
std::string name;
|
||||
while (std::getline(datasourcenames_stream, name))
|
||||
{
|
||||
m_datasource_names.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,55 +294,35 @@ class InternalDataFacade final : public BaseDataFacade
|
||||
m_geospatial_query.reset();
|
||||
}
|
||||
|
||||
explicit InternalDataFacade(
|
||||
const std::unordered_map<std::string, boost::filesystem::path> &server_paths)
|
||||
explicit InternalDataFacade(const storage::StorageConfig& config)
|
||||
{
|
||||
// cache end iterator to quickly check .find against
|
||||
const auto end_it = end(server_paths);
|
||||
|
||||
const auto file_for = [&server_paths, &end_it](const std::string &path)
|
||||
{
|
||||
const auto it = server_paths.find(path);
|
||||
if (it == end_it || !boost::filesystem::is_regular_file(it->second))
|
||||
throw util::exception("no valid " + path + " file given in ini file");
|
||||
return it->second;
|
||||
};
|
||||
|
||||
const auto optional_file_for = [&server_paths, &end_it](const std::string &path)
|
||||
{
|
||||
const auto it = server_paths.find(path);
|
||||
if (it == end_it)
|
||||
throw util::exception("no valid " + path + " file given in ini file");
|
||||
return it->second;
|
||||
};
|
||||
|
||||
ram_index_path = file_for("ramindex");
|
||||
file_index_path = file_for("fileindex");
|
||||
ram_index_path = config.ram_index_path;
|
||||
file_index_path = config.file_index_path;
|
||||
|
||||
util::SimpleLogger().Write() << "loading graph data";
|
||||
LoadGraph(file_for("hsgrdata"));
|
||||
LoadGraph(config.hsgr_data_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading edge information";
|
||||
LoadNodeAndEdgeInformation(file_for("nodesdata"), file_for("edgesdata"));
|
||||
LoadNodeAndEdgeInformation(config.nodes_data_path, config.edges_data_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading core information";
|
||||
LoadCoreInformation(file_for("coredata"));
|
||||
LoadCoreInformation(config.core_data_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading geometries";
|
||||
LoadGeometries(file_for("geometries"));
|
||||
LoadGeometries(config.geometries_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading datasource info";
|
||||
LoadDatasourceInfo(optional_file_for("datasource_names"),
|
||||
optional_file_for("datasource_indexes"));
|
||||
LoadDatasourceInfo(config.datasource_names_path,
|
||||
config.datasource_indexes_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading timestamp";
|
||||
LoadTimestamp(file_for("timestamp"));
|
||||
LoadTimestamp(config.timestamp_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading profile properties";
|
||||
LoadProfileProperties(file_for("properties"));
|
||||
LoadProfileProperties(config.properties_path);
|
||||
|
||||
util::SimpleLogger().Write() << "loading street names";
|
||||
LoadStreetNames(file_for("namesdata"));
|
||||
LoadStreetNames(config.names_data_path);
|
||||
}
|
||||
|
||||
// search graph access
|
||||
@@ -668,12 +653,8 @@ class InternalDataFacade final : public BaseDataFacade
|
||||
|
||||
virtual std::string GetDatasourceName(const uint8_t datasource_name_id) const override final
|
||||
{
|
||||
if (m_datasource_names.empty() || datasource_name_id > m_datasource_names.size())
|
||||
{
|
||||
if (datasource_name_id == 0)
|
||||
return "lua profile";
|
||||
return "UNKNOWN";
|
||||
}
|
||||
BOOST_ASSERT(m_datasource_names.size() >= 1);
|
||||
BOOST_ASSERT(m_datasource_names.size() > datasource_name_id);
|
||||
return m_datasource_names[datasource_name_id];
|
||||
}
|
||||
|
||||
|
||||
@@ -693,16 +693,10 @@ class SharedDataFacade final : public BaseDataFacade
|
||||
|
||||
virtual std::string GetDatasourceName(const uint8_t datasource_name_id) const override final
|
||||
{
|
||||
BOOST_ASSERT(m_datasource_name_offsets.size() >= 1);
|
||||
BOOST_ASSERT(m_datasource_name_offsets.size() > datasource_name_id);
|
||||
|
||||
std::string result;
|
||||
|
||||
if (m_datasource_name_offsets.empty() ||
|
||||
datasource_name_id > m_datasource_name_offsets.size())
|
||||
{
|
||||
if (datasource_name_id == 0)
|
||||
return "lua profile";
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
std::copy(m_datasource_name_data.begin() + m_datasource_name_offsets[datasource_name_id],
|
||||
m_datasource_name_data.begin() + m_datasource_name_offsets[datasource_name_id] +
|
||||
m_datasource_name_lengths[datasource_name_id],
|
||||
|
||||
@@ -28,9 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef ENGINE_CONFIG_HPP
|
||||
#define ENGINE_CONFIG_HPP
|
||||
|
||||
#include "storage/storage_config.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
namespace osrm
|
||||
@@ -41,24 +42,9 @@ namespace engine
|
||||
|
||||
struct EngineConfig
|
||||
{
|
||||
EngineConfig() = default;
|
||||
bool IsValid() const;
|
||||
|
||||
EngineConfig(const boost::filesystem::path &base)
|
||||
: server_paths{{"ramindex", base.string() + ".ramIndex"},
|
||||
{"fileindex", base.string() + ".fileIndex"},
|
||||
{"hsgrdata", base.string() + ".hsgr"},
|
||||
{"nodesdata", base.string() + ".nodes"},
|
||||
{"edgesdata", base.string() + ".edges"},
|
||||
{"coredata", base.string() + ".core"},
|
||||
{"geometries", base.string() + ".geometry"},
|
||||
{"timestamp", base.string() + ".timestamp"},
|
||||
{"datasource_names", base.string() + ".datasource_names"},
|
||||
{"datasource_indexes", base.string() + ".datasource_indexes"},
|
||||
{"namesdata", base.string() + ".names"}}
|
||||
{
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, boost::filesystem::path> server_paths;
|
||||
storage::StorageConfig storage_config;
|
||||
int max_locations_trip = -1;
|
||||
int max_locations_viaroute = -1;
|
||||
int max_locations_distance_table = -1;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2016, Project OSRM contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef GLOBAL_STORAGE_CONFIG_HPP
|
||||
#define GLOBAL_STORAGE_CONFIG_HPP
|
||||
|
||||
#include "storage/storage_config.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
using storage::StorageConfig;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,24 +1,24 @@
|
||||
#ifndef STORAGE_HPP
|
||||
#define STORAGE_HPP
|
||||
|
||||
#include "storage/storage_config.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
using DataPaths = std::unordered_map<std::string, boost::filesystem::path>;
|
||||
class Storage
|
||||
{
|
||||
public:
|
||||
Storage(const DataPaths &data_paths);
|
||||
Storage(StorageConfig config);
|
||||
int Run();
|
||||
|
||||
private:
|
||||
DataPaths paths;
|
||||
StorageConfig config;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef STORAGE_CONFIG_HPP
|
||||
#define STORAGE_CONFIG_HPP
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
struct StorageConfig
|
||||
{
|
||||
StorageConfig() = default;
|
||||
StorageConfig(const boost::filesystem::path &base);
|
||||
bool IsValid() const;
|
||||
|
||||
std::string ram_index_path;
|
||||
std::string file_index_path;
|
||||
std::string hsgr_data_path;
|
||||
std::string nodes_data_path;
|
||||
std::string edges_data_path;
|
||||
std::string core_data_path;
|
||||
std::string geometries_path;
|
||||
std::string timestamp_path;
|
||||
std::string datasource_names_path;
|
||||
std::string datasource_indexes_path;
|
||||
std::string names_data_path;
|
||||
std::string properties_path;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,253 +0,0 @@
|
||||
#ifndef ROUTED_OPTIONS_HPP
|
||||
#define ROUTED_OPTIONS_HPP
|
||||
|
||||
#include "util/version.hpp"
|
||||
#include "util/exception.hpp"
|
||||
#include "util/simple_logger.hpp"
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
const static unsigned INIT_OK_START_ENGINE = 0;
|
||||
const static unsigned INIT_OK_DO_NOT_START_ENGINE = 1;
|
||||
const static unsigned INIT_FAILED = -1;
|
||||
|
||||
inline void
|
||||
populate_base_path(std::unordered_map<std::string, boost::filesystem::path> &server_paths)
|
||||
{
|
||||
// populate the server_path object
|
||||
auto path_iterator = server_paths.find("base");
|
||||
|
||||
// if a base path has been set, we populate it.
|
||||
if (path_iterator != server_paths.end())
|
||||
{
|
||||
const std::string base_string = path_iterator->second.string();
|
||||
SimpleLogger().Write() << "populating base path: " << base_string;
|
||||
|
||||
server_paths["hsgrdata"] = base_string + ".hsgr";
|
||||
BOOST_ASSERT(server_paths.find("hsgrdata") != server_paths.end());
|
||||
server_paths["nodesdata"] = base_string + ".nodes";
|
||||
BOOST_ASSERT(server_paths.find("nodesdata") != server_paths.end());
|
||||
server_paths["coredata"] = base_string + ".core";
|
||||
BOOST_ASSERT(server_paths.find("coredata") != server_paths.end());
|
||||
server_paths["edgesdata"] = base_string + ".edges";
|
||||
BOOST_ASSERT(server_paths.find("edgesdata") != server_paths.end());
|
||||
server_paths["geometries"] = base_string + ".geometry";
|
||||
BOOST_ASSERT(server_paths.find("geometries") != server_paths.end());
|
||||
server_paths["ramindex"] = base_string + ".ramIndex";
|
||||
BOOST_ASSERT(server_paths.find("ramindex") != server_paths.end());
|
||||
server_paths["fileindex"] = base_string + ".fileIndex";
|
||||
BOOST_ASSERT(server_paths.find("fileindex") != server_paths.end());
|
||||
server_paths["namesdata"] = base_string + ".names";
|
||||
BOOST_ASSERT(server_paths.find("namesdata") != server_paths.end());
|
||||
server_paths["timestamp"] = base_string + ".timestamp";
|
||||
BOOST_ASSERT(server_paths.find("timestamp") != server_paths.end());
|
||||
server_paths["properties"] = base_string + ".properties";
|
||||
BOOST_ASSERT(server_paths.find("properties") != server_paths.end());
|
||||
server_paths["datasource_indexes"] = base_string + ".datasource_indexes";
|
||||
BOOST_ASSERT(server_paths.find("datasource_indexes") != server_paths.end());
|
||||
server_paths["datasource_names"] = base_string + ".datasource_names";
|
||||
BOOST_ASSERT(server_paths.find("datasource_names") != server_paths.end());
|
||||
}
|
||||
|
||||
// check if files are give and whether they exist at all
|
||||
path_iterator = server_paths.find("hsgrdata");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".hsgr not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("nodesdata");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".nodes not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("edgesdata");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".edges not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("geometries");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".geometry not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("ramindex");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".ramIndex not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("fileindex");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".fileIndex not found");
|
||||
}
|
||||
|
||||
path_iterator = server_paths.find("namesdata");
|
||||
if (path_iterator == server_paths.end() ||
|
||||
!boost::filesystem::is_regular_file(path_iterator->second))
|
||||
{
|
||||
throw exception(".namesIndex not found");
|
||||
}
|
||||
|
||||
SimpleLogger().Write() << "HSGR file:\t" << server_paths["hsgrdata"];
|
||||
SimpleLogger().Write(logDEBUG) << "Nodes file:\t" << server_paths["nodesdata"];
|
||||
SimpleLogger().Write(logDEBUG) << "Edges file:\t" << server_paths["edgesdata"];
|
||||
SimpleLogger().Write(logDEBUG) << "Geometry file:\t" << server_paths["geometries"];
|
||||
SimpleLogger().Write(logDEBUG) << "RAM file:\t" << server_paths["ramindex"];
|
||||
SimpleLogger().Write(logDEBUG) << "Index file:\t" << server_paths["fileindex"];
|
||||
SimpleLogger().Write(logDEBUG) << "Names file:\t" << server_paths["namesdata"];
|
||||
SimpleLogger().Write(logDEBUG) << "Timestamp file:\t" << server_paths["timestamp"];
|
||||
}
|
||||
|
||||
// generate boost::program_options object for the routing part
|
||||
inline unsigned
|
||||
GenerateServerProgramOptions(const int argc,
|
||||
const char *argv[],
|
||||
std::unordered_map<std::string, boost::filesystem::path> &paths,
|
||||
std::string &ip_address,
|
||||
int &ip_port,
|
||||
int &requested_num_threads,
|
||||
bool &use_shared_memory,
|
||||
bool &trial,
|
||||
int &max_locations_trip,
|
||||
int &max_locations_viaroute,
|
||||
int &max_locations_distance_table,
|
||||
int &max_locations_map_matching)
|
||||
{
|
||||
using boost::program_options::value;
|
||||
using boost::filesystem::path;
|
||||
|
||||
// declare a group of options that will be allowed only on command line
|
||||
boost::program_options::options_description generic_options("Options");
|
||||
generic_options.add_options() //
|
||||
("version,v", "Show version")("help,h", "Show this help message") //
|
||||
("config,c", value<boost::filesystem::path>(&paths["config"])->default_value("server.ini"),
|
||||
"Path to a configuration file") //
|
||||
("trial", value<bool>(&trial)->implicit_value(true), "Quit after initialization");
|
||||
|
||||
// declare a group of options that will be allowed on command line
|
||||
boost::program_options::options_description config_options("Configuration");
|
||||
config_options.add_options() //
|
||||
("hsgrdata", value<boost::filesystem::path>(&paths["hsgrdata"]), ".hsgr file") //
|
||||
("nodesdata", value<boost::filesystem::path>(&paths["nodesdata"]), ".nodes file") //
|
||||
("edgesdata", value<boost::filesystem::path>(&paths["edgesdata"]), ".edges file") //
|
||||
("geometry", value<boost::filesystem::path>(&paths["geometries"]), ".geometry file") //
|
||||
("ramindex", value<boost::filesystem::path>(&paths["ramindex"]), ".ramIndex file") //
|
||||
("fileindex", value<boost::filesystem::path>(&paths["fileindex"]),
|
||||
"File index file") //
|
||||
("namesdata", value<boost::filesystem::path>(&paths["namesdata"]),
|
||||
".names file") //
|
||||
("timestamp", value<boost::filesystem::path>(&paths["timestamp"]),
|
||||
".timestamp file") //
|
||||
("ip,i", value<std::string>(&ip_address)->default_value("0.0.0.0"),
|
||||
"IP address") //
|
||||
("port,p", value<int>(&ip_port)->default_value(5000),
|
||||
"TCP/IP port") //
|
||||
("threads,t", value<int>(&requested_num_threads)->default_value(8),
|
||||
"Number of threads to use") //
|
||||
("shared-memory,s",
|
||||
value<bool>(&use_shared_memory)->implicit_value(true)->default_value(false),
|
||||
"Load data from shared memory") //
|
||||
("max-viaroute-size", value<int>(&max_locations_viaroute)->default_value(500),
|
||||
"Max. locations supported in viaroute query") //
|
||||
("max-trip-size", value<int>(&max_locations_trip)->default_value(100),
|
||||
"Max. locations supported in trip query") //
|
||||
("max-table-size", value<int>(&max_locations_distance_table)->default_value(100),
|
||||
"Max. locations supported in distance table query") //
|
||||
("max-matching-size", value<int>(&max_locations_map_matching)->default_value(100),
|
||||
"Max. locations supported in map matching query");
|
||||
|
||||
// hidden options, will be allowed on command line, but will not be shown to the user
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()("base,b", value<boost::filesystem::path>(&paths["base"]),
|
||||
"base path to .osrm file");
|
||||
|
||||
// positional option
|
||||
boost::program_options::positional_options_description positional_options;
|
||||
positional_options.add("base", 1);
|
||||
|
||||
// combine above options for parsing
|
||||
boost::program_options::options_description cmdline_options;
|
||||
cmdline_options.add(generic_options).add(config_options).add(hidden_options);
|
||||
|
||||
boost::program_options::options_description visible_options(
|
||||
boost::filesystem::basename(argv[0]) + " <base.osrm> [<options>]");
|
||||
visible_options.add(generic_options).add(config_options);
|
||||
|
||||
// parse command line options
|
||||
boost::program_options::variables_map option_variables;
|
||||
boost::program_options::store(boost::program_options::command_line_parser(argc, argv)
|
||||
.options(cmdline_options)
|
||||
.positional(positional_options)
|
||||
.run(),
|
||||
option_variables);
|
||||
|
||||
if (option_variables.count("version"))
|
||||
{
|
||||
SimpleLogger().Write() << OSRM_VERSION;
|
||||
return INIT_OK_DO_NOT_START_ENGINE;
|
||||
}
|
||||
|
||||
if (option_variables.count("help"))
|
||||
{
|
||||
SimpleLogger().Write() << visible_options;
|
||||
return INIT_OK_DO_NOT_START_ENGINE;
|
||||
}
|
||||
|
||||
boost::program_options::notify(option_variables);
|
||||
|
||||
if (1 > requested_num_threads)
|
||||
{
|
||||
throw exception("Number of threads must be a positive number");
|
||||
}
|
||||
if (2 > max_locations_distance_table)
|
||||
{
|
||||
throw exception("Max location for distance table must be at least two");
|
||||
}
|
||||
if (max_locations_map_matching > 0 && 2 > max_locations_map_matching)
|
||||
{
|
||||
throw exception("Max location for map matching must be at least two");
|
||||
}
|
||||
|
||||
if (!use_shared_memory && option_variables.count("base"))
|
||||
{
|
||||
return INIT_OK_START_ENGINE;
|
||||
}
|
||||
else if (use_shared_memory && !option_variables.count("base"))
|
||||
{
|
||||
return INIT_OK_START_ENGINE;
|
||||
}
|
||||
else if (use_shared_memory && option_variables.count("base"))
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << "Shared memory settings conflict with path settings.";
|
||||
}
|
||||
|
||||
SimpleLogger().Write() << visible_options;
|
||||
return INIT_OK_DO_NOT_START_ENGINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ROUTED_OPTIONS_HPP
|
||||
Reference in New Issue
Block a user