Fingerprint and move .levels
This commit is contained in:
parent
771834793f
commit
df0ee955e8
@ -6,6 +6,7 @@
|
||||
#include "util/serialization.hpp"
|
||||
|
||||
#include "storage/io.hpp"
|
||||
#include "storage/serialization.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@ -43,6 +44,25 @@ writeGraph(const boost::filesystem::path &path, unsigned checksum, const QueryGr
|
||||
writer.WriteOne(checksum);
|
||||
util::serialization::write(writer, graph);
|
||||
}
|
||||
|
||||
// reads .levels file
|
||||
inline void readLevels(const boost::filesystem::path &path, std::vector<float> &node_levels)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||
storage::io::FileReader reader{path, fingerprint};
|
||||
|
||||
storage::serialization::read(reader, node_levels);
|
||||
}
|
||||
|
||||
// writes .levels file
|
||||
inline void writeLevels(const boost::filesystem::path &path, const std::vector<float> &node_levels)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||
storage::io::FileWriter writer{path, fingerprint};
|
||||
|
||||
storage::serialization::write(writer, node_levels);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,22 +103,14 @@ int Contractor::Run()
|
||||
|
||||
void Contractor::ReadNodeLevels(std::vector<float> &node_levels) const
|
||||
{
|
||||
storage::io::FileReader order_file(config.level_output_path,
|
||||
storage::io::FileReader::HasNoFingerprint);
|
||||
|
||||
const auto level_size = order_file.ReadElementCount32();
|
||||
node_levels.resize(level_size);
|
||||
order_file.ReadInto(node_levels);
|
||||
files::readLevels(config.level_output_path, node_levels);
|
||||
}
|
||||
|
||||
void Contractor::WriteNodeLevels(std::vector<float> &&in_node_levels) const
|
||||
{
|
||||
std::vector<float> node_levels(std::move(in_node_levels));
|
||||
|
||||
storage::io::FileWriter writer(config.level_output_path,
|
||||
storage::io::FileWriter::HasNoFingerprint);
|
||||
|
||||
storage::serialization::write(writer, node_levels);
|
||||
files::writeLevels(config.level_output_path, node_levels);
|
||||
}
|
||||
|
||||
void Contractor::WriteCoreNodeMarker(std::vector<bool> &&in_is_core_node) const
|
||||
|
Loading…
Reference in New Issue
Block a user