Adapts publicly facing new API
This commit is contained in:
		
							parent
							
								
									942c71814d
								
							
						
					
					
						commit
						23a5edb29b
					
				| @ -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 ¶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: | ||||
|     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; | ||||
| }; | ||||
|  | ||||
| @ -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") {} | ||||
|  | ||||
| @ -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 ¶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: | ||||
|     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 "engine/api/route_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/status.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); | ||||
| } | ||||
| 
 | ||||
| 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
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user