Moving node data structure into more meaningful class name

This commit is contained in:
Dennis Luxen 2013-08-05 19:35:47 +02:00
parent 4f5d7f79bd
commit 13f5baf608
6 changed files with 30 additions and 23 deletions

View File

@ -28,7 +28,7 @@ Strongly connected components using Tarjan's Algorithm
#include "../DataStructures/DeallocatingVector.h" #include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h" #include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/ImportEdge.h" #include "../DataStructures/ImportEdge.h"
#include "../DataStructures/NodeCoords.h" #include "../DataStructures/QueryNode.h"
#include "../DataStructures/Percent.h" #include "../DataStructures/Percent.h"
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include "../DataStructures/TurnInstructions.h" #include "../DataStructures/TurnInstructions.h"

View File

@ -21,7 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#ifndef IMPORTNODE_H_ #ifndef IMPORTNODE_H_
#define IMPORTNODE_H_ #define IMPORTNODE_H_
#include "NodeCoords.h" #include "QueryNode.h"
#include "../DataStructures/HashTable.h" #include "../DataStructures/HashTable.h"

View File

@ -21,7 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#ifndef NODEINFORMATIONHELPDESK_H_ #ifndef NODEINFORMATIONHELPDESK_H_
#define NODEINFORMATIONHELPDESK_H_ #define NODEINFORMATIONHELPDESK_H_
#include "NodeCoords.h" #include "QueryNode.h"
#include "PhantomNodes.h" #include "PhantomNodes.h"
#include "StaticRTree.h" #include "StaticRTree.h"
#include "../Contractor/EdgeBasedGraphFactory.h" #include "../Contractor/EdgeBasedGraphFactory.h"

View File

@ -24,31 +24,40 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "Coordinate.h" #include "Coordinate.h"
#include "../typedefs.h" #include "../typedefs.h"
#include <cassert> #include <boost/assert.hpp>
#include <cstddef> #include <cstddef>
#include <climits> #include <climits>
#include <limits> #include <limits>
template<typename NodeT> struct NodeInfo {
struct NodeCoords { typedef NodeID key_type; //type of NodeID
typedef unsigned key_type; //type of NodeID
typedef int value_type; //type of lat,lons typedef int value_type; //type of lat,lons
NodeCoords(int _lat, int _lon, NodeT _id) : lat(_lat), lon(_lon), id(_id) {} NodeInfo(int _lat, int _lon, NodeID _id) : lat(_lat), lon(_lon), id(_id) {}
NodeCoords() : lat(INT_MAX), lon(INT_MAX), id(UINT_MAX) {} NodeInfo() : lat(INT_MAX), lon(INT_MAX), id(UINT_MAX) {}
int lat; int lat;
int lon; int lon;
NodeT id; NodeID id;
static NodeCoords<NodeT> min_value() { static NodeInfo min_value() {
return NodeCoords<NodeT>(-90*COORDINATE_PRECISION,-180*COORDINATE_PRECISION,std::numeric_limits<NodeT>::min()); return NodeInfo(
} -90*COORDINATE_PRECISION,
static NodeCoords<NodeT> max_value() { -180*COORDINATE_PRECISION,
return NodeCoords<NodeT>(90*COORDINATE_PRECISION, 180*COORDINATE_PRECISION, std::numeric_limits<NodeT>::max()); std::numeric_limits<NodeID>::min()
);
} }
value_type operator[](std::size_t n) const { static NodeInfo max_value() {
return NodeInfo(
90*COORDINATE_PRECISION,
180*COORDINATE_PRECISION,
std::numeric_limits<NodeID>::max()
);
}
value_type operator[](const std::size_t n) const {
switch(n) { switch(n) {
case 1: case 1:
return lat; return lat;
@ -57,15 +66,13 @@ struct NodeCoords {
return lon; return lon;
break; break;
default: default:
assert(false); BOOST_ASSERT_MSG(false, "should not happen");
return UINT_MAX; return UINT_MAX;
break; break;
} }
assert(false); BOOST_ASSERT_MSG(false, "should not happen");
return UINT_MAX; return UINT_MAX;
} }
}; };
typedef NodeCoords<NodeID> NodeInfo;
#endif //_NODE_COORDS_H #endif //_NODE_COORDS_H

View File

@ -25,7 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "../DataStructures/Coordinate.h" #include "../DataStructures/Coordinate.h"
#include "../DataStructures/HashTable.h" #include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportNode.h" #include "../DataStructures/ImportNode.h"
#include "../DataStructures/NodeCoords.h" #include "../DataStructures/QueryNode.h"
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include "../DataStructures/TimingUtil.h" #include "../DataStructures/TimingUtil.h"
#include "../typedefs.h" #include "../typedefs.h"

View File

@ -24,7 +24,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "OSRMException.h" #include "OSRMException.h"
#include "../DataStructures/ImportNode.h" #include "../DataStructures/ImportNode.h"
#include "../DataStructures/ImportEdge.h" #include "../DataStructures/ImportEdge.h"
#include "../DataStructures/NodeCoords.h" #include "../DataStructures/QueryNode.h"
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include "../Util/UUID.h" #include "../Util/UUID.h"
#include "../typedefs.h" #include "../typedefs.h"