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/DynamicGraph.h"
#include "../DataStructures/ImportEdge.h"
#include "../DataStructures/NodeCoords.h"
#include "../DataStructures/QueryNode.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/Restriction.h"
#include "../DataStructures/TurnInstructions.h"

View File

@ -21,7 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#ifndef IMPORTNODE_H_
#define IMPORTNODE_H_
#include "NodeCoords.h"
#include "QueryNode.h"
#include "../DataStructures/HashTable.h"
@ -44,7 +44,7 @@ struct _Node : NodeInfo{
struct ImportNode : public _Node {
HashTable<std::string, std::string> keyVals;
inline void Clear() {
keyVals.EraseAll();
lat = 0; lon = 0; id = 0; bollard = false; trafficLight = false;

View File

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

View File

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

View File

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