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
template<storage::Ownership Ownership>
inline void readGraph(const boost::filesystem::path &path,
unsigned &checksum,
detail::QueryGraph<Ownership> &graph)
template <typename QueryGraphT>
inline void readGraph(const boost::filesystem::path &path, unsigned &checksum, QueryGraphT &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;
storage::io::FileReader reader{path, fingerprint};
@ -28,18 +30,19 @@ inline void readGraph(const boost::filesystem::path &path,
}
// writes .osrm.hsgr file
template<storage::Ownership Ownership>
inline void writeGraph(const boost::filesystem::path &path,
unsigned checksum,
const detail::QueryGraph<Ownership> &graph)
template <typename QueryGraphT>
inline void
writeGraph(const boost::filesystem::path &path, unsigned checksum, const QueryGraphT &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;
storage::io::FileWriter writer{path, fingerprint};
writer.WriteOne(checksum);
util::serialization::write(writer, graph);
}
}
}
}