Added flatbuffers output support to the 'Nearest' service.

This commit is contained in:
Denis Chaplygin
2019-08-06 15:31:39 +03:00
parent acd3e81ab4
commit 9d7a74445d
7 changed files with 147 additions and 59 deletions
+5 -4
View File
@@ -54,11 +54,12 @@ class TableAPI final : public BaseAPI
if(response.is<flatbuffers::FlatBufferBuilder>()) {
auto& fb_result = response.get<flatbuffers::FlatBufferBuilder>();
MakeResponse(tables, phantoms, fallback_speed_cells, fb_result);
} else {
}
else
{
auto& json_result = response.get<util::json::Object>();
MakeResponse(tables, phantoms, fallback_speed_cells, json_result);
}
}
virtual void
@@ -177,7 +178,7 @@ class TableAPI final : public BaseAPI
boost::range::transform(
phantoms,
std::back_inserter(waypoints),
[this, &builder](const PhantomNode &phantom) { return BaseAPI::MakeWaypoint(builder, phantom); });
[this, &builder](const PhantomNode &phantom) { return BaseAPI::MakeWaypoint(builder, phantom).Finish(); });
return builder.CreateVector(waypoints);
}
@@ -192,7 +193,7 @@ class TableAPI final : public BaseAPI
std::back_inserter(waypoints),
[this, &builder, phantoms](const std::size_t idx) {
BOOST_ASSERT(idx < phantoms.size());
return BaseAPI::MakeWaypoint(builder, phantoms[idx]);
return BaseAPI::MakeWaypoint(builder, phantoms[idx]).Finish();
});
return builder.CreateVector(waypoints);
}