Refactor name of legacy class _Node into more telling name ExternalMemoryNode
This commit is contained in:
parent
3da664236c
commit
510cc22484
@ -32,15 +32,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
|
|
||||||
|
|
||||||
struct _Node : NodeInfo{
|
struct ExternalMemoryNode : NodeInfo {
|
||||||
_Node(int _lat, int _lon, unsigned int _id, bool _bollard, bool _trafficLight) : NodeInfo(_lat, _lon, _id), bollard(_bollard), trafficLight(_trafficLight) {}
|
ExternalMemoryNode(
|
||||||
_Node() : bollard(false), trafficLight(false) {}
|
int lat,
|
||||||
|
int lon,
|
||||||
|
unsigned int id,
|
||||||
|
bool bollard,
|
||||||
|
bool traffic_light
|
||||||
|
) :
|
||||||
|
NodeInfo(lat, lon, id),
|
||||||
|
bollard(bollard),
|
||||||
|
trafficLight(traffic_light)
|
||||||
|
{ }
|
||||||
|
ExternalMemoryNode() : bollard(false), trafficLight(false) {}
|
||||||
|
|
||||||
static _Node min_value() {
|
static ExternalMemoryNode min_value() {
|
||||||
return _Node(0,0,0, false, false);
|
return ExternalMemoryNode(0,0,0, false, false);
|
||||||
}
|
}
|
||||||
static _Node max_value() {
|
static ExternalMemoryNode max_value() {
|
||||||
return _Node((std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)(), (std::numeric_limits<unsigned int>::max)(), false, false);
|
return ExternalMemoryNode(
|
||||||
|
std::numeric_limits<int>::max(),
|
||||||
|
std::numeric_limits<int>::max(),
|
||||||
|
std::numeric_limits<unsigned>::max(),
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
NodeID key() const {
|
NodeID key() const {
|
||||||
return id;
|
return id;
|
||||||
@ -49,7 +65,7 @@ struct _Node : NodeInfo{
|
|||||||
bool trafficLight;
|
bool trafficLight;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImportNode : public _Node {
|
struct ImportNode : public ExternalMemoryNode {
|
||||||
HashTable<std::string, std::string> keyVals;
|
HashTable<std::string, std::string> keyVals;
|
||||||
|
|
||||||
inline void Clear() {
|
inline void Clear() {
|
||||||
|
@ -165,7 +165,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(*usedNodeIDsIT == nodesIT->id) {
|
if(*usedNodeIDsIT == nodesIT->id) {
|
||||||
fout.write((char*)&(*nodesIT), sizeof(_Node));
|
fout.write((char*)&(*nodesIT), sizeof(ExternalMemoryNode));
|
||||||
++usedNodeCounter;
|
++usedNodeCounter;
|
||||||
++usedNodeIDsIT;
|
++usedNodeIDsIT;
|
||||||
++nodesIT;
|
++nodesIT;
|
||||||
|
@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
class ExtractionContainers {
|
class ExtractionContainers {
|
||||||
public:
|
public:
|
||||||
typedef stxxl::vector<NodeID> STXXLNodeIDVector;
|
typedef stxxl::vector<NodeID> STXXLNodeIDVector;
|
||||||
typedef stxxl::vector<_Node> STXXLNodeVector;
|
typedef stxxl::vector<ExternalMemoryNode> STXXLNodeVector;
|
||||||
typedef stxxl::vector<InternalExtractorEdge> STXXLEdgeVector;
|
typedef stxxl::vector<InternalExtractorEdge> STXXLEdgeVector;
|
||||||
typedef stxxl::vector<std::string> STXXLStringVector;
|
typedef stxxl::vector<std::string> STXXLStringVector;
|
||||||
typedef stxxl::vector<_RawRestrictionContainer> STXXLRestrictionsVector;
|
typedef stxxl::vector<_RawRestrictionContainer> STXXLRestrictionsVector;
|
||||||
|
@ -36,7 +36,7 @@ ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers * ext, StringMap * s
|
|||||||
ExtractorCallbacks::~ExtractorCallbacks() { }
|
ExtractorCallbacks::~ExtractorCallbacks() { }
|
||||||
|
|
||||||
/** warning: caller needs to take care of synchronization! */
|
/** warning: caller needs to take care of synchronization! */
|
||||||
void ExtractorCallbacks::nodeFunction(const _Node &n) {
|
void ExtractorCallbacks::nodeFunction(const ExternalMemoryNode &n) {
|
||||||
if(n.lat <= 85*COORDINATE_PRECISION && n.lat >= -85*COORDINATE_PRECISION) {
|
if(n.lat <= 85*COORDINATE_PRECISION && n.lat >= -85*COORDINATE_PRECISION) {
|
||||||
externalMemory->allNodes.push_back(n);
|
externalMemory->allNodes.push_back(n);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
~ExtractorCallbacks();
|
~ExtractorCallbacks();
|
||||||
|
|
||||||
/** warning: caller needs to take care of synchronization! */
|
/** warning: caller needs to take care of synchronization! */
|
||||||
void nodeFunction(const _Node &n);
|
void nodeFunction(const ExternalMemoryNode &n);
|
||||||
|
|
||||||
bool restrictionFunction(const _RawRestrictionContainer &r);
|
bool restrictionFunction(const _RawRestrictionContainer &r);
|
||||||
|
|
||||||
|
@ -172,16 +172,19 @@ struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmpNodeByID : public std::binary_function<_Node, _Node, bool> {
|
struct CmpNodeByID : public std::binary_function<ExternalMemoryNode, ExternalMemoryNode, bool> {
|
||||||
typedef _Node value_type;
|
typedef ExternalMemoryNode value_type;
|
||||||
bool operator () (const _Node & a, const _Node & b) const {
|
bool operator () (
|
||||||
|
const ExternalMemoryNode & a,
|
||||||
|
const ExternalMemoryNode & b
|
||||||
|
) const {
|
||||||
return a.id < b.id;
|
return a.id < b.id;
|
||||||
}
|
}
|
||||||
value_type max_value() {
|
value_type max_value() {
|
||||||
return _Node::max_value();
|
return ExternalMemoryNode::max_value();
|
||||||
}
|
}
|
||||||
value_type min_value() {
|
value_type min_value() {
|
||||||
return _Node::min_value();
|
return ExternalMemoryNode::min_value();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,9 +84,9 @@ NodeID readBinaryOSRMGraphFromStream(
|
|||||||
ExternalNodeMap ext_to_int_id_map;
|
ExternalNodeMap ext_to_int_id_map;
|
||||||
in.read((char*)&n, sizeof(NodeID));
|
in.read((char*)&n, sizeof(NodeID));
|
||||||
SimpleLogger().Write() << "Importing n = " << n << " nodes ";
|
SimpleLogger().Write() << "Importing n = " << n << " nodes ";
|
||||||
_Node node;
|
ExternalMemoryNode node;
|
||||||
for (NodeID i=0; i<n; ++i) {
|
for (NodeID i=0; i<n; ++i) {
|
||||||
in.read((char*)&node, sizeof(_Node));
|
in.read((char*)&node, sizeof(ExternalMemoryNode));
|
||||||
int2ExtNodeMap->push_back(NodeInfo(node.lat, node.lon, node.id));
|
int2ExtNodeMap->push_back(NodeInfo(node.lat, node.lon, node.id));
|
||||||
ext_to_int_id_map.emplace(node.id, i);
|
ext_to_int_id_map.emplace(node.id, i);
|
||||||
if(node.bollard) {
|
if(node.bollard) {
|
||||||
|
Loading…
Reference in New Issue
Block a user