diff --git a/DataStructures/SearchEngine.h b/DataStructures/SearchEngine.h index e0fb41db7..ebd838bf8 100644 --- a/DataStructures/SearchEngine.h +++ b/DataStructures/SearchEngine.h @@ -12,6 +12,7 @@ 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. +<<<<<<< HEAD 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 diff --git a/DataStructures/SearchEngineData.h b/DataStructures/SearchEngineData.h index 5d3e68046..7946eddb2 100644 --- a/DataStructures/SearchEngineData.h +++ b/DataStructures/SearchEngineData.h @@ -28,6 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef SEARCH_ENGINE_DATA_H #define SEARCH_ENGINE_DATA_H +#ifndef SEARCH_ENGINE_DATA_H +#define SEARCH_ENGINE_DATA_H + #include "BinaryHeap.h" #include "QueryEdge.h" #include "StaticGraph.h" diff --git a/Descriptors/DescriptionFactory.cpp b/Descriptors/DescriptionFactory.cpp index 2b95537db..4e149c38f 100644 --- a/Descriptors/DescriptionFactory.cpp +++ b/Descriptors/DescriptionFactory.cpp @@ -92,7 +92,6 @@ void DescriptionFactory::AppendUnencodedPolylineString(std::string &output) { pc.printUnencodedString(pathDescription, output); } - // void DescriptionFactory::Run(const SearchEngine &sEngine, const unsigned zoomLevel) { // if(0 == pathDescription.size()) diff --git a/Library/OSRM.cpp b/Library/OSRM.cpp index 969fd605d..bcf48f135 100644 --- a/Library/OSRM.cpp +++ b/Library/OSRM.cpp @@ -12,7 +12,6 @@ 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. -<<<<<<< HEAD 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 diff --git a/Server/DataStructures/QueryObjectsStorage.cpp b/Server/DataStructures/QueryObjectsStorage.cpp deleted file mode 100644 index 2d6d34304..000000000 --- a/Server/DataStructures/QueryObjectsStorage.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - -Copyright (c) 2013, Project OSRM, Dennis Luxen, others -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. - -*/ - -#include "QueryObjectsStorage.h" - -QueryObjectsStorage::QueryObjectsStorage( const ServerPaths & paths ) { - if( paths.find("hsgrdata") == paths.end() ) { - throw OSRMException("no hsgr file given in ini file"); - } - if( paths.find("ramindex") == paths.end() ) { - throw OSRMException("no ram index file given in ini file"); - } - if( paths.find("fileindex") == paths.end() ) { - throw OSRMException("no mem index file given in ini file"); - } - if( paths.find("nodesdata") == paths.end() ) { - throw OSRMException("no nodes file given in ini file"); - } - if( paths.find("edgesdata") == paths.end() ) { - throw OSRMException("no edges file given in ini file"); - } - if( paths.find("namesdata") == paths.end() ) { - throw OSRMException("no names file given in ini file"); - } - - SimpleLogger().Write() << "loading graph data"; - //Deserialize road network graph - - ServerPaths::const_iterator paths_iterator = paths.find("hsgrdata"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & hsgr_data_string = paths_iterator->second.string(); - - std::vector< QueryGraph::_StrNode> node_list; - std::vector< QueryGraph::_StrEdge> edge_list; - const int number_of_nodes = readHSGRFromStream( - hsgr_data_string, - node_list, - edge_list, - &check_sum - ); - - SimpleLogger().Write() << "Data checksum is " << check_sum; - graph = new QueryGraph(node_list, edge_list); - BOOST_ASSERT(0 == node_list.size()); - BOOST_ASSERT(0 == edge_list.size()); - - paths_iterator = paths.find("timestamp"); - - if(paths.end() != paths_iterator) { - SimpleLogger().Write() << "Loading Timestamp"; - const std::string & timestamp_string = paths_iterator->second.string(); - - boost::filesystem::ifstream time_stamp_instream(timestamp_string); - if( !time_stamp_instream.good() ) { - SimpleLogger().Write(logWARNING) << timestamp_string << " not found"; - } - - getline(time_stamp_instream, timestamp); - time_stamp_instream.close(); - } - if(!timestamp.length()) { - timestamp = "n/a"; - } - if(25 < timestamp.length()) { - timestamp.resize(25); - } - SimpleLogger().Write() << "Loading auxiliary information"; - - paths_iterator = paths.find("ramindex"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & ram_index_string = paths_iterator->second.string(); - paths_iterator = paths.find("fileindex"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & file_index_string = paths_iterator->second.string(); - paths_iterator = paths.find("nodesdata"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & nodes_data_string = paths_iterator->second.string(); - paths_iterator = paths.find("edgesdata"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & edges_data_string = paths_iterator->second.string(); - - //Init nearest neighbor data structure - nodeHelpDesk = new NodeInformationHelpDesk( - ram_index_string, - file_index_string, - nodes_data_string, - edges_data_string, - number_of_nodes, - check_sum - ); - - //deserialize street name list - SimpleLogger().Write() << "Loading names index"; - - paths_iterator = paths.find("namesdata"); - BOOST_ASSERT(paths.end() != paths_iterator); - const std::string & names_data_string = paths_iterator->second.string(); - if ( !boost::filesystem::exists( paths_iterator->second ) ) { - throw OSRMException("names file does not exist"); - } - if ( 0 == boost::filesystem::file_size( paths_iterator->second ) ) { - throw OSRMException("names file is empty"); - } - - boost::filesystem::ifstream name_stream(names_data_string, std::ios::binary); - unsigned size = 0; - name_stream.read((char *)&size, sizeof(unsigned)); - BOOST_ASSERT_MSG(0 != size, "name file broken"); - - m_name_begin_indices.resize(size); - name_stream.read((char*)&m_name_begin_indices[0], size*sizeof(unsigned)); - name_stream.read((char *)&size, sizeof(unsigned)); - BOOST_ASSERT_MSG(0 != size, "name file broken"); - - m_names_char_list.resize(size+1); //+1 is sentinel/dummy element - name_stream.read((char *)&m_names_char_list[0], size*sizeof(char)); - BOOST_ASSERT_MSG(0 != m_names_char_list.size(), "could not load any names"); - - name_stream.close(); - SimpleLogger().Write() << "All query data structures loaded"; -} - -void QueryObjectsStorage::GetName( - const unsigned name_id, - std::string & result -) const { - if(UINT_MAX == name_id) { - result = ""; - return; - } - BOOST_ASSERT_MSG( - name_id < m_name_begin_indices.size(), - "name id too high" - ); - unsigned begin_index = m_name_begin_indices[name_id]; - unsigned end_index = m_name_begin_indices[name_id+1]; - BOOST_ASSERT_MSG( - begin_index < m_names_char_list.size(), - "begin index of name too high" - ); - BOOST_ASSERT_MSG( - end_index < m_names_char_list.size(), - "end index of name too high" - ); - - BOOST_ASSERT_MSG(begin_index <= end_index, "string ends before begin"); - result.clear(); - result.resize(end_index - begin_index); - std::copy( - m_names_char_list.begin() + begin_index, - m_names_char_list.begin() + end_index, - result.begin() - ); -} - -QueryObjectsStorage::~QueryObjectsStorage() { - delete graph; - delete nodeHelpDesk; -} diff --git a/Server/DataStructures/QueryObjectsStorage.h b/Server/DataStructures/QueryObjectsStorage.h deleted file mode 100644 index fc52c6539..000000000 --- a/Server/DataStructures/QueryObjectsStorage.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright (c) 2013, Project OSRM, Dennis Luxen, others -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 QUERYOBJECTSSTORAGE_H_ -#define QUERYOBJECTSSTORAGE_H_ - -#include "../../Util/GraphLoader.h" -#include "../../Util/OSRMException.h" -#include "../../Util/ProgramOptions.h" -#include "../../Util/SimpleLogger.h" -#include "../../DataStructures/NodeInformationHelpDesk.h" -#include "../../DataStructures/QueryEdge.h" -#include "../../DataStructures/StaticGraph.h" - -#include -#include -#include - -#include -#include - -struct QueryObjectsStorage { - typedef StaticGraph QueryGraph; - typedef QueryGraph::InputEdge InputEdge; - - NodeInformationHelpDesk * nodeHelpDesk; - std::vector m_names_char_list; - std::vector m_name_begin_indices; - QueryGraph * graph; - std::string timestamp; - unsigned check_sum; - - void GetName( const unsigned name_id, std::string & result ) const; - - QueryObjectsStorage( const ServerPaths & paths ); - ~QueryObjectsStorage(); -}; - -#endif /* QUERYOBJECTSSTORAGE_H_ */ diff --git a/routed.cpp b/routed.cpp index 2ef8e9e99..e9d613af6 100644 --- a/routed.cpp +++ b/routed.cpp @@ -78,6 +78,7 @@ int main (int argc, const char * argv[]) { } installCrashHandler(argv[0]); #endif + bool use_shared_memory = false; std::string ip_address; int ip_port, requested_num_threads; @@ -88,7 +89,8 @@ int main (int argc, const char * argv[]) { server_paths, ip_address, ip_port, - requested_num_threads + requested_num_threads, + use_shared_memory ) ) { return 0; @@ -127,7 +129,6 @@ int main (int argc, const char * argv[]) { pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask); #endif - bool use_shared_memory = false; OSRM routing_machine(server_paths, use_shared_memory); Server * s = ServerFactory::CreateServer( ip_address,