add final/override keyword where possible to help compiler de-virtualize function calls
This commit is contained in:
@@ -60,9 +60,9 @@ template <class DataFacadeT> class DistanceTablePlugin : public BasePlugin
|
||||
|
||||
virtual ~DistanceTablePlugin() {}
|
||||
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply) final
|
||||
{
|
||||
// check number of parameters
|
||||
if (2 > route_parameters.coordinates.size())
|
||||
@@ -77,7 +77,9 @@ template <class DataFacadeT> class DistanceTablePlugin : public BasePlugin
|
||||
if (std::any_of(begin(route_parameters.coordinates),
|
||||
end(route_parameters.coordinates),
|
||||
[&](FixedPointCoordinate coordinate)
|
||||
{ return !coordinate.isValid(); }))
|
||||
{
|
||||
return !coordinate.isValid();
|
||||
}))
|
||||
{
|
||||
reply = http::Reply::StockReply(http::Reply::badRequest);
|
||||
return;
|
||||
|
||||
@@ -42,9 +42,9 @@ class HelloWorldPlugin : public BasePlugin
|
||||
public:
|
||||
HelloWorldPlugin() : descriptor_string("hello") {}
|
||||
virtual ~HelloWorldPlugin() {}
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
|
||||
void HandleRequest(const RouteParameters &routeParameters, http::Reply &reply)
|
||||
void HandleRequest(const RouteParameters &routeParameters, http::Reply &reply) final
|
||||
{
|
||||
reply.status = http::Reply::ok;
|
||||
|
||||
@@ -60,9 +60,11 @@ class HelloWorldPlugin : public BasePlugin
|
||||
json_result.values["instructions"] = (routeParameters.print_instructions ? "yes" : "no");
|
||||
json_result.values["geometry"] = (routeParameters.geometry ? "yes" : "no");
|
||||
json_result.values["compression"] = (routeParameters.compression ? "yes" : "no");
|
||||
json_result.values["output_format"] = (!routeParameters.output_format.empty() ? "yes" : "no");
|
||||
json_result.values["output_format"] =
|
||||
(!routeParameters.output_format.empty() ? "yes" : "no");
|
||||
|
||||
json_result.values["jsonp_parameter"] = (!routeParameters.jsonp_parameter.empty() ? "yes" : "no");
|
||||
json_result.values["jsonp_parameter"] =
|
||||
(!routeParameters.jsonp_parameter.empty() ? "yes" : "no");
|
||||
json_result.values["language"] = (!routeParameters.language.empty() ? "yes" : "no");
|
||||
|
||||
temp_string = UintToString(static_cast<unsigned>(routeParameters.coordinates.size()));
|
||||
|
||||
@@ -39,13 +39,12 @@ template <class DataFacadeT> class LocatePlugin : public BasePlugin
|
||||
{
|
||||
public:
|
||||
explicit LocatePlugin(DataFacadeT *facade) : descriptor_string("locate"), facade(facade) {}
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply) final
|
||||
{
|
||||
// check number of parameters
|
||||
if (route_parameters.coordinates.empty() ||
|
||||
!route_parameters.coordinates.front().isValid())
|
||||
if (route_parameters.coordinates.empty() || !route_parameters.coordinates.front().isValid())
|
||||
{
|
||||
reply = http::Reply::StockReply(http::Reply::badRequest);
|
||||
return;
|
||||
@@ -63,8 +62,8 @@ template <class DataFacadeT> class LocatePlugin : public BasePlugin
|
||||
reply.status = http::Reply::ok;
|
||||
json_result.values["status"] = 0;
|
||||
JSON::Array json_coordinate;
|
||||
json_coordinate.values.push_back(result.lat/COORDINATE_PRECISION);
|
||||
json_coordinate.values.push_back(result.lon/COORDINATE_PRECISION);
|
||||
json_coordinate.values.push_back(result.lat / COORDINATE_PRECISION);
|
||||
json_coordinate.values.push_back(result.lon / COORDINATE_PRECISION);
|
||||
json_result.values["mapped_coordinate"] = json_coordinate;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ template <class DataFacadeT> class NearestPlugin : public BasePlugin
|
||||
public:
|
||||
explicit NearestPlugin(DataFacadeT *facade) : facade(facade), descriptor_string("nearest") {}
|
||||
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply) final
|
||||
{
|
||||
// check number of parameters
|
||||
if (route_parameters.coordinates.empty() || !route_parameters.coordinates.front().isValid())
|
||||
|
||||
@@ -40,8 +40,8 @@ template <class DataFacadeT> class TimestampPlugin : public BasePlugin
|
||||
: facade(facade), descriptor_string("timestamp")
|
||||
{
|
||||
}
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply) final
|
||||
{
|
||||
reply.status = http::Reply::ok;
|
||||
JSON::Object json_result;
|
||||
|
||||
@@ -67,16 +67,18 @@ template <class DataFacadeT> class ViaRoutePlugin : public BasePlugin
|
||||
|
||||
virtual ~ViaRoutePlugin() {}
|
||||
|
||||
const std::string GetDescriptor() const { return descriptor_string; }
|
||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
||||
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply)
|
||||
void HandleRequest(const RouteParameters &route_parameters, http::Reply &reply) final
|
||||
{
|
||||
// check number of parameters
|
||||
if (2 > route_parameters.coordinates.size() ||
|
||||
std::any_of(begin(route_parameters.coordinates),
|
||||
end(route_parameters.coordinates),
|
||||
[&](FixedPointCoordinate coordinate)
|
||||
{ return !coordinate.isValid(); }))
|
||||
{
|
||||
return !coordinate.isValid();
|
||||
}))
|
||||
{
|
||||
reply = http::Reply::StockReply(http::Reply::badRequest);
|
||||
return;
|
||||
@@ -125,7 +127,8 @@ template <class DataFacadeT> class ViaRoutePlugin : public BasePlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
search_engine_ptr->shortest_path(raw_route.segment_end_coordinates, route_parameters.uturns, raw_route);
|
||||
search_engine_ptr->shortest_path(
|
||||
raw_route.segment_end_coordinates, route_parameters.uturns, raw_route);
|
||||
}
|
||||
|
||||
if (INVALID_EDGE_WEIGHT == raw_route.shortest_path_length)
|
||||
|
||||
Reference in New Issue
Block a user