From fd2f0000752bc1a5a2f3418ff114ab3d7ca0f3c3 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 17 Dec 2013 17:59:44 +0100 Subject: [PATCH] install lib header files with make install target --- Algorithms/DouglasPeucker.h | 3 +- Algorithms/StronglyConnectedComponents.h | 3 +- CMakeLists.txt | 40 ++++--- DataStructures/Coordinate.cpp | 2 +- DataStructures/EdgeBasedNode.h | 3 +- DataStructures/HilbertValue.h | 2 +- DataStructures/PhantomNodes.h | 2 +- DataStructures/QueryNode.h | 3 +- DataStructures/RawRouteData.h | 3 +- DataStructures/SearchEngine.h | 3 +- DataStructures/SegmentInformation.h | 3 +- DataStructures/StaticRTree.h | 3 +- Descriptors/BaseDescriptor.h | 3 +- Descriptors/DescriptionFactory.h | 3 +- Extractor/ExtractorCallbacks.cpp | 2 +- Extractor/ExtractorStructs.h | 3 +- Extractor/PBFParser.cpp | 3 +- Extractor/XMLParser.cpp | 3 +- Library/OSRM.h | 7 +- Library/OSRM_impl.h | 7 +- Library/include/Coordinate.h | 84 ++++++++++++++ Library/include/Header.h | 45 ++++++++ Library/include/Reply.h | 71 ++++++++++++ Library/include/RouteParameters.h | 121 +++++++++++++++++++++ Library/include/ServerPaths.h | 41 +++++++ Plugins/BasePlugin.h | 6 +- Server/Connection.h | 3 +- Server/DataStructures/BaseDataFacade.h | 3 +- Server/DataStructures/InternalDataFacade.h | 3 +- Server/DataStructures/SharedDataType.h | 3 +- Server/Http/Reply.cpp | 3 +- Server/RequestHandler.cpp | 3 +- Server/RequestHandler.h | 3 +- Server/RequestParser.h | 2 +- Util/ComputeAngle.h | 6 +- Util/GitDescription.h | 5 + Util/ProgramOptions.h | 4 +- 37 files changed, 452 insertions(+), 55 deletions(-) create mode 100644 Library/include/Coordinate.h create mode 100644 Library/include/Header.h create mode 100644 Library/include/Reply.h create mode 100644 Library/include/RouteParameters.h create mode 100644 Library/include/ServerPaths.h diff --git a/Algorithms/DouglasPeucker.h b/Algorithms/DouglasPeucker.h index a26036bb5..0f314f200 100644 --- a/Algorithms/DouglasPeucker.h +++ b/Algorithms/DouglasPeucker.h @@ -28,9 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef DOUGLASPEUCKER_H_ #define DOUGLASPEUCKER_H_ -#include "../DataStructures/Coordinate.h" #include "../DataStructures/SegmentInformation.h" +#include + #include #include diff --git a/Algorithms/StronglyConnectedComponents.h b/Algorithms/StronglyConnectedComponents.h index 51b2f76bc..e7b8d33d9 100644 --- a/Algorithms/StronglyConnectedComponents.h +++ b/Algorithms/StronglyConnectedComponents.h @@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef STRONGLYCONNECTEDCOMPONENTS_H_ #define STRONGLYCONNECTEDCOMPONENTS_H_ -#include "../DataStructures/Coordinate.h" #include "../DataStructures/DeallocatingVector.h" #include "../DataStructures/DynamicGraph.h" #include "../DataStructures/ImportEdge.h" @@ -39,6 +38,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/SimpleLogger.h" +#include + #include #include #include diff --git a/CMakeLists.txt b/CMakeLists.txt index ca24d3fde..0db1bc1f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ else() message(WARNING "Building on a 32 bit system is unsupported") endif() +include_directories(${CMAKE_SOURCE_DIR}/Library/include) + add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Util/UUID.cpp UUID.cpp.alwaysbuild COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UUID-Config.cmake @@ -33,11 +35,11 @@ set(BOOST_COMPONENTS filesystem iostreams program_options regex system thread) configure_file(Util/GitDescription.cpp.in ${CMAKE_SOURCE_DIR}/Util/GitDescription.cpp) file(GLOB ExtractorGlob Extractor/*.cpp) set(ExtractorSources extractor.cpp ${ExtractorGlob}) -add_executable(osrm-extract ${ExtractorSources} ) +add_executable(osrm-extract ${ExtractorSources}) -file( GLOB PrepareGlob Contractor/*.cpp DataStructures/HilbertValue.cpp) -set( PrepareSources prepare.cpp ${PrepareGlob} ) -add_executable( osrm-prepare ${PrepareSources} ) +file(GLOB PrepareGlob Contractor/*.cpp DataStructures/HilbertValue.cpp) +set(PrepareSources prepare.cpp ${PrepareGlob}) +add_executable(osrm-prepare ${PrepareSources}) file(GLOB ServerGlob Server/*.cpp) file(GLOB DescriptorGlob Descriptors/*.cpp) @@ -47,7 +49,8 @@ file(GLOB AlgorithmGlob Algorithms/*.cpp) file(GLOB HttpGlob Server/Http/*.cpp) file(GLOB LibOSRMGlob Library/*.cpp) -set(OSRMSources ${LibOSRMGlob} ${DescriptorGlob} ${DatastructureGlob} ${CoordinateGlob} ${AlgorithmGlob} ${HttpGlob}) +set(OSRMSources ${LibOSRMGlob} ${DescriptorGlob} ${DatastructureGlob} ${AlgorithmGlob} ${HttpGlob}) +add_library( COORDLIB STATIC ${CoordinateGlob} ) add_library( OSRM SHARED ${OSRMSources} Util/GitDescription.cpp Util/UUID.cpp ) add_library( UUID STATIC Util/UUID.cpp ) add_library( GITDESCRIPTION STATIC Util/GitDescription.cpp ) @@ -56,7 +59,7 @@ add_dependencies( GITDESCRIPTION GIT_DESCRIPTION ) add_executable(osrm-routed routed.cpp ${ServerGlob}) set_target_properties(osrm-routed PROPERTIES COMPILE_FLAGS -DROUTED) -add_executable(osrm-datastore datastore.cpp ${CoordinateGlob}) +add_executable(osrm-datastore datastore.cpp) # Check the release mode if(NOT CMAKE_BUILD_TYPE MATCHES Debug) @@ -109,11 +112,11 @@ if(NOT Boost_FOUND) endif(NOT Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) -target_link_libraries( OSRM ${Boost_LIBRARIES} ) -target_link_libraries( osrm-extract ${CoordinateGlob} ${Boost_LIBRARIES} UUID GITDESCRIPTION ) -target_link_libraries( osrm-prepare ${CoordinateGlob} ${Boost_LIBRARIES} UUID GITDESCRIPTION ) -target_link_libraries( osrm-routed ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION ) -target_link_libraries( osrm-datastore ${Boost_LIBRARIES} UUID GITDESCRIPTION ) +target_link_libraries(OSRM ${Boost_LIBRARIES} COORDLIB) +target_link_libraries(osrm-extract ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB) +target_link_libraries(osrm-prepare ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB) +target_link_libraries(osrm-routed ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION) +target_link_libraries(osrm-datastore ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB) find_package( Threads REQUIRED ) target_link_libraries (osrm-extract ${CMAKE_THREAD_LIBS_INIT}) @@ -180,7 +183,7 @@ if(WITH_TOOLS) add_executable(osrm-components Tools/componentAnalysis.cpp) include_directories(${GDAL_INCLUDE_DIR}) target_link_libraries( - osrm-components ${GDAL_LIBRARIES} ${Boost_LIBRARIES} UUID GITDESCRIPTION ${CoordinateGlob} + osrm-components ${GDAL_LIBRARIES} ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB ) endif(GDAL_FOUND) add_executable ( osrm-cli Tools/simpleclient.cpp) @@ -194,8 +197,11 @@ if(WITH_TOOLS) endif(UNIX AND NOT APPLE) endif(WITH_TOOLS) -install (TARGETS osrm-extract DESTINATION bin) -install (TARGETS osrm-prepare DESTINATION bin) -install (TARGETS osrm-datastore DESTINATION bin) -install (TARGETS osrm-routed DESTINATION bin) -install (TARGETS OSRM DESTINATION lib) +file(GLOB InstallGlob Library/include/*.h) + +install(FILES ${InstallGlob} DESTINATION include) +install(TARGETS osrm-extract DESTINATION bin) +install(TARGETS osrm-prepare DESTINATION bin) +install(TARGETS osrm-datastore DESTINATION bin) +install(TARGETS osrm-routed DESTINATION bin) +install(TARGETS OSRM DESTINATION lib) diff --git a/DataStructures/Coordinate.cpp b/DataStructures/Coordinate.cpp index e90a96625..0a9663af6 100644 --- a/DataStructures/Coordinate.cpp +++ b/DataStructures/Coordinate.cpp @@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "Coordinate.h" +#include #include "../Util/StringUtil.h" #include diff --git a/DataStructures/EdgeBasedNode.h b/DataStructures/EdgeBasedNode.h index 38403ca16..bf6c8c6fe 100644 --- a/DataStructures/EdgeBasedNode.h +++ b/DataStructures/EdgeBasedNode.h @@ -3,10 +3,11 @@ #include -#include "Coordinate.h" #include "../Util/MercatorUtil.h" #include "../typedefs.h" +#include + struct EdgeBasedNode { EdgeBasedNode() : diff --git a/DataStructures/HilbertValue.h b/DataStructures/HilbertValue.h index 9cfbc98f2..6608623cf 100644 --- a/DataStructures/HilbertValue.h +++ b/DataStructures/HilbertValue.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef HILBERTVALUE_H_ #define HILBERTVALUE_H_ -#include "Coordinate.h" +#include #include #include diff --git a/DataStructures/PhantomNodes.h b/DataStructures/PhantomNodes.h index 48c65508b..99e0e8dd9 100644 --- a/DataStructures/PhantomNodes.h +++ b/DataStructures/PhantomNodes.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef PHANTOMNODES_H_ #define PHANTOMNODES_H_ -#include "Coordinate.h" +#include struct PhantomNode { PhantomNode() : diff --git a/DataStructures/QueryNode.h b/DataStructures/QueryNode.h index 011d43552..c50a8d2c5 100644 --- a/DataStructures/QueryNode.h +++ b/DataStructures/QueryNode.h @@ -28,9 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _NODE_COORDS_H #define _NODE_COORDS_H -#include "Coordinate.h" #include "../typedefs.h" +#include + #include #include diff --git a/DataStructures/RawRouteData.h b/DataStructures/RawRouteData.h index ef8779668..8158dbc1b 100644 --- a/DataStructures/RawRouteData.h +++ b/DataStructures/RawRouteData.h @@ -28,10 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef RAWROUTEDATA_H_ #define RAWROUTEDATA_H_ -#include "../DataStructures/Coordinate.h" #include "../DataStructures/PhantomNodes.h" #include "../typedefs.h" +#include + #include #include diff --git a/DataStructures/SearchEngine.h b/DataStructures/SearchEngine.h index e0fb41db7..c00fa54ef 100644 --- a/DataStructures/SearchEngine.h +++ b/DataStructures/SearchEngine.h @@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef SEARCHENGINE_H #define SEARCHENGINE_H -#include "Coordinate.h" #include "SearchEngineData.h" #include "PhantomNodes.h" #include "QueryEdge.h" @@ -38,6 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/StringUtil.h" #include "../typedefs.h" +#include + #include #include diff --git a/DataStructures/SegmentInformation.h b/DataStructures/SegmentInformation.h index 738e2879a..eb0ba0115 100644 --- a/DataStructures/SegmentInformation.h +++ b/DataStructures/SegmentInformation.h @@ -28,11 +28,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef SEGMENTINFORMATION_H_ #define SEGMENTINFORMATION_H_ -#include "Coordinate.h" #include "TurnInstructions.h" #include "../typedefs.h" +#include + // Struct fits everything in one cache line struct SegmentInformation { FixedPointCoordinate location; diff --git a/DataStructures/StaticRTree.h b/DataStructures/StaticRTree.h index 1b397270c..37053a766 100644 --- a/DataStructures/StaticRTree.h +++ b/DataStructures/StaticRTree.h @@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef STATICRTREE_H_ #define STATICRTREE_H_ -#include "Coordinate.h" #include "DeallocatingVector.h" #include "HilbertValue.h" #include "PhantomNodes.h" @@ -41,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/TimingUtil.h" #include "../typedefs.h" +#include + #include #include #include diff --git a/Descriptors/BaseDescriptor.h b/Descriptors/BaseDescriptor.h index d447e2c2c..99dad793f 100644 --- a/Descriptors/BaseDescriptor.h +++ b/Descriptors/BaseDescriptor.h @@ -31,10 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../DataStructures/HashTable.h" #include "../DataStructures/PhantomNodes.h" #include "../DataStructures/RawRouteData.h" -#include "../Server/Http/Reply.h" #include "../Util/StringUtil.h" #include "../typedefs.h" +#include + #include #include diff --git a/Descriptors/DescriptionFactory.h b/Descriptors/DescriptionFactory.h index 549191c79..5be12456a 100644 --- a/Descriptors/DescriptionFactory.h +++ b/Descriptors/DescriptionFactory.h @@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Algorithms/DouglasPeucker.h" #include "../Algorithms/PolylineCompressor.h" -#include "../DataStructures/Coordinate.h" #include "../DataStructures/PhantomNodes.h" #include "../DataStructures/RawRouteData.h" #include "../DataStructures/SegmentInformation.h" @@ -38,6 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/SimpleLogger.h" #include "../typedefs.h" +#include + #include #include diff --git a/Extractor/ExtractorCallbacks.cpp b/Extractor/ExtractorCallbacks.cpp index 5edcb946d..0c1cb276f 100644 --- a/Extractor/ExtractorCallbacks.cpp +++ b/Extractor/ExtractorCallbacks.cpp @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ExtractionHelperFunctions.h" #include "ExtractorCallbacks.h" -#include "../DataStructures/Coordinate.h" +#include #include diff --git a/Extractor/ExtractorStructs.h b/Extractor/ExtractorStructs.h index 144bf7f71..02c2cde5c 100644 --- a/Extractor/ExtractorStructs.h +++ b/Extractor/ExtractorStructs.h @@ -28,13 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef EXTRACTORSTRUCTS_H_ #define EXTRACTORSTRUCTS_H_ -#include "../DataStructures/Coordinate.h" #include "../DataStructures/HashTable.h" #include "../DataStructures/ImportNode.h" #include "../DataStructures/QueryNode.h" #include "../DataStructures/Restriction.h" #include "../typedefs.h" +#include + #include #include #include diff --git a/Extractor/PBFParser.cpp b/Extractor/PBFParser.cpp index 193d74946..73f53137e 100644 --- a/Extractor/PBFParser.cpp +++ b/Extractor/PBFParser.cpp @@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ExtractorCallbacks.h" #include "ExtractorStructs.h" #include "PBFParser.h" -#include "../DataStructures/Coordinate.h" #include "../DataStructures/HashTable.h" #include "../Util/MachineInfo.h" #include "../Util/OpenMPWrapper.h" @@ -36,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/SimpleLogger.h" #include "../typedefs.h" +#include + #include #include #include diff --git a/Extractor/XMLParser.cpp b/Extractor/XMLParser.cpp index 15788ec3f..9ce5e2a77 100644 --- a/Extractor/XMLParser.cpp +++ b/Extractor/XMLParser.cpp @@ -30,11 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ExtractorStructs.h" #include "../DataStructures/HashTable.h" #include "../DataStructures/InputReaderFactory.h" -#include "../DataStructures/Coordinate.h" #include "../Util/SimpleLogger.h" #include "../Util/StringUtil.h" #include "../typedefs.h" +#include + #include XMLParser::XMLParser(const char * filename, ExtractorCallbacks* ec, ScriptingEnvironment& se) : BaseParser(ec, se) { diff --git a/Library/OSRM.h b/Library/OSRM.h index 61568f2b8..03b8dc5d8 100644 --- a/Library/OSRM.h +++ b/Library/OSRM.h @@ -30,10 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include "../Server/DataStructures/RouteParameters.h" -#include "../Server/Http/Reply.h" +#include +#include +#include + #include "../Util/ProgramOptions.h" -#include "../Util/ServerPaths.h" class OSRM_impl; diff --git a/Library/OSRM_impl.h b/Library/OSRM_impl.h index fd8b4bfb8..d8aaac9de 100644 --- a/Library/OSRM_impl.h +++ b/Library/OSRM_impl.h @@ -28,14 +28,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef OSRM_IMPL_H #define OSRM_IMPL_H +#include +#include +#include + #include "../DataStructures/QueryEdge.h" #include "../Plugins/BasePlugin.h" -#include "../Server/Http/Reply.h" -#include "../Server/DataStructures/RouteParameters.h" #include "../Server/DataStructures/SharedBarriers.h" #include "../Server/DataStructures/BaseDataFacade.h" #include "../Util/ProgramOptions.h" -#include "../Util/ServerPaths.h" #include diff --git a/Library/include/Coordinate.h b/Library/include/Coordinate.h new file mode 100644 index 000000000..1f7a27a28 --- /dev/null +++ b/Library/include/Coordinate.h @@ -0,0 +1,84 @@ +/* + +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 FIXED_POINT_COORDINATE_H_ +#define FIXED_POINT_COORDINATE_H_ + +#include + +static const double COORDINATE_PRECISION = 1000000.; + +struct FixedPointCoordinate { + int lat; + int lon; + + FixedPointCoordinate(); + explicit FixedPointCoordinate (int lat, int lon); + void Reset(); + bool isSet() const; + bool isValid() const; + bool operator==(const FixedPointCoordinate & other) const; + + static double ApproximateDistance( + const int lat1, + const int lon1, + const int lat2, + const int lon2 + ); + + static double ApproximateDistance( + const FixedPointCoordinate & c1, + const FixedPointCoordinate & c2 + ); + + static double ApproximateEuclideanDistance( + const FixedPointCoordinate & c1, + const FixedPointCoordinate & c2 + ); + + static void convertInternalLatLonToString( + const int value, + std::string & output + ); + + static void convertInternalCoordinateToString( + const FixedPointCoordinate & coord, + std::string & output + ); + + static void convertInternalReversedCoordinateToString( + const FixedPointCoordinate & coord, + std::string & output + ); +}; + +inline std::ostream & operator<<(std::ostream & out, const FixedPointCoordinate & c){ + out << "(" << c.lat << "," << c.lon << ")"; + return out; +} + +#endif /* FIXED_POINT_COORDINATE_H_ */ diff --git a/Library/include/Header.h b/Library/include/Header.h new file mode 100644 index 000000000..29c300061 --- /dev/null +++ b/Library/include/Header.h @@ -0,0 +1,45 @@ +/* + +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 HTTP_HEADER_H +#define HTTP_HEADER_H + +#include + +namespace http { + + struct Header { + std::string name; + std::string value; + void Clear() { + name.clear(); + value.clear(); + } + }; +} + +#endif //HTTP_HEADER_H diff --git a/Library/include/Reply.h b/Library/include/Reply.h new file mode 100644 index 000000000..a04ccdc5a --- /dev/null +++ b/Library/include/Reply.h @@ -0,0 +1,71 @@ +/* + +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 REPLY_H +#define REPLY_H + +#include + +#include + +#include + +namespace http { + +const char okHTML[] = ""; +const char badRequestHTML[] = "Bad Request

