moved ImportNode/Edge into compile units

This commit is contained in:
Dennis Luxen 2014-05-29 18:31:02 +02:00
parent df3a7676eb
commit 3625308585
3 changed files with 36 additions and 110 deletions

View File

@ -35,6 +35,8 @@ configure_file(
${CMAKE_SOURCE_DIR}/Util/GitDescription.cpp
)
file(GLOB ExtractorGlob Extractor/*.cpp)
file(GLOB ImporterGlob DataStructures/Import*.cpp)
add_library(IMPORT STATIC ${ImporterGlob})
set(ExtractorSources extractor.cpp ${ExtractorGlob})
add_executable(osrm-extract ${ExtractorSources})
@ -157,8 +159,8 @@ endif()
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(OSRM ${Boost_LIBRARIES} COORDLIB)
target_link_libraries(osrm-extract ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB)
target_link_libraries(osrm-prepare ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB)
target_link_libraries(osrm-extract ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB IMPORT)
target_link_libraries(osrm-prepare ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB IMPORT)
target_link_libraries(osrm-routed ${Boost_LIBRARIES} OSRM UUID GITDESCRIPTION)
target_link_libraries(osrm-datastore ${Boost_LIBRARIES} UUID GITDESCRIPTION COORDLIB)
@ -231,7 +233,7 @@ if(WITH_TOOLS)
find_package(GDAL)
if(GDAL_FOUND)
add_executable(osrm-components Tools/components.cpp)
target_link_libraries(osrm-components ${TBB_LIBRARIES})
target_link_libraries(osrm-components ${TBB_LIBRARIES} IMPORT)
include_directories(${GDAL_INCLUDE_DIR})
target_link_libraries(
osrm-components

View File

@ -37,22 +37,7 @@ class NodeBasedEdge
{
public:
bool operator<(const NodeBasedEdge &e) const
{
if (source() == e.source())
{
if (target() == e.target())
{
if (weight() == e.weight())
{
return (isForward() && isBackward() && ((!e.isForward()) || (!e.isBackward())));
}
return (weight() < e.weight());
}
return (target() < e.target());
}
return (source() < e.source());
}
bool operator<(const NodeBasedEdge &e) const;
explicit NodeBasedEdge(NodeID s,
NodeID t,
@ -65,34 +50,21 @@ class NodeBasedEdge
bool ig,
bool ar,
bool cf,
bool is_split)
: _source(s), _target(t), _name(n), _weight(w), _type(ty), forward(f), backward(b),
_roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _contraFlow(cf),
is_split(is_split)
{
if (ty < 0)
{
throw OSRMException("negative edge type");
}
}
bool is_split);
NodeID target() const { return _target; }
NodeID source() const { return _source; }
NodeID name() const { return _name; }
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; }
bool IsSplit() const { return is_split; }
NodeID target() const;
NodeID source() const;
NodeID name() const;
EdgeWeight weight() const;
short type() const;
bool isBackward() const;
bool isForward() const;
bool isLocatable() const;
bool isRoundabout() const;
bool ignoreInGrid() const;
bool isAccessRestricted() const;
bool isContraFlow() const;
bool IsSplit() const;
// TODO: names need to be fixed.
NodeID _source;
@ -108,61 +80,34 @@ class NodeBasedEdge
bool _contraFlow : 1;
bool is_split : 1;
private:
NodeBasedEdge() {}
NodeBasedEdge() = delete;
};
class EdgeBasedEdge
{
public:
bool operator<(const EdgeBasedEdge &e) const
{
if (source() == e.source())
{
if (target() == e.target())
{
if (weight() == e.weight())
{
return (isForward() && isBackward() && ((!e.isForward()) || (!e.isBackward())));
}
return (weight() < e.weight());
}
return (target() < e.target());
}
return (source() < e.source());
}
bool operator<(const EdgeBasedEdge &e) const;
template <class EdgeT>
explicit EdgeBasedEdge(const EdgeT &myEdge)
: m_source(myEdge.source), m_target(myEdge.target), m_edgeID(myEdge.data.via),
m_weight(myEdge.data.distance), m_forward(myEdge.data.forward),
m_backward(myEdge.data.backward)
{
}
explicit EdgeBasedEdge(const EdgeT &myEdge);
/** Default constructor. target and weight are set to 0.*/
EdgeBasedEdge()
: m_source(0), m_target(0), m_edgeID(0), m_weight(0), m_forward(false), m_backward(false)
{
}
EdgeBasedEdge();
explicit EdgeBasedEdge(const NodeID s,
const NodeID t,
const NodeID v,
const EdgeWeight w,
const bool f,
const bool b)
: m_source(s), m_target(t), m_edgeID(v), m_weight(w), m_forward(f), m_backward(b)
{
}
const bool b);
NodeID target() const { return m_target; }
NodeID source() const { return m_source; }
EdgeWeight weight() const { return m_weight; }
NodeID id() const { return m_edgeID; }
bool isBackward() const { return m_backward; }
bool isForward() const { return m_forward; }
NodeID target() const;
NodeID source() const;
EdgeWeight weight() const;
NodeID id() const;
bool isBackward() const;
bool isForward() const;
private:
NodeID m_source;

View File

@ -31,30 +31,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "QueryNode.h"
#include "../DataStructures/HashTable.h"
#include <limits>
#include <string>
struct ExternalMemoryNode : NodeInfo
{
ExternalMemoryNode(int lat, int lon, unsigned int id, bool bollard, bool traffic_light)
: NodeInfo(lat, lon, id), bollard(bollard), trafficLight(traffic_light)
{
}
ExternalMemoryNode(int lat, int lon, unsigned int id, bool bollard, bool traffic_light);
ExternalMemoryNode() : bollard(false), trafficLight(false) {}
ExternalMemoryNode();
static ExternalMemoryNode min_value() { return ExternalMemoryNode(0, 0, 0, false, false); }
static ExternalMemoryNode min_value();
static ExternalMemoryNode max_value()
{
return ExternalMemoryNode(std::numeric_limits<int>::max(),
std::numeric_limits<int>::max(),
std::numeric_limits<unsigned>::max(),
false,
false);
}
NodeID key() const { return id; }
static ExternalMemoryNode max_value();
bool bollard;
bool trafficLight;
@ -64,15 +51,7 @@ struct ImportNode : public ExternalMemoryNode
{
HashTable<std::string, std::string> keyVals;
inline void Clear()
{
keyVals.clear();
lat = 0;
lon = 0;
id = 0;
bollard = false;
trafficLight = false;
}
inline void Clear();
};
#endif /* IMPORTNODE_H_ */