diff --git a/3party/3party.pro b/3party/3party.pro index 014d4bf3da..915c75073b 100644 --- a/3party/3party.pro +++ b/3party/3party.pro @@ -2,7 +2,7 @@ TEMPLATE = subdirs -SUBDIRS = freetype fribidi zlib bzip2 jansson tomcrypt protobuf +SUBDIRS = freetype fribidi zlib bzip2 jansson tomcrypt protobuf osrm # use expat from the system on linux !linux*: SUBDIRS *= expat diff --git a/3party/osrm/osrm-backend/DataStructures/SearchEngineData.h b/3party/osrm/osrm-backend/DataStructures/SearchEngineData.h index f0621e6777..c7446adc80 100644 --- a/3party/osrm/osrm-backend/DataStructures/SearchEngineData.h +++ b/3party/osrm/osrm-backend/DataStructures/SearchEngineData.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef SEARCH_ENGINE_DATA_H #define SEARCH_ENGINE_DATA_H -#include +#include #include "../typedefs.h" #include "BinaryHeap.h" @@ -42,7 +42,7 @@ struct HeapData struct SearchEngineData { typedef BinaryHeap> QueryHeap; - typedef boost::thread_specific_ptr SearchEngineHeapPtr; + typedef boost::scoped_ptr SearchEngineHeapPtr; static SearchEngineHeapPtr forwardHeap; static SearchEngineHeapPtr backwardHeap; diff --git a/3party/osrm/osrm-tests/FingerPrint.cpp b/3party/osrm/osrm-tests/FingerPrint.cpp new file mode 100644 index 0000000000..4cec36f9bd --- /dev/null +++ b/3party/osrm/osrm-tests/FingerPrint.cpp @@ -0,0 +1,106 @@ +/* + +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 "Util/FingerPrint.h" + +#include "Util/OSRMException.h" + +#include + +#include + +#include +#include + +#define HAS64BITS true +#define MD5PREPARE "01234567890123456789012345678901" +#define MD5RTREE "01234567890123456789012345678901" +#define MD5GRAPH "01234567890123456789012345678901" +#define MD5OBJECTS "01234567890123456789012345678901" + +FingerPrint::FingerPrint() : magic_number(1297240911) +{ + md5_prepare[32] = md5_tree[32] = md5_graph[32] = md5_objects[32] = '\0'; + + boost::uuids::name_generator gen(named_uuid); + std::string temp_string(__DATE__); + temp_string += __TIME__; + + std::memcpy(md5_prepare, MD5PREPARE, strlen(MD5PREPARE)); + temp_string += md5_prepare; + std::memcpy(md5_tree, MD5RTREE, 32); + temp_string += md5_tree; + std::memcpy(md5_graph, MD5GRAPH, 32); + temp_string += md5_graph; + std::memcpy(md5_objects, MD5OBJECTS, 32); + temp_string += md5_objects; + + named_uuid = gen(temp_string); + has_64_bits = HAS64BITS; +} + +FingerPrint::~FingerPrint() {} + +const boost::uuids::uuid &FingerPrint::GetFingerPrint() const { return named_uuid; } + +bool FingerPrint::IsMagicNumberOK() const { return 1297240911 == magic_number; } + +bool FingerPrint::TestGraphUtil(const FingerPrint &other) const +{ + if (!other.IsMagicNumberOK()) + { + throw OSRMException("hsgr input file misses magic number. Check or reprocess the file"); + } + return std::equal(md5_graph, md5_graph + 32, other.md5_graph); +} + +bool FingerPrint::TestPrepare(const FingerPrint &other) const +{ + if (!other.IsMagicNumberOK()) + { + throw OSRMException("osrm input file misses magic number. Check or reprocess the file"); + } + return std::equal(md5_prepare, md5_prepare + 32, other.md5_prepare); +} + +bool FingerPrint::TestRTree(const FingerPrint &other) const +{ + if (!other.IsMagicNumberOK()) + { + throw OSRMException("r-tree input file misses magic number. Check or reprocess the file"); + } + return std::equal(md5_tree, md5_tree + 32, other.md5_tree); +} + +bool FingerPrint::TestQueryObjects(const FingerPrint &other) const +{ + if (!other.IsMagicNumberOK()) + { + throw OSRMException("missing magic number. Check or reprocess the file"); + } + return std::equal(md5_objects, md5_objects + 32, other.md5_objects); +} diff --git a/3party/osrm/osrm-tests/osrm-tests.pro b/3party/osrm/osrm-tests/osrm-tests.pro new file mode 100644 index 0000000000..a0200aded5 --- /dev/null +++ b/3party/osrm/osrm-tests/osrm-tests.pro @@ -0,0 +1,22 @@ +TARGET = osrm_tests +CONFIG += console warn_on +CONFIG -= app_bundle +TEMPLATE = app + +ROOT_DIR = ../../.. +DEPENDENCIES = osrm base + +include($$ROOT_DIR/common.pri) + +INCLUDEPATH = ../../boost \ + ../osrm-backend \ + ../osrm-backend/Include \ + ../../tbb/include \ + +LIBS *= -L$$_PRO_FILE_PWD_/libs.tmp.darwin.x86_64 -lboost_filesystem -lboost_thread -lboost_system + +HEADERS += \ + +SOURCES += \ + $$ROOT_DIR/testing/testingmain.cpp \ + osrm_smoke_test.cpp \ diff --git a/3party/osrm/osrm-tests/osrm_smoke_test.cpp b/3party/osrm/osrm-tests/osrm_smoke_test.cpp new file mode 100644 index 0000000000..2b11d950a2 --- /dev/null +++ b/3party/osrm/osrm-tests/osrm_smoke_test.cpp @@ -0,0 +1,6 @@ +#include "../../../testing/testing.hpp" + +UNIT_TEST(OSRM_Smoke) +{ + +} diff --git a/3party/osrm/osrm.pro b/3party/osrm/osrm.pro new file mode 100644 index 0000000000..8abc916d32 --- /dev/null +++ b/3party/osrm/osrm.pro @@ -0,0 +1,50 @@ +TARGET = osrm +TEMPLATE = lib +CONFIG += staticlib + +ROOT_DIR = ../.. + +include($$ROOT_DIR/common.pri) + +INCLUDEPATH *= osrm-backend/Include + +SOURCES += \ + osrm-backend/Algorithms/DouglasPeucker.cpp \ +# Algorithms/PolylineCompressor.cpp \ +# Contractor/EdgeBasedGraphFactory.cpp \ +# Contractor/GeometryCompressor.cpp \ +# Contractor/TemporaryStorage.cpp \ +# datastore.cpp \ + osrm-backend/DataStructures/Coordinate.cpp \ +# DataStructures/HilbertValue.cpp \ +# DataStructures/ImportEdge.cpp \ +# DataStructures/ImportNode.cpp \ +# DataStructures/RestrictionMap.cpp \ + osrm-backend/DataStructures/RouteParameters.cpp \ + osrm-backend/DataStructures/SearchEngineData.cpp \ + osrm-backend/Descriptors/DescriptionFactory.cpp \ +# Extractor/BaseParser.cpp \ +# Extractor/ExtractionContainers.cpp \ +# Extractor/ExtractorCallbacks.cpp \ +# Extractor/PBFParser.cpp \ +# Extractor/ScriptingEnvironment.cpp \ +# Extractor/XMLParser.cpp \ +# extractor.cpp \ +# Library/OSRM_impl.cpp \ +# prepare.cpp \ +# routed.cpp \ +# Server/Connection.cpp \ +# Server/Http/Reply.cpp \ +# Server/RequestHandler.cpp \ +# Server/RequestParser.cpp \ +# Tools/components.cpp \ +# Tools/io-benchmark.cpp \ +# Tools/simpleclient.cpp \ +# Tools/unlock_all_mutexes.cpp \ + +HEADERS += \ + osrm-backend/osrm/Include/Coordinate.h \ + osrm-backend/DataStructures/SearchEngineData.h \ + osrm-backend/DataStructures/RouteParameters.h \ + osrm-backend/Algorithms/DouglasPeucker.h \ + osrm-backend/Descriptors/DescriptionFactory.h \ diff --git a/omim.pro b/omim.pro index 82bc18bce3..2ec318f84c 100644 --- a/omim.pro +++ b/omim.pro @@ -22,6 +22,7 @@ SUBDIRS = 3party \ stats \ indexer \ platform \ + 3party/osrm/osrm-tests \ # it depends on base library, should be after it routing routing/routing_tests \ geometry/geometry_tests \ platform/platform_tests \