400 Bad Request

"; +const char internalServerErrorHTML[] = "Internal Server Error

500 Internal Server Error

"; +const char seperators[] = { ':', ' ' }; +const char crlf[] = { '\r', '\n' }; +const std::string okString = "HTTP/1.0 200 OK\r\n"; +const std::string badRequestString = "HTTP/1.0 400 Bad Request\r\n"; +const std::string internalServerErrorString = "HTTP/1.0 500 Internal Server Error\r\n"; + +class Reply { +public: + enum status_type { + ok = 200, + badRequest = 400, + internalServerError = 500 + } status; + + + std::vector
headers; + std::vector toBuffers(); + std::vector HeaderstoBuffers(); + std::vector content; + static Reply StockReply(status_type status); + void setSize(const unsigned size); + Reply(); +private: + static std::string ToString(Reply::status_type status); + boost::asio::const_buffer ToBuffer(Reply::status_type status); +}; + +} + +#endif //REPLY_H diff --git a/Library/include/RouteParameters.h b/Library/include/RouteParameters.h new file mode 100644 index 000000000..3a0ea3aaa --- /dev/null +++ b/Library/include/RouteParameters.h @@ -0,0 +1,121 @@ +/* + +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 ROUTE_PARAMETERS_H +#define ROUTE_PARAMETERS_H + +#include + +#include +#include +#include + +#include +#include + +struct RouteParameters { + RouteParameters() : + zoomLevel(18), + printInstructions(false), + alternateRoute(true), + geometry(true), + compression(true), + deprecatedAPI(false), + checkSum(-1) {} + short zoomLevel; + bool printInstructions; + bool alternateRoute; + bool geometry; + bool compression; + bool deprecatedAPI; + unsigned checkSum; + std::string service; + std::string outputFormat; + std::string jsonpParameter; + std::string language; + std::vector hints; + std::vector coordinates; + + void setZoomLevel(const short i) { + if (18 > i && 0 < i) { + zoomLevel = i; + } + } + + void setAlternateRouteFlag(const bool b) { + alternateRoute = b; + } + + void setDeprecatedAPIFlag(const std::string &) { + deprecatedAPI = true; + } + + void setChecksum(const unsigned c) { + checkSum = c; + } + + void setInstructionFlag(const bool b) { + printInstructions = b; + } + + void setService( const std::string & s) { + service = s; + } + + void setOutputFormat(const std::string & s) { + outputFormat = s; + } + + void setJSONpParameter(const std::string & s) { + jsonpParameter = s; + } + + void addHint(const std::string & s) { + hints.resize(coordinates.size()); + hints.back() = s; + } + + void setLanguage(const std::string & s) { + language = s; + } + + void setGeometryFlag(const bool b) { + geometry = b; + } + + void setCompressionFlag(const bool b) { + compression = b; + } + + void addCoordinate(const boost::fusion::vector < double, double > & arg_) { + int lat = COORDINATE_PRECISION*boost::fusion::at_c < 0 > (arg_); + int lon = COORDINATE_PRECISION*boost::fusion::at_c < 1 > (arg_); + coordinates.push_back(FixedPointCoordinate(lat, lon)); + } +}; + +#endif /*ROUTE_PARAMETERS_H*/ diff --git a/Library/include/ServerPaths.h b/Library/include/ServerPaths.h new file mode 100644 index 000000000..23c2bb9af --- /dev/null +++ b/Library/include/ServerPaths.h @@ -0,0 +1,41 @@ +/* + +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 SERVER_PATH_H +#define SERVER_PATH_H + +#include +#include + +#include + +typedef boost::unordered_map< + const std::string, + boost::filesystem::path + > ServerPaths; + +#endif //SERVER_PATH_H diff --git a/Plugins/BasePlugin.h b/Plugins/BasePlugin.h index 037b63580..125369a8c 100644 --- a/Plugins/BasePlugin.h +++ b/Plugins/BasePlugin.h @@ -28,9 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef BASEPLUGIN_H_ #define BASEPLUGIN_H_ -#include "../DataStructures/Coordinate.h" -#include "../Server/DataStructures/RouteParameters.h" -#include "../Server/Http/Reply.h" +#include +#include +#include #include #include diff --git a/Server/Connection.h b/Server/Connection.h index 7b3b31721..68c7da6a8 100644 --- a/Server/Connection.h +++ b/Server/Connection.h @@ -29,9 +29,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define CONNECTION_H #include "Http/CompressionType.h" -#include "Http/Reply.h" #include "Http/Request.h" +#include + #include #include #include diff --git a/Server/DataStructures/BaseDataFacade.h b/Server/DataStructures/BaseDataFacade.h index fec11b47e..4de15eb42 100644 --- a/Server/DataStructures/BaseDataFacade.h +++ b/Server/DataStructures/BaseDataFacade.h @@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //Exposes all data access interfaces to the algorithms via base class ptr -#include "../../DataStructures/Coordinate.h" #include "../../DataStructures/EdgeBasedNode.h" #include "../../DataStructures/ImportNode.h" #include "../../DataStructures/PhantomNodes.h" @@ -39,6 +38,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../../Util/StringUtil.h" #include "../../typedefs.h" +#include + #include template diff --git a/Server/DataStructures/InternalDataFacade.h b/Server/DataStructures/InternalDataFacade.h index 025790c41..bc96d0127 100644 --- a/Server/DataStructures/InternalDataFacade.h +++ b/Server/DataStructures/InternalDataFacade.h @@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseDataFacade.h" -#include "../../DataStructures/Coordinate.h" #include "../../DataStructures/OriginalEdgeData.h" #include "../../DataStructures/QueryNode.h" #include "../../DataStructures/QueryEdge.h" @@ -44,6 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../../Util/ProgramOptions.h" #include "../../Util/SimpleLogger.h" +#include + template class InternalDataFacade : public BaseDataFacade { diff --git a/Server/DataStructures/SharedDataType.h b/Server/DataStructures/SharedDataType.h index 11470c57d..9fe39e389 100644 --- a/Server/DataStructures/SharedDataType.h +++ b/Server/DataStructures/SharedDataType.h @@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseDataFacade.h" -#include "../../DataStructures/Coordinate.h" #include "../../DataStructures/QueryEdge.h" #include "../../DataStructures/StaticGraph.h" #include "../../DataStructures/StaticRTree.h" @@ -39,6 +38,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../../typedefs.h" +#include + #include typedef BaseDataFacade::RTreeLeaf RTreeLeaf; diff --git a/Server/Http/Reply.cpp b/Server/Http/Reply.cpp index 3264a6f29..b45b50159 100644 --- a/Server/Http/Reply.cpp +++ b/Server/Http/Reply.cpp @@ -27,7 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include "Reply.h" +#include + #include "../../Util/StringUtil.h" namespace http { diff --git a/Server/RequestHandler.cpp b/Server/RequestHandler.cpp index 0bcff1075..31e6072fe 100644 --- a/Server/RequestHandler.cpp +++ b/Server/RequestHandler.cpp @@ -27,13 +27,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "APIGrammar.h" #include "RequestHandler.h" -#include "DataStructures/RouteParameters.h" #include "../Library/OSRM.h" #include "../Util/SimpleLogger.h" #include "../Util/StringUtil.h" #include "../typedefs.h" +#include + #include #include diff --git a/Server/RequestHandler.h b/Server/RequestHandler.h index 398788c03..0c170d515 100644 --- a/Server/RequestHandler.h +++ b/Server/RequestHandler.h @@ -28,9 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef REQUEST_HANDLER_H #define REQUEST_HANDLER_H -#include "Http/Reply.h" #include "Http/Request.h" +#include + #include #include diff --git a/Server/RequestParser.h b/Server/RequestParser.h index 760bc2f13..fbff7f5cd 100644 --- a/Server/RequestParser.h +++ b/Server/RequestParser.h @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define REQUEST_PARSER_H #include "Http/CompressionType.h" -#include "Http/Header.h" +#include #include #include diff --git a/Util/ComputeAngle.h b/Util/ComputeAngle.h index f7ea0fb90..a85926820 100644 --- a/Util/ComputeAngle.h +++ b/Util/ComputeAngle.h @@ -28,12 +28,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef COMPUTE_ANGLE_H #define COMPUTE_ANGLE_H +#include "../Util/MercatorUtil.h" +#include + #include #include -#include "../DataStructures/Coordinate.h" -#include "../Util/MercatorUtil.h" - /* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/ template inline static double GetAngleBetweenThreeFixedPointCoordinates ( diff --git a/Util/GitDescription.h b/Util/GitDescription.h index 92a6af337..d3a00f49a 100644 --- a/Util/GitDescription.h +++ b/Util/GitDescription.h @@ -25,4 +25,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef GIT_DESCRIPTION_H +#define GIT_DESCRIPTION_H + extern char g_GIT_DESCRIPTION[]; + +#endif //GIT_DESCRIPTION_H diff --git a/Util/ProgramOptions.h b/Util/ProgramOptions.h index bdabb2ddb..f5d10af30 100644 --- a/Util/ProgramOptions.h +++ b/Util/ProgramOptions.h @@ -30,9 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "GitDescription.h" #include "OSRMException.h" -#include "ServerPaths.h" #include "SimpleLogger.h" +#include + #include #include #include @@ -59,6 +60,7 @@ namespace boost { boost::program_options::validators::check_first_occurrence(v); const std::string & input_string = boost::program_options::validators::get_single_string(values); + SimpleLogger().Write() << "validator called for " << input_string; if(boost::filesystem::is_regular_file(input_string)) { v = boost::any(boost::filesystem::path(input_string)); } else {