Addressed comments
This commit is contained in:
parent
d9e8caf369
commit
0b5c7a97a7
@ -737,7 +737,7 @@ file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
|
||||
file(GLOB LibraryGlob include/osrm/*.hpp)
|
||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/log.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)
|
||||
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
|
||||
|
@ -31,6 +31,6 @@ add_executable(osrm-example example.cpp)
|
||||
|
||||
find_package(LibOSRM REQUIRED)
|
||||
|
||||
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES} ${UtilGlob})
|
||||
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES})
|
||||
include_directories(SYSTEM ${LibOSRM_INCLUDE_DIRS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LibOSRM_CXXFLAGS}")
|
||||
|
@ -43,12 +43,13 @@ namespace contractor
|
||||
struct ContractorConfig final : storage::IOConfig
|
||||
{
|
||||
ContractorConfig()
|
||||
: requested_num_threads(0), IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"})
|
||||
: IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"}),
|
||||
requested_num_threads(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,13 @@ namespace customizer
|
||||
struct CustomizationConfig final : storage::IOConfig
|
||||
{
|
||||
CustomizationConfig()
|
||||
: requested_num_threads(0),
|
||||
IOConfig(
|
||||
: IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"})
|
||||
{".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"}),
|
||||
requested_num_threads(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,7 @@ namespace extractor
|
||||
|
||||
struct ExtractorConfig final : storage::IOConfig
|
||||
{
|
||||
ExtractorConfig() noexcept : requested_num_threads(0),
|
||||
IOConfig(
|
||||
ExtractorConfig() noexcept : IOConfig(
|
||||
{
|
||||
"",
|
||||
},
|
||||
@ -68,7 +67,8 @@ struct ExtractorConfig final : storage::IOConfig
|
||||
".osrm.properties",
|
||||
".osrm.icd",
|
||||
".osrm.cnbg",
|
||||
".osrm.cnbg_to_ebg"})
|
||||
".osrm.cnbg_to_ebg"}),
|
||||
requested_num_threads(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@ namespace partition
|
||||
struct PartitionConfig final : storage::IOConfig
|
||||
{
|
||||
PartitionConfig()
|
||||
: requested_num_threads(0), balance(1.2), boundary_factor(0.25), num_optimizing_cuts(10),
|
||||
small_component_size(1000),
|
||||
max_cell_sizes{128, 128 * 32, 128 * 32 * 16, 128 * 32 * 16 * 32},
|
||||
IOConfig(
|
||||
: IOConfig(
|
||||
{".osrm", ".osrm.fileIndex", ".osrm.ebg_nodes"},
|
||||
{".osrm.hsgr", ".osrm.cnbg"},
|
||||
{".osrm.ebg", ".osrm.cnbg", ".osrm.cnbg_to_ebg", ".osrm.partition", ".osrm.cells"})
|
||||
{".osrm.ebg", ".osrm.cnbg", ".osrm.cnbg_to_ebg", ".osrm.partition", ".osrm.cells"}),
|
||||
requested_num_threads(0), balance(1.2), boundary_factor(0.25), num_optimizing_cuts(10),
|
||||
small_component_size(1000),
|
||||
max_cell_sizes({128, 128 * 32, 128 * 32 * 16, 128 * 32 * 16 * 32})
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define OSRM_IO_CONFIG_HPP
|
||||
|
||||
#include "util/exception.hpp"
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@ -16,11 +15,11 @@ namespace storage
|
||||
{
|
||||
struct IOConfig
|
||||
{
|
||||
IOConfig(std::vector<boost::filesystem::path> _required_input_files,
|
||||
std::vector<boost::filesystem::path> _optional_input_files,
|
||||
std::vector<boost::filesystem::path> _output_files)
|
||||
: required_input_files(_required_input_files), optional_input_files(_optional_input_files),
|
||||
output_files(_output_files)
|
||||
IOConfig(std::vector<boost::filesystem::path> required_input_files_,
|
||||
std::vector<boost::filesystem::path> optional_input_files_,
|
||||
std::vector<boost::filesystem::path> output_files_)
|
||||
: required_input_files(required_input_files_), optional_input_files(optional_input_files_),
|
||||
output_files(output_files_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,27 +45,12 @@ struct IOConfig
|
||||
base_path = {path};
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
bool success = true;
|
||||
for (auto &fileName : required_input_files)
|
||||
{
|
||||
if (!boost::filesystem::is_regular_file({base_path.string() + fileName.string()}))
|
||||
{
|
||||
util::Log(logWARNING) << "Missing/Broken File: " << base_path.string()
|
||||
<< fileName.string();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool IsValid() const;
|
||||
boost::filesystem::path GetPath(const std::string &fileName) const
|
||||
{
|
||||
if (!IsConfigured(fileName, required_input_files) &&
|
||||
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
|
||||
{
|
||||
util::Log(logERROR) << "Tried to access file which is not configured: " << fileName;
|
||||
throw util::exception("Tried to access file which is not configured: " + fileName);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,6 @@ struct StorageConfig final : IOConfig
|
||||
".osrm.properties",
|
||||
".osrm.icd"},
|
||||
{".osrm.hsgr",
|
||||
".osrm.nodes",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.core",
|
||||
|
28
src/storage/io_config.cpp
Normal file
28
src/storage/io_config.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "storage/io_config.hpp"
|
||||
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
bool IOConfig::IsValid() const
|
||||
{
|
||||
bool success = true;
|
||||
for (auto &fileName : required_input_files)
|
||||
{
|
||||
if (!boost::filesystem::is_regular_file({base_path.string() + fileName.string()}))
|
||||
{
|
||||
util::Log(logWARNING) << "Missing/Broken File: " << base_path.string()
|
||||
<< fileName.string();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
#include "storage/storage_config.hpp"
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
namespace
|
||||
{
|
||||
bool CheckFileList(const std::vector<boost::filesystem::path> &files)
|
||||
{
|
||||
bool success = true;
|
||||
for (auto &path : files)
|
||||
{
|
||||
if (!boost::filesystem::exists(path))
|
||||
{
|
||||
util::Log(logERROR) << "Missing File: " << path.string();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user