2015-02-19 13:15:16 -05:00
|
|
|
#ifndef QUERYEDGE_HPP
|
|
|
|
#define QUERYEDGE_HPP
|
2012-04-25 04:51:16 -04:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/typedefs.hpp"
|
2012-04-25 04:51:16 -04:00
|
|
|
|
2015-02-19 13:15:16 -05:00
|
|
|
#include <tuple>
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace contractor
|
|
|
|
{
|
|
|
|
|
2014-05-07 12:39:16 -04:00
|
|
|
struct QueryEdge
|
|
|
|
{
|
2012-04-25 04:51:16 -04:00
|
|
|
NodeID source;
|
|
|
|
NodeID target;
|
2014-05-07 12:39:16 -04:00
|
|
|
struct EdgeData
|
|
|
|
{
|
2016-05-12 12:50:10 -04:00
|
|
|
EdgeData() : id(0), shortcut(false), weight(0), forward(false), backward(false) {}
|
2014-07-15 05:46:26 -04:00
|
|
|
|
|
|
|
template <class OtherT> EdgeData(const OtherT &other)
|
|
|
|
{
|
2016-05-12 12:50:10 -04:00
|
|
|
weight = other.weight;
|
2014-07-15 05:46:26 -04:00
|
|
|
shortcut = other.shortcut;
|
|
|
|
id = other.id;
|
|
|
|
forward = other.forward;
|
|
|
|
backward = other.backward;
|
|
|
|
}
|
2016-11-18 03:38:26 -05:00
|
|
|
// this ID is either the middle node of the shortcut, or the ID of the edge based node (node
|
|
|
|
// based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle
|
|
|
|
// node. Otherwise we see the edge based node to access node data.
|
2014-05-07 12:39:16 -04:00
|
|
|
NodeID id : 31;
|
|
|
|
bool shortcut : 1;
|
2016-05-12 12:50:10 -04:00
|
|
|
int weight : 30;
|
2014-05-07 12:39:16 -04:00
|
|
|
bool forward : 1;
|
|
|
|
bool backward : 1;
|
2012-04-25 04:51:16 -04:00
|
|
|
} data;
|
2013-08-13 12:35:54 -04:00
|
|
|
|
2014-07-15 05:46:26 -04:00
|
|
|
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
|
|
|
|
|
|
|
QueryEdge(NodeID source, NodeID target, EdgeData data)
|
2015-08-18 06:56:34 -04:00
|
|
|
: source(source), target(target), data(std::move(data))
|
2014-07-15 05:46:26 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-02-19 13:15:16 -05:00
|
|
|
bool operator<(const QueryEdge &rhs) const
|
2014-05-07 12:39:16 -04:00
|
|
|
{
|
2015-02-19 13:15:16 -05:00
|
|
|
return std::tie(source, target) < std::tie(rhs.source, rhs.target);
|
2012-04-25 04:51:16 -04:00
|
|
|
}
|
|
|
|
|
2014-05-07 12:39:16 -04:00
|
|
|
bool operator==(const QueryEdge &right) const
|
|
|
|
{
|
|
|
|
return (source == right.source && target == right.target &&
|
2016-05-12 12:50:10 -04:00
|
|
|
data.weight == right.data.weight && data.shortcut == right.data.shortcut &&
|
2014-05-07 12:39:16 -04:00
|
|
|
data.forward == right.data.forward && data.backward == right.data.backward &&
|
|
|
|
data.id == right.data.id);
|
2012-04-25 04:51:16 -04:00
|
|
|
}
|
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-19 13:15:16 -05:00
|
|
|
#endif // QUERYEDGE_HPP
|