superclass storage_config with io_config

This commit is contained in:
Pepijn Schoen 2017-04-19 08:59:45 +02:00 committed by Daniel J. H
parent 64574c779f
commit fe00a8a0ca
4 changed files with 82 additions and 43 deletions

View File

@ -741,7 +741,7 @@ set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp inclu
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp) set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp) set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp) set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
set(StorageHeader include/storage/storage.hpp include/storage/storage_config.hpp) set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp)
install(FILES ${EngineHeader} DESTINATION include/osrm/engine) install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
install(FILES ${UtilHeader} DESTINATION include/osrm/util) install(FILES ${UtilHeader} DESTINATION include/osrm/util)
install(FILES ${StorageHeader} DESTINATION include/osrm/storage) install(FILES ${StorageHeader} DESTINATION include/osrm/storage)

View File

@ -0,0 +1,77 @@
#ifndef IO_CONFIG_HPP
#define IO_CONFIG_HPP
#include <boost/filesystem/path.hpp>
namespace osrm
{
namespace storage
{
struct IOConfig
{
IOConfig() = default;
IOConfig(const boost::filesystem::path &base) : osrm_input_path(base)
{
UseDefaultOutputNames();
}
// Infer the output names from the path of the .osrm file
void UseDefaultOutputNames()
{
ram_index_path = {osrm_input_path.string() + ".ramIndex"};
file_index_path = {osrm_input_path.string() + ".fileIndex"};
hsgr_data_path = {osrm_input_path.string() + ".hsgr"};
nodes_data_path = {osrm_input_path.string() + ".nodes"};
edges_data_path = {osrm_input_path.string() + ".edges"};
core_data_path = {osrm_input_path.string() + ".core"};
geometries_path = {osrm_input_path.string() + ".geometry"};
timestamp_path = {osrm_input_path.string() + ".timestamp"};
turn_weight_penalties_path = {osrm_input_path.string() + ".turn_weight_penalties"};
turn_duration_penalties_path = {osrm_input_path.string() + ".turn_duration_penalties"};
turn_penalties_index_path = {osrm_input_path.string() + ".turn_penalties_index"};
datasource_names_path = {osrm_input_path.string() + ".datasource_names"};
names_data_path = {osrm_input_path.string() + ".names"};
properties_path = {osrm_input_path.string() + ".properties"};
intersection_class_path = {osrm_input_path.string() + ".icd"};
turn_lane_data_path = {osrm_input_path.string() + ".tld"};
turn_lane_description_path = {osrm_input_path.string() + ".tls"};
mld_partition_path = {osrm_input_path.string() + ".partition"};
mld_storage_path = {osrm_input_path.string() + ".cells"};
mld_graph_path = {osrm_input_path.string() + ".mldgr"};
level_path = {osrm_input_path.string() + ".level"};
node_path = {osrm_input_path.string() + ".enw"};
edge_based_graph_path = {osrm_input_path.string() + ".ebg"};
}
boost::filesystem::path osrm_input_path;
boost::filesystem::path ram_index_path;
boost::filesystem::path file_index_path;
boost::filesystem::path hsgr_data_path;
boost::filesystem::path nodes_data_path;
boost::filesystem::path edges_data_path;
boost::filesystem::path core_data_path;
boost::filesystem::path geometries_path;
boost::filesystem::path timestamp_path;
boost::filesystem::path turn_weight_penalties_path;
boost::filesystem::path turn_duration_penalties_path;
boost::filesystem::path turn_penalties_index_path;
boost::filesystem::path datasource_names_path;
boost::filesystem::path datasource_indexes_path;
boost::filesystem::path names_data_path;
boost::filesystem::path properties_path;
boost::filesystem::path intersection_class_path;
boost::filesystem::path turn_lane_data_path;
boost::filesystem::path turn_lane_description_path;
boost::filesystem::path mld_partition_path;
boost::filesystem::path mld_storage_path;
boost::filesystem::path mld_graph_path;
boost::filesystem::path level_path;
boost::filesystem::path node_path;
boost::filesystem::path edge_based_graph_path;
};
}
}
#endif

View File

@ -30,6 +30,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include "storage/io_config.hpp"
namespace osrm namespace osrm
{ {
namespace storage namespace storage
@ -40,7 +42,7 @@ namespace storage
* *
* \see OSRM, EngineConfig * \see OSRM, EngineConfig
*/ */
struct StorageConfig final struct StorageConfig final : IOConfig
{ {
StorageConfig() = default; StorageConfig() = default;
@ -49,30 +51,8 @@ struct StorageConfig final
* *
* \param base The base path (e.g. france.pbf.osrm) to derive auxiliary file suffixes from. * \param base The base path (e.g. france.pbf.osrm) to derive auxiliary file suffixes from.
*/ */
StorageConfig(const boost::filesystem::path &base); StorageConfig(const boost::filesystem::path &base) : IOConfig(base) {}
bool IsValid() const; bool IsValid() const;
boost::filesystem::path ram_index_path;
boost::filesystem::path file_index_path;
boost::filesystem::path hsgr_data_path;
boost::filesystem::path node_based_nodes_data_path;
boost::filesystem::path edge_based_nodes_data_path;
boost::filesystem::path edges_data_path;
boost::filesystem::path core_data_path;
boost::filesystem::path geometries_path;
boost::filesystem::path timestamp_path;
boost::filesystem::path turn_weight_penalties_path;
boost::filesystem::path turn_duration_penalties_path;
boost::filesystem::path datasource_names_path;
boost::filesystem::path datasource_indexes_path;
boost::filesystem::path names_data_path;
boost::filesystem::path properties_path;
boost::filesystem::path intersection_class_path;
boost::filesystem::path turn_lane_data_path;
boost::filesystem::path turn_lane_description_path;
boost::filesystem::path mld_partition_path;
boost::filesystem::path mld_storage_path;
boost::filesystem::path mld_graph_path;
}; };
} }
} }

View File

@ -24,24 +24,6 @@ bool CheckFileList(const std::vector<boost::filesystem::path> &files)
} }
} }
StorageConfig::StorageConfig(const boost::filesystem::path &base)
: ram_index_path{base.string() + ".ramIndex"}, file_index_path{base.string() + ".fileIndex"},
hsgr_data_path{base.string() + ".hsgr"},
node_based_nodes_data_path{base.string() + ".nbg_nodes"},
edge_based_nodes_data_path{base.string() + ".ebg_nodes"},
edges_data_path{base.string() + ".edges"}, core_data_path{base.string() + ".core"},
geometries_path{base.string() + ".geometry"}, timestamp_path{base.string() + ".timestamp"},
turn_weight_penalties_path{base.string() + ".turn_weight_penalties"},
turn_duration_penalties_path{base.string() + ".turn_duration_penalties"},
datasource_names_path{base.string() + ".datasource_names"},
names_data_path{base.string() + ".names"}, properties_path{base.string() + ".properties"},
intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"},
turn_lane_description_path{base.string() + ".tls"},
mld_partition_path{base.string() + ".partition"}, mld_storage_path{base.string() + ".cells"},
mld_graph_path{base.string() + ".mldgr"}
{
}
bool StorageConfig::IsValid() const bool StorageConfig::IsValid() const
{ {
// Common files // Common files