bit packing ImportEdge members
This commit is contained in:
parent
cf29621aa7
commit
d851dd7196
@ -18,16 +18,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
or see http://www.gnu.org/licenses/agpl.txt.
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EDGE_H
|
#ifndef IMPORT_EDGE_H
|
||||||
#define EDGE_H
|
#define IMPORT_EDGE_H
|
||||||
|
|
||||||
|
|
||||||
#include "../Util/OSRMException.h"
|
#include "../Util/OSRMException.h"
|
||||||
#include <cassert>
|
#include "../typedefs.h"
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
class NodeBasedEdge {
|
class NodeBasedEdge {
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
bool operator< (const NodeBasedEdge& e) const {
|
bool operator< (const NodeBasedEdge& e) const {
|
||||||
if (source() == e.source()) {
|
if (source() == e.source()) {
|
||||||
if (target() == e.target()) {
|
if (target() == e.target()) {
|
||||||
@ -58,9 +59,9 @@ public:
|
|||||||
_target(t),
|
_target(t),
|
||||||
_name(n),
|
_name(n),
|
||||||
_weight(w),
|
_weight(w),
|
||||||
|
_type(ty),
|
||||||
forward(f),
|
forward(f),
|
||||||
backward(b),
|
backward(b),
|
||||||
_type(ty),
|
|
||||||
_roundabout(ra),
|
_roundabout(ra),
|
||||||
_ignoreInGrid(ig),
|
_ignoreInGrid(ig),
|
||||||
_accessRestricted(ar),
|
_accessRestricted(ar),
|
||||||
@ -71,42 +72,41 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID target() const {return _target; }
|
NodeID target() const {return _target; }
|
||||||
NodeID source() const {return _source; }
|
NodeID source() const {return _source; }
|
||||||
NodeID name() const { return _name; }
|
NodeID name() const { return _name; }
|
||||||
EdgeWeight weight() const {return _weight; }
|
EdgeWeight weight() const {return _weight; }
|
||||||
|
short type() const {
|
||||||
|
BOOST_ASSERT_MSG(_type >= 0, "type of ImportEdge invalid");
|
||||||
|
return _type; }
|
||||||
|
bool isBackward() const { return backward; }
|
||||||
|
bool isForward() const { return forward; }
|
||||||
|
bool isLocatable() const { return _type != 14; }
|
||||||
|
bool isRoundabout() const { return _roundabout; }
|
||||||
|
bool ignoreInGrid() const { return _ignoreInGrid; }
|
||||||
|
bool isAccessRestricted() const { return _accessRestricted; }
|
||||||
|
bool isContraFlow() const { return _contraFlow; }
|
||||||
|
|
||||||
short type() const { assert(_type >= 0); return _type; }
|
//TODO: names need to be fixed.
|
||||||
bool isBackward() const { return backward; }
|
NodeID _source;
|
||||||
bool isForward() const { return forward; }
|
NodeID _target;
|
||||||
bool isLocatable() const { return _type != 14; }
|
NodeID _name;
|
||||||
bool isRoundabout() const { return _roundabout; }
|
EdgeWeight _weight;
|
||||||
bool ignoreInGrid() const { return _ignoreInGrid; }
|
short _type;
|
||||||
bool isAccessRestricted() const { return _accessRestricted; }
|
bool forward:1;
|
||||||
bool isContraFlow() const { return _contraFlow; }
|
bool backward:1;
|
||||||
|
bool _roundabout:1;
|
||||||
NodeID _source;
|
bool _ignoreInGrid:1;
|
||||||
NodeID _target;
|
bool _accessRestricted:1;
|
||||||
NodeID _name;
|
bool _contraFlow:1;
|
||||||
EdgeWeight _weight;
|
|
||||||
bool forward;
|
|
||||||
bool backward;
|
|
||||||
short _type;
|
|
||||||
bool _roundabout;
|
|
||||||
bool _ignoreInGrid;
|
|
||||||
bool _accessRestricted;
|
|
||||||
bool _contraFlow;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Default constructor. target and weight are set to 0.*/
|
NodeBasedEdge() { }
|
||||||
NodeBasedEdge() :
|
|
||||||
_source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false), _ignoreInGrid(false), _accessRestricted(false), _contraFlow(false) { assert(false); } //shall not be used.
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EdgeBasedEdge {
|
class EdgeBasedEdge {
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
bool operator< (const EdgeBasedEdge& e) const {
|
bool operator< (const EdgeBasedEdge& e) const {
|
||||||
if (source() == e.source()) {
|
if (source() == e.source()) {
|
||||||
if (target() == e.target()) {
|
if (target() == e.target()) {
|
||||||
@ -141,7 +141,14 @@ public:
|
|||||||
m_backward(false)
|
m_backward(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
explicit EdgeBasedEdge(const NodeID s, const NodeID t, const NodeID v, const EdgeWeight w, const bool f, const bool b) :
|
explicit EdgeBasedEdge(
|
||||||
|
const NodeID s,
|
||||||
|
const NodeID t,
|
||||||
|
const NodeID v,
|
||||||
|
const EdgeWeight w,
|
||||||
|
const bool f,
|
||||||
|
const bool b
|
||||||
|
) :
|
||||||
m_source(s),
|
m_source(s),
|
||||||
m_target(t),
|
m_target(t),
|
||||||
m_edgeID(v),
|
m_edgeID(v),
|
||||||
@ -150,21 +157,22 @@ public:
|
|||||||
m_backward(b)
|
m_backward(b)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NodeID target() const {return m_target; }
|
NodeID target() const { return m_target; }
|
||||||
NodeID source() const {return m_source; }
|
NodeID source() const { return m_source; }
|
||||||
EdgeWeight weight() const {return m_weight; }
|
EdgeWeight weight() const { return m_weight; }
|
||||||
NodeID id() const { return m_edgeID; }
|
NodeID id() const { return m_edgeID; }
|
||||||
bool isBackward() const { return m_backward; }
|
bool isBackward() const { return m_backward; }
|
||||||
bool isForward() const { return m_forward; }
|
bool isForward() const { return m_forward; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NodeID m_source;
|
NodeID m_source;
|
||||||
NodeID m_target;
|
NodeID m_target;
|
||||||
NodeID m_edgeID;
|
NodeID m_edgeID;
|
||||||
EdgeWeight m_weight:30;
|
EdgeWeight m_weight:30;
|
||||||
bool m_forward:1;
|
bool m_forward:1;
|
||||||
bool m_backward:1;
|
bool m_backward:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NodeBasedEdge ImportEdge;
|
typedef NodeBasedEdge ImportEdge;
|
||||||
|
|
||||||
#endif // EDGE_H
|
#endif /* IMPORT_EDGE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user