Fix readGraph to not use UseSharedMemory

This commit is contained in:
Patrick Niklaus 2017-04-03 14:21:13 +00:00 committed by Patrick Niklaus
parent d61102e255
commit dce0ce0e17

View File

@ -15,11 +15,13 @@ namespace files
{ {
// reads .osrm.hsgr file // reads .osrm.hsgr file
template<storage::Ownership Ownership> template <typename QueryGraphT>
inline void readGraph(const boost::filesystem::path &path, inline void readGraph(const boost::filesystem::path &path, unsigned &checksum, QueryGraphT &graph)
unsigned &checksum,
detail::QueryGraph<Ownership> &graph)
{ {
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value,
"graph must be of type QueryGraph<>");
const auto fingerprint = storage::io::FileReader::VerifyFingerprint; const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint}; storage::io::FileReader reader{path, fingerprint};
@ -28,18 +30,19 @@ inline void readGraph(const boost::filesystem::path &path,
} }
// writes .osrm.hsgr file // writes .osrm.hsgr file
template<storage::Ownership Ownership> template <typename QueryGraphT>
inline void writeGraph(const boost::filesystem::path &path, inline void
unsigned checksum, writeGraph(const boost::filesystem::path &path, unsigned checksum, const QueryGraphT &graph)
const detail::QueryGraph<Ownership> &graph)
{ {
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value,
"graph must be of type QueryGraph<>");
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint}; storage::io::FileWriter writer{path, fingerprint};
writer.WriteOne(checksum); writer.WriteOne(checksum);
util::serialization::write(writer, graph); util::serialization::write(writer, graph);
} }
} }
} }
} }