diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ea4fa687..6a1cf4e87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ add_library(EXTRACTOR OBJECT ${ExtractorGlob}) add_library(CONTRACTOR OBJECT ${ContractorGlob}) add_library(ENGINE OBJECT ${EngineGlob}) add_library(SERVER OBJECT ${ServerGlob}) -add_library(GRAPH OBJECT src/extractor/external_memory_node.cpp src/extractor/import_edge.cpp) +add_library(GRAPH OBJECT src/extractor/external_memory_node.cpp) add_library(PHANTOM OBJECT src/engine/phantom_node.cpp) add_dependencies(UTIL FingerPrintConfigure) diff --git a/include/extractor/import_edge.hpp b/include/extractor/import_edge.hpp index fc43e2a23..48729a375 100644 --- a/include/extractor/import_edge.hpp +++ b/include/extractor/import_edge.hpp @@ -11,20 +11,46 @@ namespace extractor struct NodeBasedEdge { - bool operator<(const NodeBasedEdge &e) const; + bool operator<(const NodeBasedEdge &other) const + { + if (source == other.source) + { + if (target == other.target) + { + if (weight == other.weight) + { + return forward && backward && ((!other.forward) || (!other.backward)); + } + return weight < other.weight; + } + return target < other.target; + } + return source < other.source; + } - NodeBasedEdge(); - explicit NodeBasedEdge(NodeID source, - NodeID target, - NodeID name_id, - EdgeWeight weight, - bool forward, - bool backward, - bool roundabout, - bool access_restricted, - bool startpoint, - TravelMode travel_mode, - bool is_split); + NodeBasedEdge() + : source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), forward(false), + backward(false), roundabout(false), access_restricted(false), startpoint(true), + is_split(false), travel_mode(false) + { + } + + NodeBasedEdge(NodeID source, + NodeID target, + NodeID name_id, + EdgeWeight weight, + bool forward, + bool backward, + bool roundabout, + bool access_restricted, + bool startpoint, + TravelMode travel_mode, + bool is_split) + : source(source), target(target), name_id(name_id), weight(weight), forward(forward), + backward(backward), roundabout(roundabout), access_restricted(access_restricted), + startpoint(startpoint), is_split(is_split), travel_mode(travel_mode) + { + } NodeID source; NodeID target; @@ -75,18 +101,44 @@ struct EdgeBasedEdge { public: - bool operator<(const EdgeBasedEdge &e) const; + bool operator<(const EdgeBasedEdge &other) const + { + if (source == other.source) + { + if (target == other.target) + { + if (weight == other.weight) + { + return forward && backward && ((!other.forward) || (!other.backward)); + } + return weight < other.weight; + } + return target < other.target; + } + return source < other.source; + } + template + explicit EdgeBasedEdge(const EdgeT &other) + : source(other.source), target(other.target), edge_id(other.data.via), + weight(other.data.distance), forward(other.data.forward), backward(other.data.backward) + { + } - template explicit EdgeBasedEdge(const EdgeT &myEdge); + EdgeBasedEdge() : source(0), target(0), edge_id(0), weight(0), forward(false), backward(false) + { + } - EdgeBasedEdge(); + EdgeBasedEdge(const NodeID source, + const NodeID target, + const NodeID edge_id, + const EdgeWeight weight, + const bool forward, + const bool backward) + : source(source), target(target), edge_id(edge_id), weight(weight), forward(forward), + backward(backward) + { + } - explicit EdgeBasedEdge(const NodeID source, - const NodeID target, - const NodeID edge_id, - const EdgeWeight weight, - const bool forward, - const bool backward); NodeID source; NodeID target; NodeID edge_id; diff --git a/src/extractor/import_edge.cpp b/src/extractor/import_edge.cpp deleted file mode 100644 index b3b6b612d..000000000 --- a/src/extractor/import_edge.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "extractor/import_edge.hpp" - -#include "extractor/travel_mode.hpp" -#include "util/typedefs.hpp" - -namespace osrm -{ -namespace extractor -{ - -bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const -{ - if (source == other.source) - { - if (target == other.target) - { - if (weight == other.weight) - { - return forward && backward && ((!other.forward) || (!other.backward)); - } - return weight < other.weight; - } - return target < other.target; - } - return source < other.source; -} - -NodeBasedEdge::NodeBasedEdge() - : source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), forward(false), - backward(false), roundabout(false), access_restricted(false), startpoint(true), - is_split(false), travel_mode(false) -{ -} - -NodeBasedEdge::NodeBasedEdge(NodeID source, - NodeID target, - NodeID name_id, - EdgeWeight weight, - bool forward, - bool backward, - bool roundabout, - bool access_restricted, - bool startpoint, - TravelMode travel_mode, - bool is_split) - : source(source), target(target), name_id(name_id), weight(weight), forward(forward), - backward(backward), roundabout(roundabout), access_restricted(access_restricted), - startpoint(startpoint), is_split(is_split), travel_mode(travel_mode) -{ -} - -bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const -{ - if (source == other.source) - { - if (target == other.target) - { - if (weight == other.weight) - { - return forward && backward && ((!other.forward) || (!other.backward)); - } - return weight < other.weight; - } - return target < other.target; - } - return source < other.source; -} - -template -EdgeBasedEdge::EdgeBasedEdge(const EdgeT &other) - : source(other.source), target(other.target), edge_id(other.data.via), - weight(other.data.distance), forward(other.data.forward), backward(other.data.backward) -{ -} - -/** Default constructor. target and weight are set to 0.*/ -EdgeBasedEdge::EdgeBasedEdge() - : source(0), target(0), edge_id(0), weight(0), forward(false), backward(false) -{ -} - -EdgeBasedEdge::EdgeBasedEdge(const NodeID source, - const NodeID target, - const NodeID edge_id, - const EdgeWeight weight, - const bool forward, - const bool backward) - : source(source), target(target), edge_id(edge_id), weight(weight), forward(forward), - backward(backward) -{ -} -} -}