Refactor file loading to use a common class that has proper error handling.

This commit is contained in:
Daniel Patterson
2016-11-11 05:52:21 -08:00
parent e226b52f21
commit 4ad6d88888
6 changed files with 288 additions and 336 deletions
+23 -1
View File
@@ -17,6 +17,7 @@ namespace util
namespace guidance
{
class LaneTuple;
class LaneTupleIdPair;
} // namespace guidance
} // namespace util
} // namespace osrm
@@ -27,6 +28,11 @@ template <> struct hash<::osrm::util::guidance::LaneTuple>
{
inline std::size_t operator()(const ::osrm::util::guidance::LaneTuple &bearing_class) const;
};
template <> struct hash<::osrm::util::guidance::LaneTupleIdPair>
{
inline std::size_t
operator()(const ::osrm::util::guidance::LaneTupleIdPair &bearing_class) const;
};
} // namespace std
namespace osrm
@@ -73,7 +79,23 @@ class LaneTuple
}
};
using LaneTupleIdPair = std::pair<util::guidance::LaneTuple, LaneDescriptionID>;
class LaneTupleIdPair
{
public:
util::guidance::LaneTuple first;
LaneDescriptionID second;
bool operator==(const LaneTupleIdPair &other) const;
friend std::size_t hash_value(const LaneTupleIdPair &pair)
{
std::size_t seed{0};
boost::hash_combine(seed, pair.first);
boost::hash_combine(seed, pair.second);
return seed;
}
};
} // namespace guidance
} // namespace util
} // namespace osrm