Port .ebg_nodes to tar file
This commit is contained in:
@@ -210,10 +210,10 @@ inline void readNodeData(const boost::filesystem::path &path, NodeDataT &node_da
|
||||
std::is_same<EdgeBasedNodeDataView, NodeDataT>::value ||
|
||||
std::is_same<EdgeBasedNodeDataExternalContainer, NodeDataT>::value,
|
||||
"");
|
||||
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, node_data);
|
||||
serialization::read(reader, "/common/ebg_node_data", node_data);
|
||||
}
|
||||
|
||||
// writes .osrm.ebg_nodes
|
||||
@@ -224,10 +224,10 @@ inline void writeNodeData(const boost::filesystem::path &path, const NodeDataT &
|
||||
std::is_same<EdgeBasedNodeDataView, NodeDataT>::value ||
|
||||
std::is_same<EdgeBasedNodeDataExternalContainer, NodeDataT>::value,
|
||||
"");
|
||||
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, node_data);
|
||||
serialization::write(writer, "/common/ebg_node_data", node_data);
|
||||
}
|
||||
|
||||
// reads .osrm.tls
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "extractor/node_based_edge.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
|
||||
#include "storage/io_fwd.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
#include "storage/tar_fwd.hpp"
|
||||
|
||||
#include "util/permutation.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
@@ -29,11 +29,13 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl;
|
||||
namespace serialization
|
||||
{
|
||||
template <storage::Ownership Ownership>
|
||||
void read(storage::io::FileReader &reader,
|
||||
void read(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
detail::EdgeBasedNodeDataContainerImpl<Ownership> &ebn_data);
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
void write(storage::io::FileWriter &writer,
|
||||
void write(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const detail::EdgeBasedNodeDataContainerImpl<Ownership> &ebn_data);
|
||||
}
|
||||
|
||||
@@ -89,10 +91,12 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
return annotation_data[nodes[node_id].annotation_id].classes;
|
||||
}
|
||||
|
||||
friend void serialization::read<Ownership>(storage::io::FileReader &reader,
|
||||
friend void serialization::read<Ownership>(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
EdgeBasedNodeDataContainerImpl &ebn_data_container);
|
||||
friend void
|
||||
serialization::write<Ownership>(storage::io::FileWriter &writer,
|
||||
serialization::write<Ownership>(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const EdgeBasedNodeDataContainerImpl &ebn_data_container);
|
||||
|
||||
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||
|
||||
@@ -111,25 +111,22 @@ inline void write(storage::tar::FileWriter &writer,
|
||||
}
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
inline void read(storage::io::FileReader &reader,
|
||||
inline void read(storage::tar::FileReader &reader,
|
||||
const std::string &name,
|
||||
detail::EdgeBasedNodeDataContainerImpl<Ownership> &node_data_container)
|
||||
{
|
||||
// read header (separate sizes for both vectors)
|
||||
reader.ReadElementCount64();
|
||||
reader.ReadElementCount64();
|
||||
// read actual data
|
||||
storage::serialization::read(reader, node_data_container.nodes);
|
||||
storage::serialization::read(reader, node_data_container.annotation_data);
|
||||
storage::serialization::read(reader, name + "/nodes", node_data_container.nodes);
|
||||
storage::serialization::read(reader, name + "/annotations", node_data_container.annotation_data);
|
||||
}
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
inline void write(storage::io::FileWriter &writer,
|
||||
inline void write(storage::tar::FileWriter &writer,
|
||||
const std::string& name,
|
||||
const detail::EdgeBasedNodeDataContainerImpl<Ownership> &node_data_container)
|
||||
{
|
||||
writer.WriteElementCount64(node_data_container.NumberOfNodes());
|
||||
writer.WriteElementCount64(node_data_container.NumberOfAnnotations());
|
||||
storage::serialization::write(writer, node_data_container.nodes);
|
||||
storage::serialization::write(writer, node_data_container.annotation_data);
|
||||
storage::serialization::write(writer, name + "/nodes", node_data_container.nodes);
|
||||
storage::serialization::write(writer, name + "/annotations", node_data_container.annotation_data);
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, NodeRestriction &restriction)
|
||||
|
||||
Reference in New Issue
Block a user