2013-06-26 20:05:42 -04:00
|
|
|
/*
|
2013-10-14 07:42:28 -04:00
|
|
|
|
2017-10-02 05:28:25 -04:00
|
|
|
Copyright (c) 2017, Project OSRM contributors
|
2013-10-14 07:42:28 -04:00
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
2013-06-26 20:05:42 -04:00
|
|
|
|
2015-01-27 10:35:19 -05:00
|
|
|
#ifndef OSRM_HPP
|
|
|
|
#define OSRM_HPP
|
2013-06-26 20:05:42 -04:00
|
|
|
|
2019-08-15 04:40:23 -04:00
|
|
|
#include "engine/api/base_result.hpp"
|
2016-02-18 16:26:54 -05:00
|
|
|
#include "osrm/osrm_fwd.hpp"
|
2016-01-28 10:28:44 -05:00
|
|
|
#include "osrm/status.hpp"
|
|
|
|
|
2014-09-24 07:17:55 -04:00
|
|
|
#include <memory>
|
2016-03-02 19:48:30 -05:00
|
|
|
#include <string>
|
2014-09-24 07:17:55 -04:00
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
2016-02-18 16:26:54 -05:00
|
|
|
namespace json = util::json;
|
2016-01-07 13:19:55 -05:00
|
|
|
using engine::EngineConfig;
|
2018-02-05 06:40:18 -05:00
|
|
|
using engine::api::MatchParameters;
|
|
|
|
using engine::api::NearestParameters;
|
2016-01-28 10:28:44 -05:00
|
|
|
using engine::api::RouteParameters;
|
2016-02-12 17:49:28 -05:00
|
|
|
using engine::api::TableParameters;
|
2016-03-02 19:48:30 -05:00
|
|
|
using engine::api::TileParameters;
|
2018-02-05 06:40:18 -05:00
|
|
|
using engine::api::TripParameters;
|
2016-02-18 16:15:07 -05:00
|
|
|
|
2016-04-01 11:23:41 -04:00
|
|
|
/**
|
|
|
|
* Represents a Open Source Routing Machine with access to its services.
|
|
|
|
*
|
|
|
|
* This represents an Open Source Routing Machine (OSRM) instance, with the services:
|
|
|
|
*
|
|
|
|
* - Route: shortest path queries for coordinates
|
|
|
|
* - Table: distance tables for coordinates
|
|
|
|
* - Nearest: nearest street segment for coordinate
|
|
|
|
* - Trip: shortest round trip between coordinates
|
|
|
|
* - Match: snaps noisy coordinate traces to the road network
|
|
|
|
* - Tile: vector tiles with internal graph representation
|
|
|
|
*
|
|
|
|
* All services take service-specific parameters, fill a JSON object, and return a status code.
|
|
|
|
*/
|
2016-02-18 16:15:07 -05:00
|
|
|
class OSRM final
|
2014-05-07 10:17:14 -04:00
|
|
|
{
|
2016-02-12 17:49:28 -05:00
|
|
|
public:
|
2016-04-01 11:23:41 -04:00
|
|
|
/**
|
|
|
|
* Constructs an OSRM instance with user-configurable settings.
|
|
|
|
*
|
|
|
|
* \param config The user-provided OSRM configuration.
|
|
|
|
* \see EngineConfig
|
|
|
|
*/
|
2016-02-12 17:49:28 -05:00
|
|
|
explicit OSRM(EngineConfig &config);
|
2016-04-01 11:23:41 -04:00
|
|
|
|
2016-02-12 17:49:28 -05:00
|
|
|
~OSRM();
|
|
|
|
|
2016-04-01 11:23:41 -04:00
|
|
|
// Moveable but not copyable
|
2016-02-12 17:49:28 -05:00
|
|
|
OSRM(OSRM &&) noexcept;
|
|
|
|
OSRM &operator=(OSRM &&) noexcept;
|
|
|
|
|
2016-04-01 11:23:41 -04:00
|
|
|
/**
|
|
|
|
* Shortest path queries for coordinates.
|
|
|
|
*
|
|
|
|
* \param parameters route query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, RouteParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Route(const RouteParameters ¶meters, json::Object &result) const;
|
|
|
|
Status Route(const RouteParameters ¶meters, engine::api::ResultT &result) const;
|
2016-04-01 11:23:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Distance tables for coordinates.
|
|
|
|
*
|
|
|
|
* \param parameters table query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, TableParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Table(const TableParameters ¶meters, json::Object &result) const;
|
|
|
|
Status Table(const TableParameters ¶meters, engine::api::ResultT &result) const;
|
2016-04-01 11:23:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Nearest street segment for coordinate.
|
|
|
|
*
|
|
|
|
* \param parameters nearest query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, NearestParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Nearest(const NearestParameters ¶meters, json::Object &result) const;
|
|
|
|
Status Nearest(const NearestParameters ¶meters, engine::api::ResultT &result) const;
|
2016-04-01 11:23:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Trip: shortest round trip between coordinates.
|
|
|
|
*
|
|
|
|
* \param parameters trip query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, TripParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Trip(const TripParameters ¶meters, json::Object &result) const;
|
|
|
|
Status Trip(const TripParameters ¶meters, engine::api::ResultT &result) const;
|
2016-04-01 11:23:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Match: snaps noisy coordinate traces to the road network
|
|
|
|
*
|
|
|
|
* \param parameters match query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, MatchParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Match(const MatchParameters ¶meters, json::Object &result) const;
|
|
|
|
Status Match(const MatchParameters ¶meters, engine::api::ResultT &result) const;
|
2016-04-01 11:23:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tile: vector tiles with internal graph representation
|
|
|
|
*
|
|
|
|
* \param parameters tile query specific parameters
|
|
|
|
* \return Status indicating success for the query or failure
|
|
|
|
* \see Status, TileParameters and json::Object
|
|
|
|
*/
|
2021-01-27 12:14:44 -05:00
|
|
|
Status Tile(const TileParameters ¶meters, std::string &result) const;
|
|
|
|
Status Tile(const TileParameters ¶meters, engine::api::ResultT &result) const;
|
2016-02-12 17:49:28 -05:00
|
|
|
|
2014-05-07 10:17:14 -04:00
|
|
|
private:
|
2017-01-09 15:40:33 -05:00
|
|
|
std::unique_ptr<engine::EngineInterface> engine_;
|
2013-06-26 20:05:42 -04:00
|
|
|
};
|
2020-11-26 10:21:39 -05:00
|
|
|
} // namespace osrm
|
2013-06-26 20:05:42 -04:00
|
|
|
|
2015-01-27 10:35:19 -05:00
|
|
|
#endif // OSRM_HPP
|