Check for correct magic number
This commit is contained in:
parent
31fbfa3a70
commit
c5db4dc15f
@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "../DataStructures/ImportEdge.h"
|
||||
#include "../DataStructures/NodeCoords.h"
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/UUID.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@ -50,6 +51,21 @@ struct _ExcessRemover {
|
||||
|
||||
template<typename EdgeT>
|
||||
NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeList, std::vector<NodeID> &bollardNodes, std::vector<NodeID> &trafficLightNodes, std::vector<NodeInfo> * int2ExtNodeMap, std::vector<_Restriction> & inputRestrictions) {
|
||||
const UUID uuid_orig;
|
||||
UUID uuid_loaded;
|
||||
in.read((char *) &uuid_loaded, sizeof(UUID));
|
||||
if(!uuid_loaded.IsMagicNumberOK()) {
|
||||
ERR("hsgr input file misses magic number. Check or reprocess the file");
|
||||
}
|
||||
|
||||
if( uuid_loaded.TestHSGR(uuid_orig) ) {
|
||||
WARN(
|
||||
".hsgr was prepared with different build.\n"
|
||||
"Reprocess to get rid of this warning."
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
NodeID n, source, target;
|
||||
EdgeID m;
|
||||
short dir;// direction (0 = open, 1 = forward, 2+ = open)
|
||||
|
@ -54,3 +54,11 @@ UUID::~UUID() {
|
||||
const boost::uuids::uuid & UUID::GetUUID() const {
|
||||
return named_uuid;
|
||||
}
|
||||
|
||||
const bool UUID::IsMagicNumberOK() const {
|
||||
return 1297240911 == magic_number;
|
||||
}
|
||||
|
||||
const bool UUID::TestHSGR(const UUID & other) const {
|
||||
return std::equal(md5_graph, md5_graph+32, other.md5_graph);
|
||||
}
|
@ -35,14 +35,12 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
//implements a singleton, i.e. there is one and only one conviguration object
|
||||
class UUID : boost::noncopyable {
|
||||
public:
|
||||
static UUID & GetInstance() {
|
||||
static UUID instance;
|
||||
return instance;
|
||||
}
|
||||
UUID();
|
||||
~UUID();
|
||||
const boost::uuids::uuid & GetUUID() const;
|
||||
const bool IsMagicNumberOK() const;
|
||||
const bool TestHSGR(const UUID & other) const;
|
||||
private:
|
||||
UUID();
|
||||
const unsigned magic_number;
|
||||
char md5_prepare[33];
|
||||
char md5_tree[33];
|
||||
|
Loading…
Reference in New Issue
Block a user