Modernize the code base to C++11 standards and beyond.
Apply `clang-modernize` (based on Clang 3.6) transformations to the codebase while making sure to support Clang>=3.4 and GCC>=4.8. We apply the transformations in parallel to speed up the quite time consuming process, and use our `clang-format` style file to automatically format the code respecting our coding conventions. We use the following self-explanatory transformations: * AddOverride * LoopConvert * PassByValue * ReplaceAutoPtr * UseAuto * UseNullptr This required a `compile_commands.json` compilation database, e.g. ccmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 for CMake or check Bear for a Makefile based solution (or even Ninja). git ls-files -x '*.cpp|*.h' | \ xargs -I{} -P $(nproc) clang-modernize -p build -final-syntax-check -format -style=file -summary -for-compilers=clang-3.4,gcc-4.8 -include . -exclude third_party {} Boom! References: * http://clang.llvm.org/extra/clang-modernize.html * http://clang.llvm.org/extra/ModernizerUsage.html
This commit is contained in:
parent
84e72ede72
commit
62b20769ee
@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct NormalDistribution
|
struct NormalDistribution
|
||||||
{
|
{
|
||||||
@ -80,11 +81,11 @@ class BayesClassifier
|
|||||||
};
|
};
|
||||||
using ClassificationT = std::pair<ClassLabel, double>;
|
using ClassificationT = std::pair<ClassLabel, double>;
|
||||||
|
|
||||||
BayesClassifier(const PositiveDistributionT &positive_distribution,
|
BayesClassifier(PositiveDistributionT positive_distribution,
|
||||||
const NegativeDistributionT &negative_distribution,
|
NegativeDistributionT negative_distribution,
|
||||||
const double positive_apriori_probability)
|
const double positive_apriori_probability)
|
||||||
: positive_distribution(positive_distribution),
|
: positive_distribution(std::move(positive_distribution)),
|
||||||
negative_distribution(negative_distribution),
|
negative_distribution(std::move(negative_distribution)),
|
||||||
positive_apriori_probability(positive_apriori_probability),
|
positive_apriori_probability(positive_apriori_probability),
|
||||||
negative_apriori_probability(1. - positive_apriori_probability)
|
negative_apriori_probability(1. - positive_apriori_probability)
|
||||||
{
|
{
|
||||||
|
@ -99,8 +99,8 @@ void DouglasPeucker::Run(RandomAccessIt begin, RandomAccessIt end, const unsigne
|
|||||||
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT_MSG(zoom_level < DOUGLAS_PEUCKER_THRESHOLDS.size(), "unsupported zoom level");
|
BOOST_ASSERT_MSG(zoom_level < DOUGLAS_PEUCKER_THRESHOLDS.size(), "unsupported zoom level");
|
||||||
RandomAccessIt left_border = begin;
|
auto left_border = begin;
|
||||||
RandomAccessIt right_border = std::next(begin);
|
auto right_border = std::next(begin);
|
||||||
// Sweep over array and identify those ranges that need to be checked
|
// Sweep over array and identify those ranges that need to be checked
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include "../util/simple_logger.hpp"
|
#include "../util/simple_logger.hpp"
|
||||||
|
|
||||||
GraphCompressor::GraphCompressor(const SpeedProfileProperties& speed_profile)
|
GraphCompressor::GraphCompressor(SpeedProfileProperties speed_profile)
|
||||||
: speed_profile(speed_profile)
|
: speed_profile(std::move(speed_profile))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class GraphCompressor
|
|||||||
using EdgeData = NodeBasedDynamicGraph::EdgeData;
|
using EdgeData = NodeBasedDynamicGraph::EdgeData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphCompressor(const SpeedProfileProperties& speed_profile);
|
GraphCompressor(SpeedProfileProperties speed_profile);
|
||||||
|
|
||||||
void Compress(const std::unordered_set<NodeID>& barrier_nodes,
|
void Compress(const std::unordered_set<NodeID>& barrier_nodes,
|
||||||
const std::unordered_set<NodeID>& traffic_lights,
|
const std::unordered_set<NodeID>& traffic_lights,
|
||||||
|
@ -39,20 +39,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
EdgeBasedGraphFactory::EdgeBasedGraphFactory(std::shared_ptr<NodeBasedDynamicGraph> node_based_graph,
|
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
|
||||||
const CompressedEdgeContainer& compressed_edge_container,
|
std::shared_ptr<NodeBasedDynamicGraph> node_based_graph,
|
||||||
const std::unordered_set<NodeID>& barrier_nodes,
|
const CompressedEdgeContainer &compressed_edge_container,
|
||||||
const std::unordered_set<NodeID>& traffic_lights,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
std::shared_ptr<const RestrictionMap> restriction_map,
|
const std::unordered_set<NodeID> &traffic_lights,
|
||||||
const std::vector<QueryNode> &node_info_list,
|
std::shared_ptr<const RestrictionMap> restriction_map,
|
||||||
const SpeedProfileProperties &speed_profile)
|
const std::vector<QueryNode> &node_info_list,
|
||||||
: m_node_info_list(node_info_list),
|
SpeedProfileProperties speed_profile)
|
||||||
m_node_based_graph(node_based_graph),
|
: m_node_info_list(node_info_list), m_node_based_graph(std::move(node_based_graph)),
|
||||||
m_restriction_map(restriction_map),
|
m_restriction_map(std::move(restriction_map)), m_barrier_nodes(barrier_nodes),
|
||||||
m_barrier_nodes(barrier_nodes),
|
m_traffic_lights(traffic_lights), m_compressed_edge_container(compressed_edge_container),
|
||||||
m_traffic_lights(traffic_lights),
|
speed_profile(std::move(speed_profile))
|
||||||
m_compressed_edge_container(compressed_edge_container),
|
|
||||||
speed_profile(speed_profile)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,14 +58,13 @@ class EdgeBasedGraphFactory
|
|||||||
EdgeBasedGraphFactory() = delete;
|
EdgeBasedGraphFactory() = delete;
|
||||||
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
|
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
|
||||||
|
|
||||||
|
|
||||||
explicit EdgeBasedGraphFactory(std::shared_ptr<NodeBasedDynamicGraph> node_based_graph,
|
explicit EdgeBasedGraphFactory(std::shared_ptr<NodeBasedDynamicGraph> node_based_graph,
|
||||||
const CompressedEdgeContainer& compressed_edge_container,
|
const CompressedEdgeContainer &compressed_edge_container,
|
||||||
const std::unordered_set<NodeID>& barrier_nodes,
|
const std::unordered_set<NodeID> &barrier_nodes,
|
||||||
const std::unordered_set<NodeID>& traffic_lights,
|
const std::unordered_set<NodeID> &traffic_lights,
|
||||||
std::shared_ptr<const RestrictionMap> restriction_map,
|
std::shared_ptr<const RestrictionMap> restriction_map,
|
||||||
const std::vector<QueryNode> &node_info_list,
|
const std::vector<QueryNode> &node_info_list,
|
||||||
const SpeedProfileProperties &speed_profile);
|
SpeedProfileProperties speed_profile);
|
||||||
|
|
||||||
void Run(const std::string &original_edge_data_filename,
|
void Run(const std::string &original_edge_data_filename,
|
||||||
lua_State *lua_state);
|
lua_State *lua_state);
|
||||||
|
@ -51,8 +51,7 @@ class Prepare
|
|||||||
using InputEdge = DynamicGraph<EdgeData>::InputEdge;
|
using InputEdge = DynamicGraph<EdgeData>::InputEdge;
|
||||||
using StaticEdge = StaticGraph<EdgeData>::InputEdge;
|
using StaticEdge = StaticGraph<EdgeData>::InputEdge;
|
||||||
|
|
||||||
explicit Prepare(const ContractorConfig& contractor_config)
|
explicit Prepare(ContractorConfig contractor_config) : config(std::move(contractor_config)) {}
|
||||||
: config(contractor_config) {}
|
|
||||||
Prepare(const Prepare &) = delete;
|
Prepare(const Prepare &) = delete;
|
||||||
~Prepare();
|
~Prepare();
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class BinaryHeap
|
|||||||
void DeleteAll()
|
void DeleteAll()
|
||||||
{
|
{
|
||||||
auto iend = heap.end();
|
auto iend = heap.end();
|
||||||
for (typename std::vector<HeapElement>::iterator i = heap.begin() + 1; i != iend; ++i)
|
for (auto i = heap.begin() + 1; i != iend; ++i)
|
||||||
{
|
{
|
||||||
inserted_nodes[i->index].key = 0;
|
inserted_nodes[i->index].key = 0;
|
||||||
}
|
}
|
||||||
@ -237,7 +237,9 @@ class BinaryHeap
|
|||||||
class HeapNode
|
class HeapNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HeapNode(NodeID n, Key k, Weight w, Data d) : node(n), key(k), weight(w), data(d) {}
|
HeapNode(NodeID n, Key k, Weight w, Data d) : node(n), key(k), weight(w), data(std::move(d))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
NodeID node;
|
NodeID node;
|
||||||
Key key;
|
Key key;
|
||||||
|
@ -58,7 +58,7 @@ struct QueryEdge
|
|||||||
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
||||||
|
|
||||||
QueryEdge(NodeID source, NodeID target, EdgeData data)
|
QueryEdge(NodeID source, NodeID target, EdgeData data)
|
||||||
: source(source), target(target), data(data)
|
: source(source), target(target), data(std::move(data))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <osrm/coordinate.hpp>
|
#include <osrm/coordinate.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// Struct fits everything in one cache line
|
// Struct fits everything in one cache line
|
||||||
struct SegmentInformation
|
struct SegmentInformation
|
||||||
@ -48,7 +49,7 @@ struct SegmentInformation
|
|||||||
bool necessary;
|
bool necessary;
|
||||||
bool is_via_location;
|
bool is_via_location;
|
||||||
|
|
||||||
explicit SegmentInformation(const FixedPointCoordinate &location,
|
explicit SegmentInformation(FixedPointCoordinate location,
|
||||||
const NodeID name_id,
|
const NodeID name_id,
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const float length,
|
const float length,
|
||||||
@ -56,20 +57,20 @@ struct SegmentInformation
|
|||||||
const bool necessary,
|
const bool necessary,
|
||||||
const bool is_via_location,
|
const bool is_via_location,
|
||||||
const TravelMode travel_mode)
|
const TravelMode travel_mode)
|
||||||
: location(location), name_id(name_id), duration(duration), length(length), bearing(0),
|
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
|
||||||
turn_instruction(turn_instruction), travel_mode(travel_mode), necessary(necessary),
|
bearing(0), turn_instruction(turn_instruction), travel_mode(travel_mode),
|
||||||
is_via_location(is_via_location)
|
necessary(necessary), is_via_location(is_via_location)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit SegmentInformation(const FixedPointCoordinate &location,
|
explicit SegmentInformation(FixedPointCoordinate location,
|
||||||
const NodeID name_id,
|
const NodeID name_id,
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const float length,
|
const float length,
|
||||||
const TurnInstruction turn_instruction,
|
const TurnInstruction turn_instruction,
|
||||||
const TravelMode travel_mode)
|
const TravelMode travel_mode)
|
||||||
: location(location), name_id(name_id), duration(duration), length(length), bearing(0),
|
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
|
||||||
turn_instruction(turn_instruction), travel_mode(travel_mode),
|
bearing(0), turn_instruction(turn_instruction), travel_mode(travel_mode),
|
||||||
necessary(turn_instruction != TurnInstruction::NoTurn), is_via_location(false)
|
necessary(turn_instruction != TurnInstruction::NoTurn), is_via_location(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ class SharedMemory
|
|||||||
shm = boost::interprocess::xsi_shared_memory(boost::interprocess::open_or_create, key,
|
shm = boost::interprocess::xsi_shared_memory(boost::interprocess::open_or_create, key,
|
||||||
size);
|
size);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (-1 == shmctl(shm.get_shmid(), SHM_LOCK, 0))
|
if (-1 == shmctl(shm.get_shmid(), SHM_LOCK, nullptr))
|
||||||
{
|
{
|
||||||
if (ENOMEM == errno)
|
if (ENOMEM == errno)
|
||||||
{
|
{
|
||||||
|
@ -316,8 +316,8 @@ class StaticRTree
|
|||||||
using IncrementalQueryNodeType = mapbox::util::variant<TreeNode, EdgeDataT>;
|
using IncrementalQueryNodeType = mapbox::util::variant<TreeNode, EdgeDataT>;
|
||||||
struct IncrementalQueryCandidate
|
struct IncrementalQueryCandidate
|
||||||
{
|
{
|
||||||
explicit IncrementalQueryCandidate(const float dist, const IncrementalQueryNodeType &node)
|
explicit IncrementalQueryCandidate(const float dist, IncrementalQueryNodeType node)
|
||||||
: min_dist(dist), node(node)
|
: min_dist(dist), node(std::move(node))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ class StaticRTree
|
|||||||
const boost::filesystem::path &leaf_file,
|
const boost::filesystem::path &leaf_file,
|
||||||
std::shared_ptr<CoordinateListT> coordinate_list)
|
std::shared_ptr<CoordinateListT> coordinate_list)
|
||||||
: m_search_tree(tree_node_ptr, number_of_nodes), m_leaf_node_filename(leaf_file.string()),
|
: m_search_tree(tree_node_ptr, number_of_nodes), m_leaf_node_filename(leaf_file.string()),
|
||||||
m_coordinate_list(coordinate_list)
|
m_coordinate_list(std::move(coordinate_list))
|
||||||
{
|
{
|
||||||
// open leaf node file and store thread specific pointer
|
// open leaf node file and store thread specific pointer
|
||||||
if (!boost::filesystem::exists(leaf_file))
|
if (!boost::filesystem::exists(leaf_file))
|
||||||
|
@ -33,8 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
class extractor
|
class extractor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
extractor(const ExtractorConfig &extractor_config)
|
extractor(ExtractorConfig extractor_config) : config(std::move(extractor_config)) {}
|
||||||
: config(extractor_config) {}
|
|
||||||
int run();
|
int run();
|
||||||
private:
|
private:
|
||||||
ExtractorConfig config;
|
ExtractorConfig config;
|
||||||
|
@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
#include <osrm/coordinate.hpp>
|
#include <osrm/coordinate.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct InternalExtractorEdge
|
struct InternalExtractorEdge
|
||||||
{
|
{
|
||||||
@ -68,18 +69,26 @@ struct InternalExtractorEdge
|
|||||||
}
|
}
|
||||||
|
|
||||||
explicit InternalExtractorEdge(NodeID source,
|
explicit InternalExtractorEdge(NodeID source,
|
||||||
NodeID target,
|
NodeID target,
|
||||||
NodeID name_id,
|
NodeID name_id,
|
||||||
const WeightData& weight_data,
|
WeightData weight_data,
|
||||||
bool forward,
|
bool forward,
|
||||||
bool backward,
|
bool backward,
|
||||||
bool roundabout,
|
bool roundabout,
|
||||||
bool access_restricted,
|
bool access_restricted,
|
||||||
TravelMode travel_mode,
|
TravelMode travel_mode,
|
||||||
bool is_split)
|
bool is_split)
|
||||||
: result(source, target, name_id, 0, forward, backward, roundabout,
|
: result(source,
|
||||||
access_restricted, travel_mode, is_split),
|
target,
|
||||||
weight_data(weight_data)
|
name_id,
|
||||||
|
0,
|
||||||
|
forward,
|
||||||
|
backward,
|
||||||
|
roundabout,
|
||||||
|
access_restricted,
|
||||||
|
travel_mode,
|
||||||
|
is_split),
|
||||||
|
weight_data(std::move(weight_data))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ struct String
|
|||||||
{
|
{
|
||||||
String() {}
|
String() {}
|
||||||
String(const char *value) : value(value) {}
|
String(const char *value) : value(value) {}
|
||||||
String(const std::string &value) : value(value) {}
|
String(std::string value) : value(std::move(value)) {}
|
||||||
std::string value;
|
std::string value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,8 +39,11 @@ struct libosrm_config
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
libosrm_config(const ServerPaths &paths, const bool sharedmemory_flag, const int max_table, const int max_matching)
|
libosrm_config(ServerPaths paths,
|
||||||
: server_paths(paths), max_locations_distance_table(max_table),
|
const bool sharedmemory_flag,
|
||||||
|
const int max_table,
|
||||||
|
const int max_matching)
|
||||||
|
: server_paths(std::move(paths)), max_locations_distance_table(max_table),
|
||||||
max_locations_map_matching(max_matching), use_shared_memory(sharedmemory_flag)
|
max_locations_map_matching(max_matching), use_shared_memory(sharedmemory_flag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
|
|||||||
|
|
||||||
virtual ~MapMatchingPlugin() {}
|
virtual ~MapMatchingPlugin() {}
|
||||||
|
|
||||||
const std::string GetDescriptor() const final { return descriptor_string; }
|
const std::string GetDescriptor() const final override { return descriptor_string; }
|
||||||
|
|
||||||
TraceClassification
|
TraceClassification
|
||||||
classify(const float trace_length, const float matched_length, const int removed_points) const
|
classify(const float trace_length, const float matched_length, const int removed_points) const
|
||||||
@ -211,7 +211,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
int HandleRequest(const RouteParameters &route_parameters,
|
int HandleRequest(const RouteParameters &route_parameters,
|
||||||
osrm::json::Object &json_result) final
|
osrm::json::Object &json_result) final override
|
||||||
{
|
{
|
||||||
// check number of parameters
|
// check number of parameters
|
||||||
if (!check_all_coordinates(route_parameters.coordinates))
|
if (!check_all_coordinates(route_parameters.coordinates))
|
||||||
|
@ -136,12 +136,12 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
sigset_t wait_mask;
|
sigset_t wait_mask;
|
||||||
pthread_sigmask(SIG_SETMASK, &old_mask, 0);
|
pthread_sigmask(SIG_SETMASK, &old_mask, nullptr);
|
||||||
sigemptyset(&wait_mask);
|
sigemptyset(&wait_mask);
|
||||||
sigaddset(&wait_mask, SIGINT);
|
sigaddset(&wait_mask, SIGINT);
|
||||||
sigaddset(&wait_mask, SIGQUIT);
|
sigaddset(&wait_mask, SIGQUIT);
|
||||||
sigaddset(&wait_mask, SIGTERM);
|
sigaddset(&wait_mask, SIGTERM);
|
||||||
pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
|
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr);
|
||||||
SimpleLogger().Write() << "running and waiting for requests";
|
SimpleLogger().Write() << "running and waiting for requests";
|
||||||
sigwait(&wait_mask, &sig);
|
sigwait(&wait_mask, &sig);
|
||||||
#else
|
#else
|
||||||
|
@ -264,7 +264,7 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
|
|||||||
throw osrm::exception("no names file given in ini file");
|
throw osrm::exception("no names file given in ini file");
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPaths::const_iterator paths_iterator = server_paths.find("hsgrdata");
|
auto paths_iterator = server_paths.find("hsgrdata");
|
||||||
BOOST_ASSERT(server_paths.end() != paths_iterator);
|
BOOST_ASSERT(server_paths.end() != paths_iterator);
|
||||||
const boost::filesystem::path &hsgr_path = paths_iterator->second;
|
const boost::filesystem::path &hsgr_path = paths_iterator->second;
|
||||||
paths_iterator = server_paths.find("timestamp");
|
paths_iterator = server_paths.find("timestamp");
|
||||||
|
@ -37,7 +37,7 @@ struct header
|
|||||||
{
|
{
|
||||||
// explicitly use default copy c'tor as adding move c'tor
|
// explicitly use default copy c'tor as adding move c'tor
|
||||||
header &operator=(const header &other) = default;
|
header &operator=(const header &other) = default;
|
||||||
header(const std::string &name, const std::string &value) : name(name), value(value) {}
|
header(std::string name, std::string value) : name(std::move(name)), value(std::move(value)) {}
|
||||||
header(header &&other) : name(std::move(other.name)), value(std::move(other.value)) {}
|
header(header &&other) : name(std::move(other.name)), value(std::move(other.value)) {}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
|
@ -146,7 +146,7 @@ bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &p
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse config file
|
// parse config file
|
||||||
ServerPaths::iterator path_iterator = paths.find("config");
|
auto path_iterator = paths.find("config");
|
||||||
if (path_iterator != paths.end() && boost::filesystem::is_regular_file(path_iterator->second) &&
|
if (path_iterator != paths.end() && boost::filesystem::is_regular_file(path_iterator->second) &&
|
||||||
!option_variables.count("base"))
|
!option_variables.count("base"))
|
||||||
{
|
{
|
||||||
|
@ -54,16 +54,16 @@ struct MatchingDebugInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
osrm::json::Array states;
|
osrm::json::Array states;
|
||||||
for (unsigned t = 0; t < candidates_list.size(); t++)
|
for (auto &elem : candidates_list)
|
||||||
{
|
{
|
||||||
osrm::json::Array timestamps;
|
osrm::json::Array timestamps;
|
||||||
for (unsigned s = 0; s < candidates_list[t].size(); s++)
|
for (unsigned s = 0; s < elem.size(); s++)
|
||||||
{
|
{
|
||||||
osrm::json::Object state;
|
osrm::json::Object state;
|
||||||
state.values["transitions"] = osrm::json::Array();
|
state.values["transitions"] = osrm::json::Array();
|
||||||
state.values["coordinate"] = osrm::json::make_array(
|
state.values["coordinate"] =
|
||||||
candidates_list[t][s].first.location.lat / COORDINATE_PRECISION,
|
osrm::json::make_array(elem[s].first.location.lat / COORDINATE_PRECISION,
|
||||||
candidates_list[t][s].first.location.lon / COORDINATE_PRECISION);
|
elem[s].first.location.lon / COORDINATE_PRECISION);
|
||||||
state.values["viterbi"] =
|
state.values["viterbi"] =
|
||||||
osrm::json::clamp_float(osrm::matching::IMPOSSIBLE_LOG_PROB);
|
osrm::json::clamp_float(osrm::matching::IMPOSSIBLE_LOG_PROB);
|
||||||
state.values["pruned"] = 0u;
|
state.values["pruned"] = 0u;
|
||||||
|
@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -37,14 +38,14 @@ class exception final : public std::exception
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit exception(const char *message) : message(message) {}
|
explicit exception(const char *message) : message(message) {}
|
||||||
explicit exception(const std::string &message) : message(message) {}
|
explicit exception(std::string message) : message(std::move(message)) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This function exists to 'anchor' the class, and stop the compiler from
|
// This function exists to 'anchor' the class, and stop the compiler from
|
||||||
// copying vtable and RTTI info into every object file that includes
|
// copying vtable and RTTI info into every object file that includes
|
||||||
// this header. (Caught by -Wweak-vtables under Clang.)
|
// this header. (Caught by -Wweak-vtables under Clang.)
|
||||||
virtual void anchor() const;
|
virtual void anchor() const;
|
||||||
const char *what() const noexcept { return message.c_str(); }
|
const char *what() const noexcept override { return message.c_str(); }
|
||||||
const std::string message;
|
const std::string message;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ inline unsigned GenerateServerProgramOptions(const int argc,
|
|||||||
boost::program_options::notify(option_variables);
|
boost::program_options::notify(option_variables);
|
||||||
|
|
||||||
// parse config file
|
// parse config file
|
||||||
ServerPaths::iterator path_iterator = paths.find("config");
|
auto path_iterator = paths.find("config");
|
||||||
if (path_iterator != paths.end() && boost::filesystem::is_regular_file(path_iterator->second) &&
|
if (path_iterator != paths.end() && boost::filesystem::is_regular_file(path_iterator->second) &&
|
||||||
!option_variables.count("base"))
|
!option_variables.count("base"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user