Consolidate file reading through the new FileReader class/interface. (#3321)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "extractor/edge_based_node.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "mocks/mock_datafacade.hpp"
|
||||
#include "storage/io.hpp"
|
||||
#include "engine/geospatial_query.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/timing_util.hpp"
|
||||
@@ -31,15 +32,15 @@ using BenchStaticRTree =
|
||||
|
||||
std::vector<util::Coordinate> loadCoordinates(const boost::filesystem::path &nodes_file)
|
||||
{
|
||||
boost::filesystem::ifstream nodes_input_stream(nodes_file, std::ios::binary);
|
||||
osrm::storage::io::FileReader nodes_path_file_reader(
|
||||
nodes_file, osrm::storage::io::FileReader::HasNoFingerprint);
|
||||
|
||||
extractor::QueryNode current_node;
|
||||
std::uint64_t coordinate_count = 0;
|
||||
nodes_input_stream.read((char *)&coordinate_count, sizeof(std::uint64_t));
|
||||
unsigned coordinate_count = nodes_path_file_reader.ReadElementCount32();
|
||||
std::vector<util::Coordinate> coords(coordinate_count);
|
||||
for (unsigned i = 0; i < coordinate_count; ++i)
|
||||
{
|
||||
nodes_input_stream.read((char *)¤t_node, sizeof(extractor::QueryNode));
|
||||
nodes_path_file_reader.ReadInto(¤t_node, 1);
|
||||
coords[i] = util::Coordinate(current_node.lon, current_node.lat);
|
||||
}
|
||||
return coords;
|
||||
|
||||
Reference in New Issue
Block a user