From 928e1178b1e4db04b36578d2d4e7fdff27d76c6c Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Wed, 30 Nov 2011 19:33:03 +0100 Subject: [PATCH] Removed VERBOSE macro since it was superflous --- Util/GraphLoader.h | 68 ++++++++++++++++++---------------------------- typedefs.h | 2 -- 2 files changed, 27 insertions(+), 43 deletions(-) diff --git a/Util/GraphLoader.h b/Util/GraphLoader.h index e1d4d9464..3ed93033a 100644 --- a/Util/GraphLoader.h +++ b/Util/GraphLoader.h @@ -48,17 +48,17 @@ NodeID readOSRMGraphFromStream(istream &in, vector& edgeList, vector> n; - VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;) - for (NodeID i=0; i> id >> ycoord >> xcoord; int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id)); ext2IntNodeMap.insert(make_pair(id, i)); } in >> m; - VERBOSE(cout << " and " << m << " edges ..." << flush;) + DEBUG(" and " << m << " edges ..."); edgeList.reserve(m); - for (EdgeID i=0; i& edgeList, vector" << source << "," << target << "," << length << "," << dir << "," << weight << endl; - cerr << "unresolved source NodeID: " << source << endl; exit(0); + if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) { + ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source ); } source = intNodeID->second; intNodeID = ext2IntNodeMap.find(target); - if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { cerr << "unresolved target NodeID : " << target << endl; exit(0); } + if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { ERR("unresolved target NodeID : " << target); } target = intNodeID->second; - if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); } + if(source == UINT_MAX || target == UINT_MAX) { ERR( "nonexisting source or target" ); } EdgeT inputEdge(source, target, nameID, weight, forward, backward, type ); edgeList.push_back(inputEdge); @@ -107,7 +103,7 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector& edgeList, vecto int xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open) ExternalNodeMap ext2IntNodeMap; in.read((char*)&n, sizeof(NodeID)); - VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;) + DEBUG("Importing n = " << n << " nodes "); for (NodeID i=0; i& edgeList, vecto ext2IntNodeMap.insert(make_pair(id, i)); } in.read((char*)&m, sizeof(unsigned)); - VERBOSE(cout << " and " << m << " edges ..." << flush;) + DEBUG(" and " << m << " edges "); for(unsigned i = 0; i < inputRestrictions.size(); ++i) { ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(inputRestrictions[i].fromNode); @@ -167,13 +163,13 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector& edgeList, vecto if (1 == dir) { backward = false; } if (2 == dir) { forward = false; } - if(length == 0) { cerr << "loaded null length edge" << endl; exit(1); } + if(length == 0) { ERR("loaded null length edge" ); } // translate the external NodeIDs to internal IDs ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source); if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) { #ifndef NDEBUG - cerr << "[warning] unresolved source NodeID: " << source << endl; + WARN(" unresolved source NodeID: " << source ); #endif continue; } @@ -181,13 +177,13 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector& edgeList, vecto intNodeID = ext2IntNodeMap.find(target); if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { #ifndef NDEBUG - cerr << "unresolved target NodeID : " << target << endl; + WARN("unresolved target NodeID : " << target ); #endif continue; } target = intNodeID->second; - if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); } + if(source == UINT_MAX || target == UINT_MAX) { ERR("nonexisting source or target"); } EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout ); edgeList.push_back(inputEdge); @@ -204,17 +200,17 @@ NodeID readDTMPGraphFromStream(istream &in, vector& edgeList, vector> n; - VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;) - for (NodeID i=0; i> id >> ycoord >> xcoord; int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id)); ext2IntNodeMap.insert(make_pair(id, i)); } in >> m; - VERBOSE(cout << " and " << m << " edges ..." << flush;) + DEBUG(" and " << m << " edges"); edgeList.reserve(m); - for (EdgeID i=0; i& edgeList, vector 0); assert(weight > 0); if(dir <0 || dir > 2) - std::cerr << "[error] direction bogus: " << dir << std::endl; + WARN("direction bogus: " << dir); assert(0<=dir && dir<=2); bool forward = true; @@ -287,23 +283,19 @@ NodeID readDTMPGraphFromStream(istream &in, vector& edgeList, vector" << source << "," << target << "," << length << "," << dir << "," << weight << endl; - cerr << "unresolved source NodeID: " << source << endl; exit(0); + if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) { + ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source); } source = intNodeID->second; intNodeID = ext2IntNodeMap.find(target); - if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { cerr << "unresolved target NodeID : " << target << endl; exit(0); } + if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { ERR("unresolved target NodeID : " << target); } target = intNodeID->second; - if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); } + if(source == UINT_MAX || target == UINT_MAX) { ERR("nonexisting source or target" ); } EdgeT inputEdge(source, target, 0, weight, forward, backward, type ); edgeList.push_back(inputEdge); @@ -333,12 +325,9 @@ NodeID readDDSGGraphFromStream(istream &in, vector& edgeList, vector> source >> target >> weight >> dir; - // if(dir == 3) - // dir = 0; - assert(weight > 0); if(dir <0 || dir > 3) - std::cerr << "[error] direction bogus: " << dir << std::endl; + ERR( "[error] direction bogus: " << dir ); assert(0<=dir && dir<=3); bool forward = true; @@ -347,8 +336,7 @@ NodeID readDDSGGraphFromStream(istream &in, vector& edgeList, vector& edgeList, vector(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates. - // cout << "ok" << endl; - // std::cout << "imported " << numberOfNodes << " nodes and " << edgeList.size() << " edges" << std::endl; nodeMap.clear(); return numberOfNodes; } diff --git a/typedefs.h b/typedefs.h index 9dacefff2..5f71a3ce5 100644 --- a/typedefs.h +++ b/typedefs.h @@ -31,8 +31,6 @@ or see http://www.gnu.org/licenses/agpl.txt. using namespace std; -#define VERBOSE(x) x -#define VERBOSE2(x) #ifdef STXXL_VERBOSE_LEVEL #undef STXXL_VERBOSE_LEVEL #endif