Adapts publicly facing new API

This commit is contained in:
Daniel J. Hofmann
2016-02-17 12:56:27 -08:00
committed by Patrick Niklaus
parent a4387f39f1
commit f9d2440d95
5 changed files with 49 additions and 2 deletions
+18 -1
View File
@@ -20,6 +20,7 @@ struct Object;
}
}
// Fwd decls
namespace engine
{
struct EngineConfig;
@@ -27,12 +28,20 @@ namespace api
{
struct RouteParameters;
struct TableParameters;
struct NearestParameters;
// struct TripParameters;
// struct MatchParameters;
}
namespace plugins
{
class ViaRoutePlugin;
class TablePlugin;
class NearestPlugin;
// class TripPlugin;
// class MatchPlugin;
}
// End fwd decls
namespace datafacade
{
class BaseDataFacade;
@@ -45,19 +54,27 @@ class Engine final
struct EngineLock;
explicit Engine(EngineConfig &config);
Engine(const Engine &) = delete;
Engine &operator=(const Engine &) = delete;
// Needed because we have unique_ptr of incomplete types
// Impl. in cpp since for unique_ptr of incomplete types
~Engine();
Status Route(const api::RouteParameters &parameters, util::json::Object &result);
Status Table(const api::TableParameters &parameters, util::json::Object &result);
Status Nearest(const api::NearestParameters &parameters, util::json::Object &result);
// Status Trip(const api::TripParameters &parameters, util::json::Object &result);
// Status Match(const api::MatchParameters &parameters, util::json::Object &result);
private:
std::unique_ptr<EngineLock> lock;
std::unique_ptr<plugins::ViaRoutePlugin> route_plugin;
std::unique_ptr<plugins::TablePlugin> table_plugin;
std::unique_ptr<plugins::NearestPlugin> nearest_plugin;
// std::unique_ptr<plugins::TripPlugin> trip_plugin;
// std::unique_ptr<plugins::MatchPlugin> match_plugin;
std::unique_ptr<datafacade::BaseDataFacade> query_data_facade;
};
+1 -1
View File
@@ -19,7 +19,7 @@ namespace plugins
* This Plugin locates the nearest point on a street in the road network for a given coordinate.
*/
template <class DataFacadeT> class NearestPlugin final : public BasePlugin
class NearestPlugin final : public BasePlugin
{
public:
explicit NearestPlugin(DataFacadeT *facade) : facade(facade), descriptor_string("nearest") {}
+12
View File
@@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace osrm
{
// Fwd decls
namespace util
{
namespace json
@@ -50,12 +52,19 @@ namespace api
{
struct RouteParameters;
struct TableParameters;
struct NearestParameters;
// struct TripParameters;
// struct MatchParameters;
}
}
// End fwd decls
using engine::EngineConfig;
using engine::api::RouteParameters;
using engine::api::TableParameters;
using engine::api::NearestParameters;
// using engine::api::TripParameters;
// using engine::api::MatchParameters;
namespace json = util::json;
class OSRM
@@ -69,6 +78,9 @@ class OSRM
Status Route(const RouteParameters &parameters, json::Object &result);
Status Table(const TableParameters &parameters, json::Object &result);
Status Nearest(const NearestParameters &parameters, json::Object &result);
// Status Trip(const TripParameters &parameters, json::Object &result);
// Status Match(const MatchParameters &parameters, json::Object &result);
private:
std::unique_ptr<engine::Engine> engine_;