Port .datasource_names to tar format

This commit is contained in:
Patrick Niklaus
2018-03-19 12:49:49 +00:00
parent 2c5e4e6c02
commit bced9a5a6d
3 changed files with 22 additions and 24 deletions
+14 -14
View File
@@ -107,7 +107,7 @@ void readEdgeBasedGraph(const boost::filesystem::path &path,
connectivity_checksum = reader.ReadOne<std::uint32_t>("/common/connectivity_checksum");
}
// reads .osrm.nodes
// reads .osrm.nbg_nodes
template <typename CoordinatesT, typename PackedOSMIDsT>
inline void readNodes(const boost::filesystem::path &path,
CoordinatesT &coordinates,
@@ -123,7 +123,7 @@ inline void readNodes(const boost::filesystem::path &path,
util::serialization::read(reader, "/common/osm_node_ids", osm_node_ids);
}
// writes .osrm.nodes
// writes .osrm.nbg_nodes
template <typename CoordinatesT, typename PackedOSMIDsT>
inline void writeNodes(const boost::filesystem::path &path,
const CoordinatesT &coordinates,
@@ -142,38 +142,38 @@ inline void writeNodes(const boost::filesystem::path &path,
// reads .osrm.cnbg_to_ebg
inline void readNBGMapping(const boost::filesystem::path &path, std::vector<NBGToEBG> &mapping)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
storage::serialization::read(reader, mapping);
storage::serialization::read(reader, "/common/cnbg_to_ebg", mapping);
}
// writes .osrm.cnbg_to_ebg
inline void writeNBGMapping(const boost::filesystem::path &path,
const std::vector<NBGToEBG> &mapping)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
storage::tar::FileWriter writer{path, fingerprint};
storage::serialization::write(writer, mapping);
storage::serialization::write(writer, "/common/cnbg_to_ebg", mapping);
}
// reads .osrm.datasource_names
inline void readDatasources(const boost::filesystem::path &path, Datasources &sources)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
serialization::read(reader, sources);
serialization::read(reader, "/common/data_sources_names", sources);
}
// writes .osrm.datasource_names
inline void writeDatasources(const boost::filesystem::path &path, Datasources &sources)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
storage::tar::FileWriter writer{path, fingerprint};
serialization::write(writer, sources);
serialization::write(writer, "/common/data_sources_names", sources);
}
// reads .osrm.geometry
+5 -4
View File
@@ -64,14 +64,15 @@ inline void write(storage::tar::FileWriter &writer,
}
// read/write for datasources file
inline void read(storage::io::FileReader &reader, Datasources &sources)
inline void read(storage::tar::FileReader &reader, const std::string& name, Datasources &sources)
{
reader.ReadInto(sources);
sources = reader.ReadOne<Datasources>(name);
}
inline void write(storage::io::FileWriter &writer, Datasources &sources)
inline void write(storage::tar::FileWriter &writer, const std::string& name, Datasources &sources)
{
writer.WriteFrom(sources);
writer.WriteElementCount64(name, 1);
writer.WriteOne(name, sources);
}
// read/write for segment data file