Fix errors when loading an incompatible dataset.
This commit is contained in:
committed by
Patrick Niklaus
parent
24e0028afb
commit
9fc2c32408
@@ -26,7 +26,8 @@ inline void readGraph(const boost::filesystem::path &path,
|
||||
|
||||
storage::tar::FileReader reader{path, storage::tar::FileReader::VerifyFingerprint};
|
||||
|
||||
serialization::read(reader, "/mld/multilevelgraph", graph, connectivity_checksum);
|
||||
reader.ReadInto("/mld/connectivity_checksum", connectivity_checksum);
|
||||
serialization::read(reader, "/mld/multilevelgraph", graph);
|
||||
}
|
||||
|
||||
// writes .osrm.mldgr file
|
||||
@@ -41,7 +42,9 @@ inline void writeGraph(const boost::filesystem::path &path,
|
||||
|
||||
storage::tar::FileWriter writer{path, storage::tar::FileWriter::GenerateFingerprint};
|
||||
|
||||
serialization::write(writer, "/mld/multilevelgraph", graph, connectivity_checksum);
|
||||
writer.WriteElementCount64("/mld/connectivity_checksum", 1);
|
||||
writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum);
|
||||
serialization::write(writer, "/mld/multilevelgraph", graph);
|
||||
}
|
||||
|
||||
// read .osrm.partition file
|
||||
|
||||
@@ -26,14 +26,12 @@ namespace serialization
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
void read(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
std::uint32_t &connectivity_checksum);
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
void write(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
const std::uint32_t connectivity_checksum);
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
@@ -206,13 +204,11 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
|
||||
friend void
|
||||
serialization::read<EdgeDataT, Ownership>(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
std::uint32_t &connectivity_checksum);
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
friend void
|
||||
serialization::write<EdgeDataT, Ownership>(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
const std::uint32_t connectivity_checksum);
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
|
||||
Vector<EdgeOffset> node_to_edge_offset;
|
||||
std::uint32_t connectivity_checksum;
|
||||
|
||||
@@ -22,26 +22,21 @@ namespace serialization
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
inline void read(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
std::uint32_t &connectivity_checksum)
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
{
|
||||
storage::serialization::read(reader, name + "/node_array", graph.node_array);
|
||||
storage::serialization::read(reader, name + "/edge_array", graph.edge_array);
|
||||
storage::serialization::read(reader, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||
reader.ReadInto(name + "/connectivity_checksum", connectivity_checksum);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
inline void write(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||
const std::uint32_t connectivity_checksum)
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
{
|
||||
storage::serialization::write(writer, name + "/node_array", graph.node_array);
|
||||
storage::serialization::write(writer, name + "/edge_array", graph.edge_array);
|
||||
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||
writer.WriteElementCount64(name + "/connectivity_checksum", 1);
|
||||
writer.WriteFrom(name + "/connectivity_checksum", connectivity_checksum);
|
||||
}
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
|
||||
Reference in New Issue
Block a user