Added flatbuffers output support to the 'Match' service

This commit is contained in:
Denis Chaplygin
2019-08-08 18:20:03 +03:00
parent b7e9e5f2c0
commit 90191c9f34
5 changed files with 144 additions and 48 deletions
+1 -2
View File
@@ -114,7 +114,6 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::MatchParameters &parameters,
osrm::engine::api::ResultT &result) const
{
auto& json_result = result.get<util::json::Object>();
if (!algorithms.HasMapMatching())
{
return Error("NotImplemented",
@@ -314,7 +313,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
}
api::MatchAPI match_api{facade, parameters, tidied};
match_api.MakeResponse(sub_matchings, sub_routes, json_result);
match_api.MakeResponse(sub_matchings, sub_routes, result);
return Status::Ok;
}
+6
View File
@@ -68,6 +68,12 @@ MatchService::RunQuery(std::size_t prefix_length, std::string &query, osrm::engi
}
BOOST_ASSERT(parameters->IsValid());
if (parameters->format)
{
if (parameters->format == engine::api::BaseParameters::OutputFormatType::FLATBUFFERS) {
result = flatbuffers::FlatBufferBuilder();
}
}
return BaseService::routing_machine.Match(*parameters, result);
}
}