Adapts Hint encoding and decoding to new fixed data facade
This commit is contained in:
committed by
Patrick Niklaus
parent
3d75d15361
commit
a145520b5b
+12
-2
@@ -1,5 +1,6 @@
|
||||
#include "engine/hint.hpp"
|
||||
#include "engine/object_encoder.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@@ -7,14 +8,23 @@ namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
|
||||
bool Hint::IsValid(const util::Coordinate new_input_coordinates,
|
||||
const datafacade::BaseDataFacade &facade) const
|
||||
{
|
||||
auto is_same_input_coordinate = new_input_coordinates.lon == phantom.input_location.lon &&
|
||||
new_input_coordinates.lat == phantom.input_location.lat;
|
||||
return is_same_input_coordinate && phantom.IsValid(facade.GetNumberOfNodes()) &&
|
||||
facade.GetCheckSum() == data_checksum;
|
||||
}
|
||||
|
||||
std::string Hint::ToBase64() const { return encodeBase64(*this); }
|
||||
|
||||
Hint Hint::FromBase64(const std::string &base64Hint)
|
||||
{
|
||||
BOOST_ASSERT_MSG(base64Hint.size() == ENCODED_HINT_SIZE, "Hint has invalid size");
|
||||
|
||||
auto decoded = decodeBase64<Hint>(base64Hint);
|
||||
return decoded;
|
||||
return decodeBase64<Hint>(base64Hint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user