Globally rename UUID to FingerPrint
This commit is contained in:
parent
11459d38d0
commit
7335e0809a
2
.gitignore
vendored
2
.gitignore
vendored
@ -36,7 +36,7 @@ Thumbs.db
|
||||
# build related files #
|
||||
#######################
|
||||
/build/
|
||||
/Util/UUID.cpp
|
||||
/Util/FingerPrint.cpp
|
||||
/Util/GitDescription.cpp
|
||||
|
||||
# Eclipse related files #
|
||||
|
@ -20,15 +20,15 @@ OPTION(WITH_TOOLS "Build ORSM tools" OFF)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Include/)
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Util/UUID.cpp UUID.cpp.alwaysbuild
|
||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp FingerPrint.cpp.alwaysbuild
|
||||
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UUID-Config.cmake
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FingerPrint-Config.cmake
|
||||
DEPENDS
|
||||
${CMAKE_SOURCE_DIR}/Util/UUID.cpp.in
|
||||
COMMENT "Configuring UUID.cpp"
|
||||
${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp.in
|
||||
COMMENT "Configuring FingerPrint.cpp"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(UUIDConfigure DEPENDS ${CMAKE_SOURCE_DIR}/Util/UUID.cpp)
|
||||
add_custom_target(FingerPrintConfigure DEPENDS ${CMAKE_SOURCE_DIR}/Util/FingerPrint.cpp)
|
||||
|
||||
set(BOOST_COMPONENTS date_time filesystem iostreams program_options regex system thread)
|
||||
|
||||
@ -64,10 +64,10 @@ set(
|
||||
${HttpGlob}
|
||||
)
|
||||
add_library(COORDLIB STATIC ${CoordinateGlob})
|
||||
add_library(UUID STATIC Util/UUID.cpp)
|
||||
add_library(OSRM ${OSRMSources} Util/GitDescription.cpp Util/UUID.cpp)
|
||||
add_library(FINGERPRINT STATIC Util/FingerPrint.cpp)
|
||||
add_library(OSRM ${OSRMSources} Util/GitDescription.cpp Util/FingerPrint.cpp)
|
||||
add_library(GITDESCRIPTION STATIC Util/GitDescription.cpp)
|
||||
add_dependencies(UUID UUIDConfigure)
|
||||
add_dependencies(FINGERPRINT FingerPrintConfigure)
|
||||
add_dependencies(GITDESCRIPTION GIT_DESCRIPTION)
|
||||
|
||||
add_executable(osrm-routed routed.cpp ${ServerGlob})
|
||||
@ -161,10 +161,10 @@ endif()
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(OSRM ${Boost_LIBRARIES} COORDLIB)
|
||||
target_link_libraries(osrm-extract ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB IMPORT)
|
||||
target_link_libraries(osrm-prepare ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB IMPORT)
|
||||
target_link_libraries(osrm-routed ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION)
|
||||
target_link_libraries(osrm-datastore ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB)
|
||||
target_link_libraries(osrm-extract ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT)
|
||||
target_link_libraries(osrm-prepare ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT)
|
||||
target_link_libraries(osrm-routed ${Boost_LIBRARIES} OSRM FINGERPRINT GITDESCRIPTION)
|
||||
target_link_libraries(osrm-datastore ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT})
|
||||
@ -239,10 +239,10 @@ if(WITH_TOOLS)
|
||||
include_directories(${GDAL_INCLUDE_DIR})
|
||||
target_link_libraries(
|
||||
osrm-components
|
||||
${GDAL_LIBRARIES} ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB)
|
||||
${GDAL_LIBRARIES} ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB)
|
||||
endif()
|
||||
add_executable(osrm-cli Tools/simpleclient.cpp)
|
||||
target_link_libraries(osrm-cli ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION)
|
||||
target_link_libraries(osrm-cli ${Boost_LIBRARIES} OSRM FINGERPRINT GITDESCRIPTION)
|
||||
target_link_libraries(osrm-cli ${TBB_LIBRARIES})
|
||||
add_executable(osrm-io-benchmark Tools/io-benchmark.cpp)
|
||||
target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES} GITDESCRIPTION)
|
||||
|
@ -215,7 +215,7 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
// serialize restrictions
|
||||
std::ofstream restrictions_out_stream;
|
||||
restrictions_out_stream.open(restrictions_file_name.c_str(), std::ios::binary);
|
||||
restrictions_out_stream.write((char *)&uuid, sizeof(UUID));
|
||||
restrictions_out_stream.write((char *)&fingerprint, sizeof(FingerPrint));
|
||||
restrictions_out_stream.write((char *)&number_of_useable_restrictions, sizeof(unsigned));
|
||||
// for (restrictions_iterator = restrictions_list.begin();
|
||||
// restrictions_iterator != restrictions_list.end();
|
||||
@ -233,7 +233,7 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
|
||||
std::ofstream file_out_stream;
|
||||
file_out_stream.open(output_file_name.c_str(), std::ios::binary);
|
||||
file_out_stream.write((char *)&uuid, sizeof(UUID));
|
||||
file_out_stream.write((char *)&fingerprint, sizeof(FingerPrint));
|
||||
file_out_stream.write((char *)&number_of_used_nodes, sizeof(unsigned));
|
||||
time1 = std::chrono::steady_clock::now();
|
||||
std::cout << "[extractor] Confirming/Writing used nodes ... " << std::flush;
|
||||
@ -268,7 +268,7 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
|
||||
std::cout << "[extractor] setting number of nodes ... " << std::flush;
|
||||
std::ios::pos_type previous_file_position = file_out_stream.tellp();
|
||||
file_out_stream.seekp(std::ios::beg + sizeof(UUID));
|
||||
file_out_stream.seekp(std::ios::beg + sizeof(FingerPrint));
|
||||
file_out_stream.write((char *)&number_of_used_nodes, sizeof(unsigned));
|
||||
file_out_stream.seekp(previous_file_position);
|
||||
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "InternalExtractorEdge.h"
|
||||
#include "ExtractorStructs.h"
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/UUID.h"
|
||||
#include "../Util/FingerPrint.h"
|
||||
|
||||
#include <stxxl/vector>
|
||||
|
||||
@ -52,7 +52,7 @@ class ExtractionContainers
|
||||
STXXLStringVector name_list;
|
||||
STXXLRestrictionsVector restrictions_list;
|
||||
STXXLWayIDStartEndVector way_start_end_id_list;
|
||||
const UUID uuid;
|
||||
const FingerPrint fingerprint;
|
||||
|
||||
ExtractionContainers();
|
||||
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Util/GraphLoader.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/UUID.h"
|
||||
#include "../Util/FingerPrint.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
@ -61,11 +61,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
SimpleLogger().Write() << "Using restrictions from file: " << argv[2];
|
||||
std::ifstream restriction_ifstream(argv[2], std::ios::binary);
|
||||
const UUID uuid_orig;
|
||||
UUID uuid_loaded;
|
||||
restriction_ifstream.read((char *)&uuid_loaded, sizeof(UUID));
|
||||
const FingerPrint fingerprint_orig;
|
||||
FingerPrint fingerprint_loaded;
|
||||
restriction_ifstream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||
|
||||
if (!uuid_loaded.TestGraphUtil(uuid_orig))
|
||||
if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << argv[2] << " was prepared with a different build. "
|
||||
"Reprocess to get rid of this warning.";
|
||||
|
@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "UUID.h"
|
||||
#include "FingerPrint.h"
|
||||
|
||||
#include "OSRMException.h"
|
||||
|
||||
@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#cmakedefine MD5GRAPH "${MD5GRAPH}"
|
||||
#cmakedefine MD5OBJECTS "${MD5OBJECTS}"
|
||||
|
||||
UUID::UUID() : magic_number(1297240911)
|
||||
FingerPrint::FingerPrint() : magic_number(1297240911)
|
||||
{
|
||||
md5_prepare[32] = md5_tree[32] = md5_graph[32] = md5_objects[32] = '\0';
|
||||
|
||||
@ -65,13 +65,13 @@ UUID::UUID() : magic_number(1297240911)
|
||||
has_64_bits = HAS64BITS;
|
||||
}
|
||||
|
||||
UUID::~UUID() {}
|
||||
FingerPrint::~FingerPrint() {}
|
||||
|
||||
const boost::uuids::uuid &UUID::GetUUID() const { return named_uuid; }
|
||||
const boost::uuids::uuid &FingerPrint::GetFingerPrint() const { return named_uuid; }
|
||||
|
||||
bool UUID::IsMagicNumberOK() const { return 1297240911 == magic_number; }
|
||||
bool FingerPrint::IsMagicNumberOK() const { return 1297240911 == magic_number; }
|
||||
|
||||
bool UUID::TestGraphUtil(const UUID &other) const
|
||||
bool FingerPrint::TestGraphUtil(const FingerPrint &other) const
|
||||
{
|
||||
if (!other.IsMagicNumberOK())
|
||||
{
|
||||
@ -80,7 +80,7 @@ bool UUID::TestGraphUtil(const UUID &other) const
|
||||
return std::equal(md5_graph, md5_graph + 32, other.md5_graph);
|
||||
}
|
||||
|
||||
bool UUID::TestPrepare(const UUID &other) const
|
||||
bool FingerPrint::TestPrepare(const FingerPrint &other) const
|
||||
{
|
||||
if (!other.IsMagicNumberOK())
|
||||
{
|
||||
@ -89,7 +89,7 @@ bool UUID::TestPrepare(const UUID &other) const
|
||||
return std::equal(md5_prepare, md5_prepare + 32, other.md5_prepare);
|
||||
}
|
||||
|
||||
bool UUID::TestRTree(const UUID &other) const
|
||||
bool FingerPrint::TestRTree(const FingerPrint &other) const
|
||||
{
|
||||
if (!other.IsMagicNumberOK())
|
||||
{
|
||||
@ -98,7 +98,7 @@ bool UUID::TestRTree(const UUID &other) const
|
||||
return std::equal(md5_tree, md5_tree + 32, other.md5_tree);
|
||||
}
|
||||
|
||||
bool UUID::TestQueryObjects(const UUID &other) const
|
||||
bool FingerPrint::TestQueryObjects(const FingerPrint &other) const
|
||||
{
|
||||
if (!other.IsMagicNumberOK())
|
||||
{
|
@ -25,25 +25,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef UUID_H
|
||||
#define UUID_H
|
||||
#ifndef FINGERPRINT_H
|
||||
#define FINGERPRINT_H
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
|
||||
// implements a singleton, i.e. there is one and only one conviguration object
|
||||
class UUID
|
||||
class FingerPrint
|
||||
{
|
||||
public:
|
||||
UUID();
|
||||
UUID(const UUID&) = delete;
|
||||
~UUID();
|
||||
const boost::uuids::uuid &GetUUID() const;
|
||||
FingerPrint();
|
||||
FingerPrint(const FingerPrint&) = delete;
|
||||
~FingerPrint();
|
||||
const boost::uuids::uuid &GetFingerPrint() const;
|
||||
bool IsMagicNumberOK() const;
|
||||
bool TestGraphUtil(const UUID &other) const;
|
||||
bool TestPrepare(const UUID &other) const;
|
||||
bool TestRTree(const UUID &other) const;
|
||||
bool TestNodeInfo(const UUID &other) const;
|
||||
bool TestQueryObjects(const UUID &other) const;
|
||||
bool TestGraphUtil(const FingerPrint &other) const;
|
||||
bool TestPrepare(const FingerPrint &other) const;
|
||||
bool TestRTree(const FingerPrint &other) const;
|
||||
bool TestNodeInfo(const FingerPrint &other) const;
|
||||
bool TestQueryObjects(const FingerPrint &other) const;
|
||||
|
||||
private:
|
||||
const unsigned magic_number;
|
||||
@ -57,4 +57,4 @@ class UUID
|
||||
bool has_64_bits;
|
||||
};
|
||||
|
||||
#endif /* UUID_H */
|
||||
#endif /* FingerPrint_H */
|
@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/QueryNode.h"
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/UUID.h"
|
||||
#include "../Util/FingerPrint.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@ -60,11 +60,11 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
|
||||
std::vector<NodeInfo> *int_to_ext_node_id_map,
|
||||
std::vector<TurnRestriction> &restriction_list)
|
||||
{
|
||||
const UUID uuid_orig;
|
||||
UUID uuid_loaded;
|
||||
input_stream.read((char *)&uuid_loaded, sizeof(UUID));
|
||||
const FingerPrint fingerprint_orig;
|
||||
FingerPrint fingerprint_loaded;
|
||||
input_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||
|
||||
if (!uuid_loaded.TestGraphUtil(uuid_orig))
|
||||
if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << ".osrm was prepared with different build.\n"
|
||||
"Reprocess to get rid of this warning.";
|
||||
@ -285,9 +285,9 @@ unsigned readHSGRFromStream(const boost::filesystem::path &hsgr_file,
|
||||
|
||||
boost::filesystem::ifstream hsgr_input_stream(hsgr_file, std::ios::binary);
|
||||
|
||||
UUID uuid_loaded, uuid_orig;
|
||||
hsgr_input_stream.read((char *)&uuid_loaded, sizeof(UUID));
|
||||
if (!uuid_loaded.TestGraphUtil(uuid_orig))
|
||||
FingerPrint fingerprint_loaded, fingerprint_orig;
|
||||
hsgr_input_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||
if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << ".hsgr was prepared with different build.\n"
|
||||
"Reprocess to get rid of this warning.";
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(OLDFILE ${SOURCE_DIR}/Util/UUID.cpp)
|
||||
set(OLDFILE ${SOURCE_DIR}/Util/FingerPrint.cpp)
|
||||
if (EXISTS ${OLDFILE})
|
||||
file(REMOVE_RECURSE ${OLDFILE})
|
||||
endif()
|
||||
@ -7,4 +7,4 @@ file(MD5 ${SOURCE_DIR}/DataStructures/StaticRTree.h MD5RTREE)
|
||||
file(MD5 ${SOURCE_DIR}/Util/GraphLoader.h MD5GRAPH)
|
||||
file(MD5 ${SOURCE_DIR}/Server/DataStructures/InternalDataFacade.h MD5OBJECTS)
|
||||
|
||||
CONFIGURE_FILE( ${SOURCE_DIR}/Util/UUID.cpp.in ${SOURCE_DIR}/Util/UUID.cpp )
|
||||
CONFIGURE_FILE( ${SOURCE_DIR}/Util/FingerPrint.cpp.in ${SOURCE_DIR}/Util/FingerPrint.cpp )
|
@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Util/BoostFileSystemFix.h"
|
||||
#include "Util/DataStoreOptions.h"
|
||||
#include "Util/SimpleLogger.h"
|
||||
#include "Util/UUID.h"
|
||||
#include "Util/FingerPrint.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
#ifdef __linux__
|
||||
@ -241,11 +241,11 @@ int main(const int argc, const char *argv[])
|
||||
|
||||
boost::filesystem::ifstream hsgr_input_stream(hsgr_path, std::ios::binary);
|
||||
|
||||
UUID uuid_loaded, uuid_orig;
|
||||
hsgr_input_stream.read((char *)&uuid_loaded, sizeof(UUID));
|
||||
if (uuid_loaded.TestGraphUtil(uuid_orig))
|
||||
FingerPrint fingerprint_loaded, fingerprint_orig;
|
||||
hsgr_input_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||
if (fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
||||
{
|
||||
SimpleLogger().Write(logDEBUG) << "UUID checked out ok";
|
||||
SimpleLogger().Write(logDEBUG) << "Fingerprint checked out ok";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Util/ProgramOptions.h"
|
||||
#include "Util/SimpleLogger.h"
|
||||
#include "Util/StringUtil.h"
|
||||
#include "Util/UUID.h"
|
||||
#include "Util/FingerPrint.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
#include <cstdlib>
|
||||
@ -51,7 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
|
||||
ExtractorCallbacks *extractor_callbacks;
|
||||
UUID uuid;
|
||||
FingerPrint fingerprint;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -191,10 +191,10 @@ int main(int argc, char *argv[])
|
||||
LogPolicy::GetInstance().Unmute();
|
||||
boost::filesystem::ifstream restriction_stream(restrictions_path, std::ios::binary);
|
||||
TurnRestriction restriction;
|
||||
UUID uuid_loaded, uuid_orig;
|
||||
FingerPrint fingerprint_loaded, fingerprint_orig;
|
||||
unsigned number_of_usable_restrictions = 0;
|
||||
restriction_stream.read((char *)&uuid_loaded, sizeof(UUID));
|
||||
if (!uuid_loaded.TestPrepare(uuid_orig))
|
||||
restriction_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||
if (!fingerprint_loaded.TestPrepare(fingerprint_orig))
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << ".restrictions was prepared with different build.\n"
|
||||
"Reprocess to get rid of this warning.";
|
||||
@ -382,7 +382,7 @@ int main(int argc, char *argv[])
|
||||
<< " edges";
|
||||
|
||||
boost::filesystem::ofstream hsgr_output_stream(graphOut, std::ios::binary);
|
||||
hsgr_output_stream.write((char *)&uuid_orig, sizeof(UUID));
|
||||
hsgr_output_stream.write((char *)&fingerprint_orig, sizeof(FingerPrint));
|
||||
for (const QueryEdge &edge : contracted_edge_list)
|
||||
{
|
||||
BOOST_ASSERT(UINT_MAX != edge.source);
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Util/GitDescription.h"
|
||||
#include "Util/ProgramOptions.h"
|
||||
#include "Util/SimpleLogger.h"
|
||||
#include "Util/UUID.h"
|
||||
#include "Util/FingerPrint.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/mman.h>
|
||||
|
Loading…
Reference in New Issue
Block a user