From d6962f3a09ed3969d7592d33d7872560a2a160e2 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 29 Apr 2014 09:50:29 +0200 Subject: [PATCH] fix geometry load on shared memory --- Util/DataStoreOptions.h | 40 ++++++++++++++++++++-------------------- datastore.cpp | 18 ++++++++++-------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Util/DataStoreOptions.h b/Util/DataStoreOptions.h index 1802ee999..ba1af192d 100644 --- a/Util/DataStoreOptions.h +++ b/Util/DataStoreOptions.h @@ -105,11 +105,11 @@ inline bool GenerateDataStoreOptions(const int argc, const char * argv[], Server boost::program_options::value(&paths["edgesdata"]), ".edges file" ) - // ( - // "geometry", - // boost::program_options::value(&paths["geometries"]), - // ".geometry file" - // ) + ( + "geometry", + boost::program_options::value(&paths["geometry"]), + ".geometry file" + ) ( "ramindex", boost::program_options::value(&paths["ramindex"]), @@ -180,13 +180,13 @@ inline bool GenerateDataStoreOptions(const int argc, const char * argv[], Server boost::program_options::notify(option_variables); const bool parameter_present = - (paths.find("hsgrdata") != paths.end() && !paths.find("hsgrdata")->second.string().empty() ) || + (paths.find("hsgrdata") != paths.end() && !paths.find("hsgrdata" )->second.string().empty()) || (paths.find("nodesdata") != paths.end() && !paths.find("nodesdata")->second.string().empty()) || (paths.find("edgesdata") != paths.end() && !paths.find("edgesdata")->second.string().empty()) || - // (paths.find("geometry") != paths.end() && !paths.find("geometry")->second.string().empty())) || - (paths.find("ramindex") != paths.end() && !paths.find("ramindex")->second.string().empty()) || + (paths.find("geometry") != paths.end() && !paths.find("geometry" )->second.string().empty()) || + (paths.find("ramindex") != paths.end() && !paths.find("ramindex" )->second.string().empty()) || (paths.find("fileindex") != paths.end() && !paths.find("fileindex")->second.string().empty()) || - (paths.find("timestamp") != paths.end() && !paths.find("timestamp")->second.string().empty()) ; + (paths.find("timestamp") != paths.end() && !paths.find("timestamp")->second.string().empty()); if (parameter_present) { @@ -244,11 +244,11 @@ inline bool GenerateDataStoreOptions(const int argc, const char * argv[], Server path_iterator->second = base_string + ".edges"; } - // path_iterator = paths.find("geometries"); - // if (path_iterator != paths.end()) - // { - // path_iterator->second = base_string + ".geometry"; - // } + path_iterator = paths.find("geometry"); + if (path_iterator != paths.end()) + { + path_iterator->second = base_string + ".geometry"; + } path_iterator = paths.find("ramindex"); if (path_iterator != paths.end()) @@ -296,12 +296,12 @@ inline bool GenerateDataStoreOptions(const int argc, const char * argv[], Server } AssertPathExists(path_iterator->second); - // path_iterator = paths.find("geometries"); - // if (path_iterator == paths.end() || path_iterator->second.string().empty()) - // { - // path_iterator->second = base_string + ".geometry"; - // } - // AssertPathExists(path_iterator->second); + path_iterator = paths.find("geometry"); + if (path_iterator == paths.end() || path_iterator->second.string().empty()) + { + throw OSRMException(".geometry file must be specified"); + } + AssertPathExists(path_iterator->second); path_iterator = paths.find("ramindex"); if (path_iterator == paths.end() || path_iterator->second.string().empty()) diff --git a/datastore.cpp b/datastore.cpp index 938bb9167..abf4a39b1 100644 --- a/datastore.cpp +++ b/datastore.cpp @@ -92,22 +92,25 @@ int main( const int argc, const char * argv[] ) return 0; } if( server_paths.find("hsgrdata") == server_paths.end() ) { - throw OSRMException("no hsgr file given in ini file"); + throw OSRMException("no hsgr file found"); } if( server_paths.find("ramindex") == server_paths.end() ) { - throw OSRMException("no ram index file given in ini file"); + throw OSRMException("no ram index file found"); } if( server_paths.find("fileindex") == server_paths.end() ) { - throw OSRMException("no leaf index file given in ini file"); + throw OSRMException("no leaf index file found"); } if( server_paths.find("nodesdata") == server_paths.end() ) { - throw OSRMException("no nodes file given in ini file"); + throw OSRMException("no nodes file found"); } if( server_paths.find("edgesdata") == server_paths.end() ) { - throw OSRMException("no edges file given in ini file"); + throw OSRMException("no edges file found"); } if( server_paths.find("namesdata") == server_paths.end() ) { - throw OSRMException("no names file given in ini file"); + throw OSRMException("no names file found"); + } + if( server_paths.find("geometry") == server_paths.end() ) { + throw OSRMException("no geometry file found"); } ServerPaths::const_iterator paths_iterator = server_paths.find("hsgrdata"); @@ -139,8 +142,7 @@ int main( const int argc, const char * argv[] ) BOOST_ASSERT(server_paths.end() != paths_iterator); BOOST_ASSERT(!paths_iterator->second.empty()); const boost::filesystem::path & names_data_path = paths_iterator->second; - - paths_iterator = server_paths.find("geometries"); + paths_iterator = server_paths.find("geometry"); BOOST_ASSERT(server_paths.end() != paths_iterator); BOOST_ASSERT(!paths_iterator->second.empty()); const boost::filesystem::path & geometries_data_path = paths_iterator->second;