Remove old io::FileWrite serialization code
This commit is contained in:
@@ -132,143 +132,6 @@ inline void write(storage::tar::FileWriter &writer,
|
||||
writer, name + "/annotations", node_data_container.annotation_data);
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, NodeRestriction &restriction)
|
||||
{
|
||||
reader.ReadInto(restriction.from);
|
||||
reader.ReadInto(restriction.via);
|
||||
reader.ReadInto(restriction.to);
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer, const NodeRestriction &restriction)
|
||||
{
|
||||
writer.WriteFrom(restriction.from);
|
||||
writer.WriteFrom(restriction.via);
|
||||
writer.WriteFrom(restriction.to);
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, WayRestriction &restriction)
|
||||
{
|
||||
read(reader, restriction.in_restriction);
|
||||
read(reader, restriction.out_restriction);
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer, const WayRestriction &restriction)
|
||||
{
|
||||
write(writer, restriction.in_restriction);
|
||||
write(writer, restriction.out_restriction);
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, TurnRestriction &restriction)
|
||||
{
|
||||
reader.ReadInto(restriction.is_only);
|
||||
std::uint32_t restriction_type;
|
||||
reader.ReadInto(restriction_type);
|
||||
if (restriction_type == RestrictionType::WAY_RESTRICTION)
|
||||
{
|
||||
WayRestriction way_restriction;
|
||||
read(reader, way_restriction);
|
||||
restriction.node_or_way = std::move(way_restriction);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(restriction_type == RestrictionType::NODE_RESTRICTION);
|
||||
NodeRestriction node_restriction;
|
||||
read(reader, node_restriction);
|
||||
restriction.node_or_way = std::move(node_restriction);
|
||||
}
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer, const TurnRestriction &restriction)
|
||||
{
|
||||
writer.WriteFrom(restriction.is_only);
|
||||
const std::uint32_t restriction_type = restriction.Type();
|
||||
writer.WriteFrom(restriction_type);
|
||||
if (restriction.Type() == RestrictionType::WAY_RESTRICTION)
|
||||
{
|
||||
write(writer, mapbox::util::get<WayRestriction>(restriction.node_or_way));
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(restriction.Type() == RestrictionType::NODE_RESTRICTION);
|
||||
write(writer, mapbox::util::get<NodeRestriction>(restriction.node_or_way));
|
||||
}
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer, const ConditionalTurnRestriction &restriction)
|
||||
{
|
||||
write(writer, static_cast<const TurnRestriction &>(restriction));
|
||||
writer.WriteElementCount64(restriction.condition.size());
|
||||
for (const auto &c : restriction.condition)
|
||||
{
|
||||
writer.WriteFrom(c.modifier);
|
||||
storage::serialization::write(writer, c.times);
|
||||
storage::serialization::write(writer, c.weekdays);
|
||||
storage::serialization::write(writer, c.monthdays);
|
||||
}
|
||||
}
|
||||
|
||||
inline void read(storage::io::FileReader &reader, ConditionalTurnRestriction &restriction)
|
||||
{
|
||||
read(reader, static_cast<TurnRestriction &>(restriction));
|
||||
const auto num_conditions = reader.ReadElementCount64();
|
||||
restriction.condition.resize(num_conditions);
|
||||
for (uint64_t i = 0; i < num_conditions; i++)
|
||||
{
|
||||
reader.ReadInto(restriction.condition[i].modifier);
|
||||
storage::serialization::read(reader, restriction.condition[i].times);
|
||||
storage::serialization::read(reader, restriction.condition[i].weekdays);
|
||||
storage::serialization::read(reader, restriction.condition[i].monthdays);
|
||||
}
|
||||
}
|
||||
|
||||
// read/write for conditional turn restrictions file
|
||||
inline void read(storage::io::FileReader &reader, std::vector<TurnRestriction> &restrictions)
|
||||
{
|
||||
auto num_indices = reader.ReadElementCount64();
|
||||
restrictions.reserve(num_indices);
|
||||
TurnRestriction restriction;
|
||||
while (num_indices-- > 0)
|
||||
{
|
||||
read(reader, restriction);
|
||||
restrictions.push_back(std::move(restriction));
|
||||
}
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer, const std::vector<TurnRestriction> &restrictions)
|
||||
{
|
||||
const auto num_indices = restrictions.size();
|
||||
writer.WriteElementCount64(num_indices);
|
||||
const auto write_restriction = [&writer](const auto &restriction) {
|
||||
write(writer, restriction);
|
||||
};
|
||||
std::for_each(restrictions.begin(), restrictions.end(), write_restriction);
|
||||
}
|
||||
|
||||
// read/write for conditional turn restrictions file
|
||||
inline void read(storage::io::FileReader &reader,
|
||||
std::vector<ConditionalTurnRestriction> &restrictions)
|
||||
{
|
||||
auto num_indices = reader.ReadElementCount64();
|
||||
restrictions.reserve(num_indices);
|
||||
ConditionalTurnRestriction restriction;
|
||||
while (num_indices-- > 0)
|
||||
{
|
||||
read(reader, restriction);
|
||||
restrictions.push_back(std::move(restriction));
|
||||
}
|
||||
}
|
||||
|
||||
inline void write(storage::io::FileWriter &writer,
|
||||
const std::vector<ConditionalTurnRestriction> &restrictions)
|
||||
{
|
||||
const auto num_indices = restrictions.size();
|
||||
writer.WriteElementCount64(num_indices);
|
||||
const auto write_restriction = [&writer](const auto &restriction) {
|
||||
write(writer, restriction);
|
||||
};
|
||||
std::for_each(restrictions.begin(), restrictions.end(), write_restriction);
|
||||
}
|
||||
|
||||
inline void read(storage::io::BufferReader &reader, ConditionalTurnPenalty &turn_penalty)
|
||||
{
|
||||
reader.ReadInto(turn_penalty.turn_offset);
|
||||
|
||||
Reference in New Issue
Block a user