Adapts publicly facing new API
This commit is contained in:
parent
94f6005358
commit
ec79d1e933
@ -20,6 +20,7 @@ struct Object;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fwd decls
|
||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
struct EngineConfig;
|
struct EngineConfig;
|
||||||
@ -27,12 +28,20 @@ namespace api
|
|||||||
{
|
{
|
||||||
struct RouteParameters;
|
struct RouteParameters;
|
||||||
struct TableParameters;
|
struct TableParameters;
|
||||||
|
struct NearestParameters;
|
||||||
|
// struct TripParameters;
|
||||||
|
// struct MatchParameters;
|
||||||
}
|
}
|
||||||
namespace plugins
|
namespace plugins
|
||||||
{
|
{
|
||||||
class ViaRoutePlugin;
|
class ViaRoutePlugin;
|
||||||
class TablePlugin;
|
class TablePlugin;
|
||||||
|
class NearestPlugin;
|
||||||
|
// class TripPlugin;
|
||||||
|
// class MatchPlugin;
|
||||||
}
|
}
|
||||||
|
// End fwd decls
|
||||||
|
|
||||||
namespace datafacade
|
namespace datafacade
|
||||||
{
|
{
|
||||||
class BaseDataFacade;
|
class BaseDataFacade;
|
||||||
@ -45,19 +54,27 @@ class Engine final
|
|||||||
struct EngineLock;
|
struct EngineLock;
|
||||||
|
|
||||||
explicit Engine(EngineConfig &config);
|
explicit Engine(EngineConfig &config);
|
||||||
|
|
||||||
Engine(const Engine &) = delete;
|
Engine(const Engine &) = delete;
|
||||||
Engine &operator=(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();
|
~Engine();
|
||||||
|
|
||||||
Status Route(const api::RouteParameters ¶meters, util::json::Object &result);
|
Status Route(const api::RouteParameters ¶meters, util::json::Object &result);
|
||||||
Status Table(const api::TableParameters ¶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);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<EngineLock> lock;
|
std::unique_ptr<EngineLock> lock;
|
||||||
|
|
||||||
std::unique_ptr<plugins::ViaRoutePlugin> route_plugin;
|
std::unique_ptr<plugins::ViaRoutePlugin> route_plugin;
|
||||||
std::unique_ptr<plugins::TablePlugin> table_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;
|
std::unique_ptr<datafacade::BaseDataFacade> query_data_facade;
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ namespace plugins
|
|||||||
* This Plugin locates the nearest point on a street in the road network for a given coordinate.
|
* 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:
|
public:
|
||||||
explicit NearestPlugin(DataFacadeT *facade) : facade(facade), descriptor_string("nearest") {}
|
explicit NearestPlugin(DataFacadeT *facade) : facade(facade), descriptor_string("nearest") {}
|
||||||
|
@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Fwd decls
|
||||||
namespace util
|
namespace util
|
||||||
{
|
{
|
||||||
namespace json
|
namespace json
|
||||||
@ -50,12 +52,19 @@ namespace api
|
|||||||
{
|
{
|
||||||
struct RouteParameters;
|
struct RouteParameters;
|
||||||
struct TableParameters;
|
struct TableParameters;
|
||||||
|
struct NearestParameters;
|
||||||
|
// struct TripParameters;
|
||||||
|
// struct MatchParameters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// End fwd decls
|
||||||
|
|
||||||
using engine::EngineConfig;
|
using engine::EngineConfig;
|
||||||
using engine::api::RouteParameters;
|
using engine::api::RouteParameters;
|
||||||
using engine::api::TableParameters;
|
using engine::api::TableParameters;
|
||||||
|
using engine::api::NearestParameters;
|
||||||
|
// using engine::api::TripParameters;
|
||||||
|
// using engine::api::MatchParameters;
|
||||||
namespace json = util::json;
|
namespace json = util::json;
|
||||||
|
|
||||||
class OSRM
|
class OSRM
|
||||||
@ -69,6 +78,9 @@ class OSRM
|
|||||||
|
|
||||||
Status Route(const RouteParameters ¶meters, json::Object &result);
|
Status Route(const RouteParameters ¶meters, json::Object &result);
|
||||||
Status Table(const TableParameters ¶meters, json::Object &result);
|
Status Table(const TableParameters ¶meters, json::Object &result);
|
||||||
|
Status Nearest(const NearestParameters ¶meters, json::Object &result);
|
||||||
|
// Status Trip(const TripParameters ¶meters, json::Object &result);
|
||||||
|
// Status Match(const MatchParameters ¶meters, json::Object &result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<engine::Engine> engine_;
|
std::unique_ptr<engine::Engine> engine_;
|
||||||
|
0
src/engine/plugins/nearest.cpp
Normal file
0
src/engine/plugins/nearest.cpp
Normal file
@ -1,6 +1,9 @@
|
|||||||
#include "osrm/osrm.hpp"
|
#include "osrm/osrm.hpp"
|
||||||
#include "engine/api/route_parameters.hpp"
|
#include "engine/api/route_parameters.hpp"
|
||||||
#include "engine/api/table_parameters.hpp"
|
#include "engine/api/table_parameters.hpp"
|
||||||
|
#include "engine/api/nearest_parameters.hpp"
|
||||||
|
//#include "engine/api/trip_parameters.hpp"
|
||||||
|
//#include "engine/api/match_parameters.hpp"
|
||||||
#include "engine/engine.hpp"
|
#include "engine/engine.hpp"
|
||||||
#include "engine/status.hpp"
|
#include "engine/status.hpp"
|
||||||
#include "engine/engine_config.hpp"
|
#include "engine/engine_config.hpp"
|
||||||
@ -28,4 +31,19 @@ engine::Status OSRM::Table(const engine::api::TableParameters ¶ms, json::Obj
|
|||||||
return engine_->Table(params, result);
|
return engine_->Table(params, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
engine::Status OSRM::Nearest(const engine::api::NearestParameters ¶ms, json::Object &result)
|
||||||
|
{
|
||||||
|
return engine_->Nearest(params, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
//engine::Status OSRM::Trip(const engine::api::TripParameters ¶ms, json::Object &result)
|
||||||
|
//{
|
||||||
|
// return engine_->Trip(params, result);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//engine::Status OSRM::Match(const engine::api::MatchParameters ¶ms, json::Object &result)
|
||||||
|
//{
|
||||||
|
// return engine_->Match(params, result);
|
||||||
|
//}
|
||||||
|
|
||||||
} // ns osrm
|
} // ns osrm
|
||||||
|
Loading…
Reference in New Issue
Block a user