No need for extra translation units (for edge data structures)
This commit is contained in:
parent
f875e26fbf
commit
fc292cc2d8
@ -67,7 +67,7 @@ add_library(EXTRACTOR OBJECT ${ExtractorGlob})
|
|||||||
add_library(CONTRACTOR OBJECT ${ContractorGlob})
|
add_library(CONTRACTOR OBJECT ${ContractorGlob})
|
||||||
add_library(ENGINE OBJECT ${EngineGlob})
|
add_library(ENGINE OBJECT ${EngineGlob})
|
||||||
add_library(SERVER OBJECT ${ServerGlob})
|
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_library(PHANTOM OBJECT src/engine/phantom_node.cpp)
|
||||||
|
|
||||||
add_dependencies(UTIL FingerPrintConfigure)
|
add_dependencies(UTIL FingerPrintConfigure)
|
||||||
|
@ -11,10 +11,31 @@ namespace extractor
|
|||||||
|
|
||||||
struct NodeBasedEdge
|
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();
|
NodeBasedEdge()
|
||||||
explicit NodeBasedEdge(NodeID source,
|
: 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 target,
|
||||||
NodeID name_id,
|
NodeID name_id,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
@ -24,7 +45,12 @@ struct NodeBasedEdge
|
|||||||
bool access_restricted,
|
bool access_restricted,
|
||||||
bool startpoint,
|
bool startpoint,
|
||||||
TravelMode travel_mode,
|
TravelMode travel_mode,
|
||||||
bool is_split);
|
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 source;
|
||||||
NodeID target;
|
NodeID target;
|
||||||
@ -75,18 +101,44 @@ struct EdgeBasedEdge
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
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 <class EdgeT>
|
||||||
|
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 <class EdgeT> explicit EdgeBasedEdge(const EdgeT &myEdge);
|
EdgeBasedEdge() : source(0), target(0), edge_id(0), weight(0), forward(false), backward(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
EdgeBasedEdge();
|
EdgeBasedEdge(const NodeID source,
|
||||||
|
|
||||||
explicit EdgeBasedEdge(const NodeID source,
|
|
||||||
const NodeID target,
|
const NodeID target,
|
||||||
const NodeID edge_id,
|
const NodeID edge_id,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward);
|
const bool backward)
|
||||||
|
: source(source), target(target), edge_id(edge_id), weight(weight), forward(forward),
|
||||||
|
backward(backward)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
NodeID source;
|
NodeID source;
|
||||||
NodeID target;
|
NodeID target;
|
||||||
NodeID edge_id;
|
NodeID edge_id;
|
||||||
|
@ -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 <class EdgeT>
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user