Skip to content

Commit

Permalink
Split import_edge.hpp: node_based_edge.hpp, edge_based_edge.hpp closes
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h authored and TheMarex committed Jan 11, 2016
1 parent fc292cc commit 4813488
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 157 deletions.
1 change: 1 addition & 0 deletions include/contractor/processing_chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "contractor/contractor.hpp"
#include "contractor/contractor_options.hpp"
#include "contractor/query_edge.hpp"
#include "extractor/edge_based_edge.hpp"
#include "util/static_graph.hpp"
#include "util/deallocating_vector.hpp"
#include "util/node_based_graph.hpp"
Expand Down
80 changes: 80 additions & 0 deletions include/extractor/edge_based_edge.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef EDGE_BASED_EDGE_HPP
#define EDGE_BASED_EDGE_HPP

#include "extractor/travel_mode.hpp"
#include "util/typedefs.hpp"

namespace osrm
{
namespace extractor
{

struct EdgeBasedEdge
{
public:
EdgeBasedEdge();

template <class EdgeT> explicit EdgeBasedEdge(const EdgeT &other);

EdgeBasedEdge(const NodeID source,
const NodeID target,
const NodeID edge_id,
const EdgeWeight weight,
const bool forward,
const bool backward);

bool operator<(const EdgeBasedEdge &other) const;

NodeID source;
NodeID target;
NodeID edge_id;
EdgeWeight weight : 30;
bool forward : 1;
bool backward : 1;
};

// Impl.

inline EdgeBasedEdge::EdgeBasedEdge()
: source(0), target(0), edge_id(0), weight(0), forward(false), backward(false)
{
}

template <class EdgeT>
inline 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)
{
}

inline 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)
{
}

inline 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;
}
} // ns extractor
} // ns osrm

#endif /* EDGE_BASED_EDGE_HPP */
1 change: 1 addition & 0 deletions include/extractor/edge_based_graph_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#ifndef EDGE_BASED_GRAPH_FACTORY_HPP_
#define EDGE_BASED_GRAPH_FACTORY_HPP_

#include "extractor/edge_based_edge.hpp"
#include "extractor/speed_profile.hpp"
#include "util/typedefs.hpp"
#include "extractor/compressed_edge_container.hpp"
Expand Down
1 change: 1 addition & 0 deletions include/extractor/extractor.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef EXTRACTOR_HPP
#define EXTRACTOR_HPP

#include "extractor/edge_based_edge.hpp"
#include "extractor/extractor_options.hpp"
#include "extractor/edge_based_graph_factory.hpp"
#include "extractor/graph_compressor.hpp"
Expand Down
152 changes: 0 additions & 152 deletions include/extractor/import_edge.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion include/extractor/internal_extractor_edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "util/typedefs.hpp"
#include "extractor/travel_mode.hpp"
#include "extractor/import_edge.hpp"
#include "extractor/node_based_edge.hpp"

#include <boost/assert.hpp>

Expand Down
Loading

0 comments on commit 4813488

Please sign in to comment.