Makes the OSRM interface threadsafe.
Technically speaking we're changing the `libosrm` API. But since we're only lifting restrictions by marking the API threadsafe, we should be fine here.
This commit is contained in:
@@ -55,7 +55,7 @@ class Engine final
|
||||
// Needs to be public
|
||||
struct EngineLock;
|
||||
|
||||
explicit Engine(EngineConfig &config);
|
||||
explicit Engine(const EngineConfig &config);
|
||||
|
||||
Engine(Engine &&) noexcept;
|
||||
Engine &operator=(Engine &&) noexcept;
|
||||
@@ -63,12 +63,12 @@ class Engine final
|
||||
// Impl. in cpp since for unique_ptr of incomplete types
|
||||
~Engine();
|
||||
|
||||
Status Route(const api::RouteParameters ¶meters, util::json::Object &result);
|
||||
Status Table(const api::TableParameters ¶meters, util::json::Object &result);
|
||||
Status Nearest(const api::NearestParameters ¶meters, util::json::Object &result);
|
||||
Status Trip(const api::TripParameters ¶meters, util::json::Object &result);
|
||||
Status Match(const api::MatchParameters ¶meters, util::json::Object &result);
|
||||
Status Tile(const api::TileParameters ¶meters, std::string &result);
|
||||
Status Route(const api::RouteParameters ¶meters, util::json::Object &result) const;
|
||||
Status Table(const api::TableParameters ¶meters, util::json::Object &result) const;
|
||||
Status Nearest(const api::NearestParameters ¶meters, util::json::Object &result) const;
|
||||
Status Trip(const api::TripParameters ¶meters, util::json::Object &result) const;
|
||||
Status Match(const api::MatchParameters ¶meters, util::json::Object &result) const;
|
||||
Status Tile(const api::TileParameters ¶meters, std::string &result) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<EngineLock> lock;
|
||||
|
||||
@@ -83,7 +83,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, RouteParameters and json::Object
|
||||
*/
|
||||
Status Route(const RouteParameters ¶meters, json::Object &result);
|
||||
Status Route(const RouteParameters ¶meters, json::Object &result) const;
|
||||
|
||||
/**
|
||||
* Distance tables for coordinates.
|
||||
@@ -92,7 +92,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, TableParameters and json::Object
|
||||
*/
|
||||
Status Table(const TableParameters ¶meters, json::Object &result);
|
||||
Status Table(const TableParameters ¶meters, json::Object &result) const;
|
||||
|
||||
/**
|
||||
* Nearest street segment for coordinate.
|
||||
@@ -101,7 +101,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, NearestParameters and json::Object
|
||||
*/
|
||||
Status Nearest(const NearestParameters ¶meters, json::Object &result);
|
||||
Status Nearest(const NearestParameters ¶meters, json::Object &result) const;
|
||||
|
||||
/**
|
||||
* Trip: shortest round trip between coordinates.
|
||||
@@ -110,7 +110,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, TripParameters and json::Object
|
||||
*/
|
||||
Status Trip(const TripParameters ¶meters, json::Object &result);
|
||||
Status Trip(const TripParameters ¶meters, json::Object &result) const;
|
||||
|
||||
/**
|
||||
* Match: snaps noisy coordinate traces to the road network
|
||||
@@ -119,7 +119,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, MatchParameters and json::Object
|
||||
*/
|
||||
Status Match(const MatchParameters ¶meters, json::Object &result);
|
||||
Status Match(const MatchParameters ¶meters, json::Object &result) const;
|
||||
|
||||
/**
|
||||
* Tile: vector tiles with internal graph representation
|
||||
@@ -128,7 +128,7 @@ class OSRM final
|
||||
* \return Status indicating success for the query or failure
|
||||
* \see Status, TileParameters and json::Object
|
||||
*/
|
||||
Status Tile(const TileParameters ¶meters, std::string &result);
|
||||
Status Tile(const TileParameters ¶meters, std::string &result) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<engine::Engine> engine_;
|
||||
|
||||
Reference in New Issue
Block a user