2012-04-25 04:51:16 -04:00
|
|
|
/*
|
2013-10-14 07:42:28 -04:00
|
|
|
|
2015-02-19 03:19:51 -05:00
|
|
|
Copyright (c) 2014, Project OSRM contributors
|
2013-10-14 07:42:28 -04:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
|
|
of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
2012-04-25 04:51:16 -04:00
|
|
|
|
2014-11-28 06:13:18 -05:00
|
|
|
#ifndef QUERYEDGE_HPP_
|
|
|
|
#define QUERYEDGE_HPP_
|
2012-04-25 04:51:16 -04:00
|
|
|
|
|
|
|
#include "../typedefs.h"
|
|
|
|
|
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
|
|
|
|
{
|
2014-07-16 03:44:09 -04:00
|
|
|
EdgeData() : id(0), shortcut(false), distance(0), forward(false), backward(false) {}
|
2014-07-15 05:46:26 -04:00
|
|
|
|
|
|
|
template <class OtherT> EdgeData(const OtherT &other)
|
|
|
|
{
|
|
|
|
distance = other.distance;
|
|
|
|
shortcut = other.shortcut;
|
|
|
|
id = other.id;
|
|
|
|
forward = other.forward;
|
|
|
|
backward = other.backward;
|
|
|
|
}
|
2014-05-07 12:39:16 -04:00
|
|
|
NodeID id : 31;
|
|
|
|
bool shortcut : 1;
|
|
|
|
int distance : 30;
|
|
|
|
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)
|
|
|
|
: source(source), target(target), data(data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-07 12:39:16 -04:00
|
|
|
bool operator<(const QueryEdge &right) const
|
|
|
|
{
|
|
|
|
if (source != right.source)
|
|
|
|
{
|
2012-04-25 04:51:16 -04:00
|
|
|
return source < right.source;
|
2013-08-13 12:35:54 -04:00
|
|
|
}
|
2012-04-25 04:51:16 -04:00
|
|
|
return target < right.target;
|
|
|
|
}
|
|
|
|
|
2014-05-07 12:39:16 -04:00
|
|
|
bool operator==(const QueryEdge &right) const
|
|
|
|
{
|
|
|
|
return (source == right.source && target == right.target &&
|
|
|
|
data.distance == right.data.distance && data.shortcut == right.data.shortcut &&
|
|
|
|
data.forward == right.data.forward && data.backward == right.data.backward &&
|
|
|
|
data.id == right.data.id);
|
2012-04-25 04:51:16 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-11-28 06:13:18 -05:00
|
|
|
#endif /* QUERYEDGE_HPP_ */
|