2018-01-05 08:33:53 -05:00
|
|
|
#ifndef OSRM_GUIDANCE_IO_HPP
|
|
|
|
#define OSRM_GUIDANCE_IO_HPP
|
|
|
|
|
|
|
|
#include "guidance/turn_data_container.hpp"
|
|
|
|
|
|
|
|
#include "storage/serialization.hpp"
|
2018-03-22 14:26:40 -04:00
|
|
|
#include "storage/tar.hpp"
|
2018-01-05 08:33:53 -05:00
|
|
|
|
|
|
|
#include <boost/assert.hpp>
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace guidance
|
|
|
|
{
|
|
|
|
namespace serialization
|
|
|
|
{
|
|
|
|
|
|
|
|
// read/write for turn data file
|
|
|
|
template <storage::Ownership Ownership>
|
2018-03-19 21:05:11 -04:00
|
|
|
inline void read(storage::tar::FileReader &reader,
|
|
|
|
const std::string &name,
|
2018-03-28 19:18:09 -04:00
|
|
|
guidance::detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
2018-01-05 08:33:53 -05:00
|
|
|
{
|
2018-03-19 21:05:11 -04:00
|
|
|
storage::serialization::read(
|
|
|
|
reader, name + "/turn_instructions", turn_data_container.turn_instructions);
|
|
|
|
storage::serialization::read(
|
|
|
|
reader, name + "/lane_data_ids", turn_data_container.lane_data_ids);
|
|
|
|
storage::serialization::read(
|
|
|
|
reader, name + "/entry_class_ids", turn_data_container.entry_class_ids);
|
|
|
|
storage::serialization::read(
|
|
|
|
reader, name + "/pre_turn_bearings", turn_data_container.pre_turn_bearings);
|
|
|
|
storage::serialization::read(
|
|
|
|
reader, name + "/post_turn_bearings", turn_data_container.post_turn_bearings);
|
2018-01-05 08:33:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
template <storage::Ownership Ownership>
|
2018-03-19 21:05:11 -04:00
|
|
|
inline void write(storage::tar::FileWriter &writer,
|
|
|
|
const std::string &name,
|
2018-03-28 19:18:09 -04:00
|
|
|
const guidance::detail::TurnDataContainerImpl<Ownership> &turn_data_container)
|
2018-01-05 08:33:53 -05:00
|
|
|
{
|
2018-03-19 21:05:11 -04:00
|
|
|
storage::serialization::write(
|
|
|
|
writer, name + "/turn_instructions", turn_data_container.turn_instructions);
|
|
|
|
storage::serialization::write(
|
|
|
|
writer, name + "/lane_data_ids", turn_data_container.lane_data_ids);
|
|
|
|
storage::serialization::write(
|
|
|
|
writer, name + "/entry_class_ids", turn_data_container.entry_class_ids);
|
|
|
|
storage::serialization::write(
|
|
|
|
writer, name + "/pre_turn_bearings", turn_data_container.pre_turn_bearings);
|
|
|
|
storage::serialization::write(
|
|
|
|
writer, name + "/post_turn_bearings", turn_data_container.post_turn_bearings);
|
2018-01-05 08:33:53 -05:00
|
|
|
}
|
2020-11-26 10:21:39 -05:00
|
|
|
} // namespace serialization
|
|
|
|
} // namespace guidance
|
|
|
|
} // namespace osrm
|
2018-01-05 08:33:53 -05:00
|
|
|
|
|
|
|
#endif
|