basic turn lane handling

This commit is contained in:
Moritz Kobitzsch
2016-05-13 19:18:00 +02:00
parent 2a05b70dfc
commit efa29edf09
68 changed files with 3010 additions and 207 deletions
+47
View File
@@ -0,0 +1,47 @@
#include "util/guidance/turn_lanes.hpp"
#include <algorithm>
#include <iostream>
#include <boost/assert.hpp>
namespace osrm
{
namespace util
{
namespace guidance
{
LaneTupel::LaneTupel()
: lanes_in_turn(0), first_lane_from_the_right(INVALID_LANEID)
{
// basic constructor, set everything to zero
}
LaneTupel::LaneTupel(const LaneID lanes_in_turn, const LaneID first_lane_from_the_right)
: lanes_in_turn(lanes_in_turn), first_lane_from_the_right(first_lane_from_the_right)
{
}
// comparation based on interpretation as unsigned 32bit integer
bool LaneTupel::operator==(const LaneTupel other) const
{
static_assert(sizeof(LaneTupel) == sizeof(std::uint16_t),
"Comparation requires LaneTupel to be the of size 16Bit");
return *reinterpret_cast<const std::uint16_t *>(this) ==
*reinterpret_cast<const std::uint16_t *>(&other);
}
bool LaneTupel::operator!=(const LaneTupel other) const { return !(*this == other); }
// comparation based on interpretation as unsigned 32bit integer
bool LaneTupel::operator<(const LaneTupel other) const
{
static_assert(sizeof(LaneTupel) == sizeof(std::uint16_t),
"Comparation requires LaneTupel to be the of size 16Bit");
return *reinterpret_cast<const std::uint16_t *>(this) <
*reinterpret_cast<const std::uint16_t *>(&other);
}
} // namespace guidance
} // namespace util
} // namespace osrm
+2 -2
View File
@@ -36,11 +36,11 @@ NameTable::NameTable(const std::string &filename)
}
else
{
util::SimpleLogger().Write(logWARNING) << "list of street names is empty";
util::SimpleLogger().Write(logINFO) << "list of street names is empty in construction of name table from: \"" << filename << "\"";
}
if (!name_stream)
throw exception("Failed to read " + std::to_string(number_of_chars) +
" characters from file.");
" characters from " + filename);
}
std::string NameTable::GetNameForID(const unsigned name_id) const