Address some of the remaining issues of the code review

This commit is contained in:
Patrick Niklaus 2015-03-04 01:34:45 +01:00
parent de261d28ef
commit 98dba11c5e
4 changed files with 15 additions and 21 deletions

View File

@ -272,7 +272,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
while (parent_timestamp_index >= sub_matching_begin && while (parent_timestamp_index >= sub_matching_begin &&
model.breakage[parent_timestamp_index]) model.breakage[parent_timestamp_index])
{ {
parent_timestamp_index--; --parent_timestamp_index;
} }
// matchings that only consist of one candidate are invalid // matchings that only consist of one candidate are invalid

View File

@ -65,12 +65,6 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)]; stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)];
timestamp = (-qi::lit('&')) >> qi::lit("t") >> '=' >> timestamp = (-qi::lit('&')) >> qi::lit("t") >> '=' >>
qi::uint_[boost::bind(&HandlerT::addTimestamp, handler, ::_1)]; qi::uint_[boost::bind(&HandlerT::addTimestamp, handler, ::_1)];
matching_beta = (-qi::lit('&')) >> qi::lit("matching_beta") >> '=' >>
qi::short_[boost::bind(&HandlerT::setMatchingBeta, handler, ::_1)];
gps_precision = (-qi::lit('&')) >> qi::lit("gps_precision") >> '=' >>
qi::short_[boost::bind(&HandlerT::setGPSPrecision, handler, ::_1)];
classify = (-qi::lit('&')) >> qi::lit("classify") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
u = (-qi::lit('&')) >> qi::lit("u") >> '=' >> u = (-qi::lit('&')) >> qi::lit("u") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setUTurn, handler, ::_1)]; qi::bool_[boost::bind(&HandlerT::setUTurn, handler, ::_1)];
uturns = (-qi::lit('&')) >> qi::lit("uturns") >> '=' >> uturns = (-qi::lit('&')) >> qi::lit("uturns") >> '=' >>
@ -83,6 +77,12 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
string[boost::bind(&HandlerT::setDeprecatedAPIFlag, handler, ::_1)]; string[boost::bind(&HandlerT::setDeprecatedAPIFlag, handler, ::_1)];
num_results = (-qi::lit('&')) >> qi::lit("num_results") >> '=' >> num_results = (-qi::lit('&')) >> qi::lit("num_results") >> '=' >>
qi::short_[boost::bind(&HandlerT::setNumberOfResults, handler, ::_1)]; qi::short_[boost::bind(&HandlerT::setNumberOfResults, handler, ::_1)];
matching_beta = (-qi::lit('&')) >> qi::lit("matching_beta") >> '=' >>
qi::short_[boost::bind(&HandlerT::setMatchingBeta, handler, ::_1)];
gps_precision = (-qi::lit('&')) >> qi::lit("gps_precision") >> '=' >>
qi::short_[boost::bind(&HandlerT::setGPSPrecision, handler, ::_1)];
classify = (-qi::lit('&')) >> qi::lit("classify") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
string = +(qi::char_("a-zA-Z")); string = +(qi::char_("a-zA-Z"));
stringwithDot = +(qi::char_("a-zA-Z0-9_.-")); stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
@ -92,8 +92,8 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
qi::rule<Iterator> api_call, query; qi::rule<Iterator> api_call, query;
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location, qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location,
hint, timestamp, matching_beta, gps_precision, classify, stringwithDot, stringwithPercent, language, instruction, geometry, cmp, alt_route, u, hint, timestamp, stringwithDot, stringwithPercent, language, instruction, geometry, cmp, alt_route, u,
uturns, old_API, num_results; uturns, old_API, num_results, matching_beta, gps_precision, classify;
HandlerT *handler; HandlerT *handler;
}; };

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2015, Project OSRM, Dennis Luxen, others Copyright (c) 2015, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@ -37,6 +37,8 @@ namespace osrm
namespace json namespace json
{ {
// Used to append additional debugging information to the JSON response in a
// thread safe manner.
class Logger class Logger
{ {
using MapT = std::unordered_map<std::string, osrm::json::Value>; using MapT = std::unordered_map<std::string, osrm::json::Value>;
@ -74,4 +76,4 @@ class Logger
} }
} }
#endif /* SIMPLE_LOGGER_HPP */ #endif /* JSON_LOGGER_HPP */

View File

@ -30,8 +30,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/json_container.hpp> #include <osrm/json_container.hpp>
#include <limits>
#include <cmath> #include <cmath>
#include <limits>
namespace osrm namespace osrm
{ {
@ -53,18 +53,10 @@ template <typename T> T clamp_float(T d)
return d; return d;
} }
void append_to_array(osrm::json::Array &a) {}
template <typename T, typename... Args>
void append_to_array(osrm::json::Array &a, T value, Args... args)
{
a.values.emplace_back(value);
append_to_array(a, args...);
}
template <typename... Args> osrm::json::Array make_array(Args... args) template <typename... Args> osrm::json::Array make_array(Args... args)
{ {
osrm::json::Array a; osrm::json::Array a;
append_to_array(a, args...); append_to_container(a.values, args...);
return a; return a;
} }