2017-03-01 17:55:18 -05:00
|
|
|
#ifndef OSRM_PARTITION_IO_HPP
|
|
|
|
#define OSRM_PARTITION_IO_HPP
|
|
|
|
|
2017-03-04 13:54:06 -05:00
|
|
|
#include "partition/multi_level_partition.hpp"
|
|
|
|
#include "partition/cell_storage.hpp"
|
|
|
|
|
2017-03-01 17:55:18 -05:00
|
|
|
#include "storage/io.hpp"
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace partition
|
|
|
|
{
|
|
|
|
namespace io
|
|
|
|
{
|
|
|
|
|
|
|
|
template <>
|
2017-03-04 13:54:06 -05:00
|
|
|
inline void write(const boost::filesystem::path &path, const partition::MultiLevelPartition &mlp)
|
2017-03-01 17:55:18 -05:00
|
|
|
{
|
|
|
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
|
|
|
storage::io::FileWriter writer{path, fingerprint};
|
|
|
|
|
|
|
|
writer.WriteOne(mlp.level_data);
|
|
|
|
writer.SerializeVector(mlp.partition);
|
|
|
|
writer.SerializeVector(mlp.cell_to_children);
|
|
|
|
}
|
2017-03-04 13:36:29 -05:00
|
|
|
|
|
|
|
template <>
|
2017-03-04 13:54:06 -05:00
|
|
|
inline void write(const boost::filesystem::path &path, const partition::CellStorage &storage)
|
2017-03-04 13:36:29 -05:00
|
|
|
{
|
|
|
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
|
|
|
storage::io::FileWriter writer{path, fingerprint};
|
|
|
|
|
|
|
|
writer.SerializeVector(storage.weights);
|
|
|
|
writer.SerializeVector(storage.source_boundary);
|
|
|
|
writer.SerializeVector(storage.destination_boundary);
|
|
|
|
writer.SerializeVector(storage.cells);
|
|
|
|
writer.SerializeVector(storage.level_to_cell_offset);
|
|
|
|
}
|
|
|
|
|
2017-03-01 17:55:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|