fix a number of implicit conversions
This commit is contained in:
parent
438d1af12a
commit
8eccfaa034
@ -71,7 +71,7 @@ template <typename EdgeDataT> class DynamicGraph
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Constructs an empty graph with a given number of nodes.
|
// Constructs an empty graph with a given number of nodes.
|
||||||
explicit DynamicGraph(int32_t nodes) : number_of_nodes(nodes), number_of_edges(0)
|
explicit DynamicGraph(NodeIterator nodes) : number_of_nodes(nodes), number_of_edges(0)
|
||||||
{
|
{
|
||||||
node_list.reserve(number_of_nodes);
|
node_list.reserve(number_of_nodes);
|
||||||
node_list.resize(number_of_nodes);
|
node_list.resize(number_of_nodes);
|
||||||
@ -80,7 +80,7 @@ template <typename EdgeDataT> class DynamicGraph
|
|||||||
edge_list.resize(number_of_nodes);
|
edge_list.resize(number_of_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ContainerT> DynamicGraph(const int32_t nodes, const ContainerT &graph)
|
template <class ContainerT> DynamicGraph(const NodeIterator nodes, const ContainerT &graph)
|
||||||
{
|
{
|
||||||
number_of_nodes = nodes;
|
number_of_nodes = nodes;
|
||||||
number_of_edges = (EdgeIterator)graph.size();
|
number_of_edges = (EdgeIterator)graph.size();
|
||||||
|
@ -164,7 +164,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
|
|||||||
edges_list.resize(edge_count);
|
edges_list.resize(edge_count);
|
||||||
SimpleLogger().Write() << "merged " << edges_list.size() - edge_count << " edges out of " << edges_list.size();
|
SimpleLogger().Write() << "merged " << edges_list.size() - edge_count << " edges out of " << edges_list.size();
|
||||||
|
|
||||||
auto graph = std::make_shared<NodeBasedDynamicGraph>(number_of_nodes, edges_list);
|
auto graph = std::make_shared<NodeBasedDynamicGraph>(static_cast<NodeBasedDynamicGraph::NodeIterator>(number_of_nodes), edges_list);
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "BasePlugin.h"
|
#include "BasePlugin.h"
|
||||||
#include "../DataStructures/JSONContainer.h"
|
#include "../DataStructures/JSONContainer.h"
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/PhantomNodes.h"
|
||||||
|
#include "../DataStructures/Range.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -53,12 +54,12 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
|
|||||||
reply = http::Reply::StockReply(http::Reply::badRequest);
|
reply = http::Reply::StockReply(http::Reply::badRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int number_of_results = static_cast<int>(route_parameters.num_results);
|
auto number_of_results = static_cast<std::size_t>(route_parameters.num_results);
|
||||||
std::vector<PhantomNode> phantom_node_vector;
|
std::vector<PhantomNode> phantom_node_vector;
|
||||||
facade->IncrementalFindPhantomNodeForCoordinate(route_parameters.coordinates.front(),
|
facade->IncrementalFindPhantomNodeForCoordinate(route_parameters.coordinates.front(),
|
||||||
phantom_node_vector,
|
phantom_node_vector,
|
||||||
route_parameters.zoom_level,
|
route_parameters.zoom_level,
|
||||||
number_of_results);
|
static_cast<int>(number_of_results));
|
||||||
|
|
||||||
JSON::Object json_result;
|
JSON::Object json_result;
|
||||||
if (phantom_node_vector.empty() || !phantom_node_vector.front().isValid())
|
if (phantom_node_vector.empty() || !phantom_node_vector.front().isValid())
|
||||||
@ -74,7 +75,7 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
|
|||||||
{
|
{
|
||||||
JSON::Array results;
|
JSON::Array results;
|
||||||
|
|
||||||
int vector_length = phantom_node_vector.size();
|
auto vector_length = phantom_node_vector.size();
|
||||||
for (const auto i : osrm::irange<std::size_t>(0, std::min(number_of_results, vector_length)))
|
for (const auto i : osrm::irange<std::size_t>(0, std::min(number_of_results, vector_length)))
|
||||||
{
|
{
|
||||||
JSON::Array json_coordinate;
|
JSON::Array json_coordinate;
|
||||||
|
@ -114,7 +114,7 @@ SimpleLogger::~SimpleLogger()
|
|||||||
std::lock_guard<std::mutex> lock(get_mutex());
|
std::lock_guard<std::mutex> lock(get_mutex());
|
||||||
if (!LogPolicy::GetInstance().IsMute())
|
if (!LogPolicy::GetInstance().IsMute())
|
||||||
{
|
{
|
||||||
const bool is_terminal = isatty(fileno(stdout));
|
const bool is_terminal = static_cast<bool>(isatty(fileno(stdout)));
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case logWARNING:
|
case logWARNING:
|
||||||
|
Loading…
Reference in New Issue
Block a user