diff --git a/CMakeLists.txt b/CMakeLists.txt index c5f2aebc1..6356f6057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 7316a7f97..154eda39b 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -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}") diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index f7a6fa270..1fef0a267 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -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) { } diff --git a/include/customizer/customizer_config.hpp b/include/customizer/customizer_config.hpp index 6795f3112..f7aa842f1 100644 --- a/include/customizer/customizer_config.hpp +++ b/include/customizer/customizer_config.hpp @@ -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) { } diff --git a/include/extractor/extractor_config.hpp b/include/extractor/extractor_config.hpp index ed132f8f0..7cb7bb499 100644 --- a/include/extractor/extractor_config.hpp +++ b/include/extractor/extractor_config.hpp @@ -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) { } diff --git a/include/partition/partition_config.hpp b/include/partition/partition_config.hpp index de7976d3e..22e23f7ce 100644 --- a/include/partition/partition_config.hpp +++ b/include/partition/partition_config.hpp @@ -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}) { } diff --git a/include/storage/io_config.hpp b/include/storage/io_config.hpp index 999b9552e..734150968 100644 --- a/include/storage/io_config.hpp +++ b/include/storage/io_config.hpp @@ -2,7 +2,6 @@ #define OSRM_IO_CONFIG_HPP #include "util/exception.hpp" -#include "util/log.hpp" #include #include @@ -16,11 +15,11 @@ namespace storage { struct IOConfig { - IOConfig(std::vector _required_input_files, - std::vector _optional_input_files, - std::vector _output_files) - : required_input_files(_required_input_files), optional_input_files(_optional_input_files), - output_files(_output_files) + IOConfig(std::vector required_input_files_, + std::vector optional_input_files_, + std::vector 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); } diff --git a/include/storage/storage_config.hpp b/include/storage/storage_config.hpp index 61f0052e8..f947fef03 100644 --- a/include/storage/storage_config.hpp +++ b/include/storage/storage_config.hpp @@ -57,7 +57,6 @@ struct StorageConfig final : IOConfig ".osrm.properties", ".osrm.icd"}, {".osrm.hsgr", - ".osrm.nodes", ".osrm.nbg_nodes", ".osrm.ebg_nodes", ".osrm.core", diff --git a/src/storage/io_config.cpp b/src/storage/io_config.cpp new file mode 100644 index 000000000..82d8a914e --- /dev/null +++ b/src/storage/io_config.cpp @@ -0,0 +1,28 @@ +#include "storage/io_config.hpp" + +#include "util/log.hpp" + +#include +#include +#include + +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; +} +} +} diff --git a/src/storage/storage_config.cpp b/src/storage/storage_config.cpp deleted file mode 100644 index 3ebb7983a..000000000 --- a/src/storage/storage_config.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "storage/storage_config.hpp" -#include "util/log.hpp" - -#include - -namespace osrm -{ -namespace storage -{ -namespace -{ -bool CheckFileList(const std::vector &files) -{ - bool success = true; - for (auto &path : files) - { - if (!boost::filesystem::exists(path)) - { - util::Log(logERROR) << "Missing File: " << path.string(); - success = false; - } - } - return success; -} -} -} -}