Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM
This commit is contained in:
commit
d18b648c1e
@ -66,8 +66,7 @@ public:
|
|||||||
NodeID target;
|
NodeID target;
|
||||||
struct EdgeData {
|
struct EdgeData {
|
||||||
NodeID via;
|
NodeID via;
|
||||||
unsigned nameID1;
|
unsigned nameID;
|
||||||
unsigned nameID2;
|
|
||||||
int distance;
|
int distance;
|
||||||
bool shortcut;
|
bool shortcut;
|
||||||
bool forward;
|
bool forward;
|
||||||
@ -91,7 +90,7 @@ public:
|
|||||||
bool operator== ( const Edge& right ) const {
|
bool operator== ( const Edge& right ) const {
|
||||||
return ( source == right.source && target == right.target && data.distance == right.data.distance &&
|
return ( source == right.source && target == right.target && data.distance == right.data.distance &&
|
||||||
data.shortcut == right.data.shortcut && data.forward == right.data.forward && data.backward == right.data.backward
|
data.shortcut == right.data.shortcut && data.forward == right.data.forward && data.backward == right.data.backward
|
||||||
&& data.via == right.data.via && data.nameID1 == right.data.nameID1 && data.nameID2 == right.data.nameID2
|
&& data.via == right.data.via && data.nameID == right.data.nameID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -304,7 +304,7 @@ public:
|
|||||||
newEdge.data.distance = data.distance;
|
newEdge.data.distance = data.distance;
|
||||||
newEdge.data.shortcut = data.shortcut;
|
newEdge.data.shortcut = data.shortcut;
|
||||||
newEdge.data.via = data.via;
|
newEdge.data.via = data.via;
|
||||||
newEdge.data.nameID1 = data.nameID;
|
newEdge.data.nameID = data.nameID;
|
||||||
newEdge.data.turnInstruction = data.turnInstruction;
|
newEdge.data.turnInstruction = data.turnInstruction;
|
||||||
newEdge.data.forward = data.forward;
|
newEdge.data.forward = data.forward;
|
||||||
newEdge.data.backward = data.backward;
|
newEdge.data.backward = data.backward;
|
||||||
@ -495,6 +495,7 @@ private:
|
|||||||
bool _UpdateNeighbours( std::vector< double >* priorities, std::vector< _PriorityData >* const nodeData, _ThreadData* const data, NodeID node ) {
|
bool _UpdateNeighbours( std::vector< double >* priorities, std::vector< _PriorityData >* const nodeData, _ThreadData* const data, NodeID node ) {
|
||||||
std::vector< NodeID >& neighbours = data->neighbours;
|
std::vector< NodeID >& neighbours = data->neighbours;
|
||||||
neighbours.clear();
|
neighbours.clear();
|
||||||
|
std::vector< NodeID>().swap(neighbours);
|
||||||
|
|
||||||
//find all neighbours
|
//find all neighbours
|
||||||
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
|
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
|
||||||
@ -521,6 +522,7 @@ private:
|
|||||||
|
|
||||||
std::vector< NodeID >& neighbours = data->neighbours;
|
std::vector< NodeID >& neighbours = data->neighbours;
|
||||||
neighbours.clear();
|
neighbours.clear();
|
||||||
|
std::vector< NodeID>().swap(neighbours);
|
||||||
|
|
||||||
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
|
for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) {
|
||||||
const NodeID target = _graph->GetTarget( e );
|
const NodeID target = _graph->GetTarget( e );
|
||||||
|
@ -103,7 +103,7 @@ void EdgeBasedGraphFactory::Run() {
|
|||||||
//Loop over all nodes u. Three nested loop look super-linear, but we are dealing with a number linear in the turns only.
|
//Loop over all nodes u. Three nested loop look super-linear, but we are dealing with a number linear in the turns only.
|
||||||
for(_NodeBasedDynamicGraph::NodeIterator u = 0; u < _nodeBasedGraph->GetNumberOfNodes(); ++u ) {
|
for(_NodeBasedDynamicGraph::NodeIterator u = 0; u < _nodeBasedGraph->GetNumberOfNodes(); ++u ) {
|
||||||
//loop over all adjacent edge (u,v)
|
//loop over all adjacent edge (u,v)
|
||||||
while(restrictionIterator->fromNode < u && inputRestrictions.end() != restrictionIterator) {
|
while(inputRestrictions.end() != restrictionIterator && restrictionIterator->fromNode < u) {
|
||||||
++restrictionIterator;
|
++restrictionIterator;
|
||||||
}
|
}
|
||||||
for(_NodeBasedDynamicGraph::EdgeIterator e1 = _nodeBasedGraph->BeginEdges(u); e1 < _nodeBasedGraph->EndEdges(u); ++e1) {
|
for(_NodeBasedDynamicGraph::EdgeIterator e1 = _nodeBasedGraph->BeginEdges(u); e1 < _nodeBasedGraph->EndEdges(u); ++e1) {
|
||||||
@ -115,7 +115,7 @@ void EdgeBasedGraphFactory::Run() {
|
|||||||
//if (u,v,w) is a forbidden turn, continue
|
//if (u,v,w) is a forbidden turn, continue
|
||||||
bool isTurnProhibited = false;
|
bool isTurnProhibited = false;
|
||||||
if( u != w ) { //only add an edge if turn is not a U-turn
|
if( u != w ) { //only add an edge if turn is not a U-turn
|
||||||
if(u == restrictionIterator->fromNode) {
|
if(restrictionIterator != inputRestrictions.end() && u == restrictionIterator->fromNode) {
|
||||||
std::vector<_Restriction>::iterator secondRestrictionIterator = restrictionIterator;
|
std::vector<_Restriction>::iterator secondRestrictionIterator = restrictionIterator;
|
||||||
do {
|
do {
|
||||||
if( v == secondRestrictionIterator->viaNode && w == secondRestrictionIterator->toNode) {
|
if( v == secondRestrictionIterator->viaNode && w == secondRestrictionIterator->toNode) {
|
||||||
|
@ -135,7 +135,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if("yes" == accessClass)
|
if("yes" == accessClass || "designated" == accessClass)
|
||||||
w.access = true;
|
w.access = true;
|
||||||
else if("no" == accessClass)
|
else if("no" == accessClass)
|
||||||
w.access = false;
|
w.access = false;
|
||||||
@ -164,7 +164,7 @@ public:
|
|||||||
w.type = 1;
|
w.type = 1;
|
||||||
|
|
||||||
//Get the unique identifier for the street name
|
//Get the unique identifier for the street name
|
||||||
StringMap::const_iterator strit = stringMap->find(w.name);
|
const StringMap::const_iterator strit = stringMap->find(w.name);
|
||||||
if(strit == stringMap->end()) {
|
if(strit == stringMap->end()) {
|
||||||
w.nameID = externalMemory->nameVector.size();
|
w.nameID = externalMemory->nameVector.size();
|
||||||
externalMemory->nameVector.push_back(w.name);
|
externalMemory->nameVector.push_back(w.name);
|
||||||
|
@ -256,7 +256,7 @@ private:
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
assert(!ed.shortcut);
|
assert(!ed.shortcut);
|
||||||
path.push_back(_PathData(ed.via, ed.nameID1, ed.turnInstruction, ed.distance) );
|
path.push_back(_PathData(ed.via, ed.nameID, ed.turnInstruction, ed.distance) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ struct ObjectsForQueryStruct {
|
|||||||
names = new std::vector<std::string>();
|
names = new std::vector<std::string>();
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
for(unsigned i = 0; i < size; i++) {
|
for(unsigned i = 0; i < size; ++i) {
|
||||||
unsigned sizeOfString = 0;
|
unsigned sizeOfString = 0;
|
||||||
namesInStream.read((char *)&sizeOfString, sizeof(unsigned));
|
namesInStream.read((char *)&sizeOfString, sizeof(unsigned));
|
||||||
memset(buf, 0, 1024*sizeof(char));
|
memset(buf, 0, 1024*sizeof(char));
|
||||||
|
13
README.TXT
13
README.TXT
@ -6,7 +6,7 @@ installing dependencies and running make should suffice. Make sure the following
|
|||||||
dependencies are installed:
|
dependencies are installed:
|
||||||
|
|
||||||
- Boost 1.41+
|
- Boost 1.41+
|
||||||
- sparsehash 1.4+
|
- sparsehash 1.4+
|
||||||
- g++ 4.2+
|
- g++ 4.2+
|
||||||
- libxml2 2.7+
|
- libxml2 2.7+
|
||||||
- scons 2.10+
|
- scons 2.10+
|
||||||
@ -77,11 +77,12 @@ preprocessing runs in three steps, all done by seperate programs.
|
|||||||
necessary, because the osm data is not made to support fast routing out of the
|
necessary, because the osm data is not made to support fast routing out of the
|
||||||
box. The output of the step is a file called 'file.osrm'
|
box. The output of the step is a file called 'file.osrm'
|
||||||
|
|
||||||
'osrm-prepare file.osrm' preprocesses the road network and computes additional
|
'osrm-prepare file.osrm file.restrictions' preprocesses the road network and
|
||||||
information that is exploited later to speed up the path computation. The output
|
computes additional information that is exploited later to speed up the path
|
||||||
of this step consists of two file 'file.osrm.hsgr' and 'file.osrm.nodes'. The first
|
computation. The output of this step consists of two file 'file.osrm.hsgr' and
|
||||||
file is the so-called hierarchy that speeds up the path computation while the
|
'file.osrm.nodes'. The first file is the so-called hierarchy that speeds up the
|
||||||
latter one carries (among other things) geographical information.
|
path computation while the latter one carries (among other things) geographical
|
||||||
|
information.
|
||||||
|
|
||||||
'osrm-routed' starts the server on TCP Port 5000. The
|
'osrm-routed' starts the server on TCP Port 5000. The
|
||||||
server communicates over http and can be queried by any browser or http-capable
|
server communicates over http and can be queried by any browser or http-capable
|
||||||
|
@ -48,17 +48,17 @@ NodeID readOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in >> n;
|
in >> n;
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i < n; ++i) {
|
||||||
in >> id >> ycoord >> xcoord;
|
in >> id >> ycoord >> xcoord;
|
||||||
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in >> m;
|
in >> m;
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges ...");
|
||||||
|
|
||||||
edgeList.reserve(m);
|
edgeList.reserve(m);
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; ++i) {
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
short type;
|
short type;
|
||||||
NodeID nameID;
|
NodeID nameID;
|
||||||
@ -73,23 +73,19 @@ NodeID readOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (1 == dir) backward = false;
|
if (1 == dir) backward = false;
|
||||||
if (2 == dir) forward = false;
|
if (2 == dir) forward = false;
|
||||||
|
|
||||||
if(length == 0)
|
if(length == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end())
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
{
|
ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source );
|
||||||
cerr << "after " << edgeList.size() << " edges" << endl;
|
|
||||||
cerr << "->" << source << "," << target << "," << length << "," << dir << "," << weight << endl;
|
|
||||||
cerr << "unresolved source NodeID: " << source << endl; exit(0);
|
|
||||||
}
|
}
|
||||||
source = intNodeID->second;
|
source = intNodeID->second;
|
||||||
intNodeID = ext2IntNodeMap.find(target);
|
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;
|
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 );
|
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
@ -107,8 +103,8 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
int xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in.read((char*)&n, sizeof(NodeID));
|
in.read((char*)&n, sizeof(NodeID));
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i<n; ++i) {
|
||||||
in.read((char*)&id, sizeof(unsigned));
|
in.read((char*)&id, sizeof(unsigned));
|
||||||
in.read((char*)&ycoord, sizeof(int));
|
in.read((char*)&ycoord, sizeof(int));
|
||||||
in.read((char*)&xcoord, sizeof(int));
|
in.read((char*)&xcoord, sizeof(int));
|
||||||
@ -116,27 +112,27 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in.read((char*)&m, sizeof(unsigned));
|
in.read((char*)&m, sizeof(unsigned));
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges ");
|
||||||
|
|
||||||
for(unsigned i = 0; i < inputRestrictions.size(); ++i) {
|
for(unsigned i = 0; i < inputRestrictions.size(); ++i) {
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(inputRestrictions[i].fromNode);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(inputRestrictions[i].fromNode);
|
||||||
if( intNodeID == ext2IntNodeMap.end()) {
|
if( intNodeID == ext2IntNodeMap.end()) {
|
||||||
DEBUG("Unmapped restriction")
|
DEBUG("Unmapped from Node of restriction");
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
inputRestrictions[i].fromNode = intNodeID->second;
|
inputRestrictions[i].fromNode = intNodeID->second;
|
||||||
|
|
||||||
intNodeID = ext2IntNodeMap.find(inputRestrictions[i].viaNode);
|
intNodeID = ext2IntNodeMap.find(inputRestrictions[i].viaNode);
|
||||||
if( intNodeID == ext2IntNodeMap.end()) {
|
if( intNodeID == ext2IntNodeMap.end()) {
|
||||||
DEBUG("Unmapped restriction")
|
DEBUG("Unmapped via node of restriction");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inputRestrictions[i].viaNode = intNodeID->second;
|
inputRestrictions[i].viaNode = intNodeID->second;
|
||||||
|
|
||||||
intNodeID = ext2IntNodeMap.find(inputRestrictions[i].toNode);
|
intNodeID = ext2IntNodeMap.find(inputRestrictions[i].toNode);
|
||||||
if( intNodeID == ext2IntNodeMap.end()) {
|
if( intNodeID == ext2IntNodeMap.end()) {
|
||||||
DEBUG("Unmapped restriction")
|
DEBUG("Unmapped to node of restriction");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inputRestrictions[i].toNode = intNodeID->second;
|
inputRestrictions[i].toNode = intNodeID->second;
|
||||||
}
|
}
|
||||||
@ -148,7 +144,7 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
int length;
|
int length;
|
||||||
bool isRoundabout;
|
bool isRoundabout;
|
||||||
|
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; ++i) {
|
||||||
in.read((char*)&source, sizeof(unsigned));
|
in.read((char*)&source, sizeof(unsigned));
|
||||||
in.read((char*)&target, sizeof(unsigned));
|
in.read((char*)&target, sizeof(unsigned));
|
||||||
in.read((char*)&length, sizeof(int));
|
in.read((char*)&length, sizeof(int));
|
||||||
@ -158,22 +154,20 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
in.read((char*)&nameID, sizeof(unsigned));
|
in.read((char*)&nameID, sizeof(unsigned));
|
||||||
in.read((char*)&isRoundabout, sizeof(bool));
|
in.read((char*)&isRoundabout, sizeof(bool));
|
||||||
|
|
||||||
assert(length > 0);
|
GUARANTEE(length > 0, "loaded null length edge" );
|
||||||
assert(weight > 0);
|
GUARANTEE(weight > 0, "loaded null weight");
|
||||||
assert(0<=dir && dir<=2);
|
GUARANTEE(0<=dir && dir<=2, "loaded bogus direction");
|
||||||
|
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
bool backward = true;
|
bool backward = true;
|
||||||
if (1 == dir) { backward = false; }
|
if (1 == dir) { backward = false; }
|
||||||
if (2 == dir) { forward = false; }
|
if (2 == dir) { forward = false; }
|
||||||
|
|
||||||
if(length == 0) { cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cerr << "[warning] unresolved source NodeID: " << source << endl;
|
WARN(" unresolved source NodeID: " << source );
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -181,20 +175,19 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
intNodeID = ext2IntNodeMap.find(target);
|
intNodeID = ext2IntNodeMap.find(target);
|
||||||
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) {
|
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cerr << "unresolved target NodeID : " << target << endl;
|
WARN("unresolved target NodeID : " << target );
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
target = intNodeID->second;
|
target = intNodeID->second;
|
||||||
|
GUARANTEE(source != UINT_MAX && target != UINT_MAX, "nonexisting source or target");
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
|
||||||
|
|
||||||
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout );
|
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
}
|
}
|
||||||
ext2IntNodeMap.clear();
|
ext2IntNodeMap.clear();
|
||||||
vector<ImportEdge>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
|
vector<ImportEdge>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
|
||||||
cout << "ok" << endl;
|
INFO("Graph loaded ok");
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
template<typename EdgeT>
|
template<typename EdgeT>
|
||||||
@ -204,17 +197,17 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in >> n;
|
in >> n;
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i<n;++i) {
|
||||||
in >> id >> ycoord >> xcoord;
|
in >> id >> ycoord >> xcoord;
|
||||||
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in >> m;
|
in >> m;
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges");
|
||||||
|
|
||||||
edgeList.reserve(m);
|
edgeList.reserve(m);
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; ++i) {
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
unsigned speedType(0);
|
unsigned speedType(0);
|
||||||
short type(0);
|
short type(0);
|
||||||
@ -279,7 +272,7 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
assert(length > 0);
|
assert(length > 0);
|
||||||
assert(weight > 0);
|
assert(weight > 0);
|
||||||
if(dir <0 || dir > 2)
|
if(dir <0 || dir > 2)
|
||||||
std::cerr << "[error] direction bogus: " << dir << std::endl;
|
WARN("direction bogus: " << dir);
|
||||||
assert(0<=dir && dir<=2);
|
assert(0<=dir && dir<=2);
|
||||||
|
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
@ -287,23 +280,19 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (dir == 1) backward = false;
|
if (dir == 1) backward = false;
|
||||||
if (dir == 2) forward = false;
|
if (dir == 2) forward = false;
|
||||||
|
|
||||||
if(length == 0)
|
if(length == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end())
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
{
|
ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source);
|
||||||
cerr << "after " << edgeList.size() << " edges" << endl;
|
|
||||||
cerr << "->" << source << "," << target << "," << length << "," << dir << "," << weight << endl;
|
|
||||||
cerr << "unresolved source NodeID: " << source << endl; exit(0);
|
|
||||||
}
|
}
|
||||||
source = intNodeID->second;
|
source = intNodeID->second;
|
||||||
intNodeID = ext2IntNodeMap.find(target);
|
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;
|
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 );
|
EdgeT inputEdge(source, target, 0, weight, forward, backward, type );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
@ -333,12 +322,9 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
in >> source >> target >> weight >> dir;
|
in >> source >> target >> weight >> dir;
|
||||||
|
|
||||||
// if(dir == 3)
|
|
||||||
// dir = 0;
|
|
||||||
|
|
||||||
assert(weight > 0);
|
assert(weight > 0);
|
||||||
if(dir <0 || dir > 3)
|
if(dir <0 || dir > 3)
|
||||||
std::cerr << "[error] direction bogus: " << dir << std::endl;
|
ERR( "[error] direction bogus: " << dir );
|
||||||
assert(0<=dir && dir<=3);
|
assert(0<=dir && dir<=3);
|
||||||
|
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
@ -347,8 +333,7 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (dir == 2) forward = false;
|
if (dir == 2) forward = false;
|
||||||
if (dir == 3) {backward = true; forward = true;}
|
if (dir == 3) {backward = true; forward = true;}
|
||||||
|
|
||||||
if(weight == 0)
|
if(weight == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
if( nodeMap.find(source) == nodeMap.end()) {
|
if( nodeMap.find(source) == nodeMap.end()) {
|
||||||
nodeMap.insert(std::make_pair(source, numberOfNodes ));
|
nodeMap.insert(std::make_pair(source, numberOfNodes ));
|
||||||
@ -365,8 +350,6 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
}
|
}
|
||||||
vector<EdgeT>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
|
vector<EdgeT>(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();
|
nodeMap.clear();
|
||||||
return numberOfNodes;
|
return numberOfNodes;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#undef VERBOSE2
|
#undef VERBOSE2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <climits>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -60,11 +61,10 @@ std::vector<_Restriction> inputRestrictions;
|
|||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
if(argc < 3) {
|
if(argc < 3) {
|
||||||
cerr << "usage: " << std::endl << argv[0] << " <osrm-data> <osrm-restrictions>" << std::endl;
|
ERR("usage: " << std::endl << argv[0] << " <osrm-data> <osrm-restrictions>");
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
INFO("Using restrictions from file: " << argv[2]);
|
INFO("Using restrictions from file: " << argv[2]);
|
||||||
ifstream restrictionsInstream(argv[2], ios::binary);
|
std::ifstream restrictionsInstream(argv[2], ios::binary);
|
||||||
_Restriction restriction;
|
_Restriction restriction;
|
||||||
unsigned usableRestrictionsCounter(0);
|
unsigned usableRestrictionsCounter(0);
|
||||||
restrictionsInstream.read((char*)&usableRestrictionsCounter, sizeof(unsigned));
|
restrictionsInstream.read((char*)&usableRestrictionsCounter, sizeof(unsigned));
|
||||||
@ -83,36 +83,24 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
omp_set_num_threads(numberOfThreads);
|
omp_set_num_threads(numberOfThreads);
|
||||||
|
|
||||||
std::cout << "preprocessing data from input file " << argv[1];
|
INFO("preprocessing data from input file " << argv[1] << " using STL "
|
||||||
#ifdef _GLIBCXX_PARALLEL
|
#ifdef _GLIBCXX_PARALLEL
|
||||||
std::cout << " using STL parallel mode" << std::endl;
|
"parallel (GCC)"
|
||||||
#else
|
#else
|
||||||
std::cout << " using STL serial mode" << std::endl;
|
"serial"
|
||||||
#endif
|
#endif
|
||||||
|
" mode");
|
||||||
ifstream in;
|
ifstream in;
|
||||||
in.open (argv[1], ifstream::in | ifstream::binary);
|
in.open (argv[1], ifstream::in | ifstream::binary);
|
||||||
if (!in.is_open()) {
|
if (!in.is_open()) {
|
||||||
cerr << "Cannot open " << argv[1] << std::endl; exit(-1);
|
ERR("Cannot open " << argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
char nodeOut[1024];
|
char nodeOut[1024]; strcpy(nodeOut, argv[1]); strcat(nodeOut, ".nodes");
|
||||||
char edgeOut[1024];
|
char edgeOut[1024]; strcpy(edgeOut, argv[1]); strcat(edgeOut, ".hsgr");
|
||||||
char ramIndexOut[1024];
|
char ramIndexOut[1024]; strcpy(ramIndexOut, argv[1]); strcat(ramIndexOut, ".ramIndex");
|
||||||
char fileIndexOut[1024];
|
char fileIndexOut[1024]; strcpy(fileIndexOut, argv[1]); strcat(fileIndexOut, ".fileIndex");
|
||||||
char levelInfoOut[1024];
|
char levelInfoOut[1024]; strcpy(levelInfoOut, argv[1]); strcat(levelInfoOut, ".levels");
|
||||||
|
|
||||||
strcpy(nodeOut, argv[1]);
|
|
||||||
strcpy(edgeOut, argv[1]);
|
|
||||||
strcpy(ramIndexOut, argv[1]);
|
|
||||||
strcpy(fileIndexOut, argv[1]);
|
|
||||||
strcpy(levelInfoOut, argv[1]);
|
|
||||||
|
|
||||||
strcat(nodeOut, ".nodes");
|
|
||||||
strcat(edgeOut, ".hsgr");
|
|
||||||
strcat(ramIndexOut, ".ramIndex");
|
|
||||||
strcat(fileIndexOut, ".fileIndex");
|
|
||||||
strcat(levelInfoOut, ".levels");
|
|
||||||
|
|
||||||
std::vector<ImportEdge> edgeList;
|
std::vector<ImportEdge> edgeList;
|
||||||
NodeID n = readBinaryOSRMGraphFromStream(in, edgeList, &internalToExternaleNodeMapping, inputRestrictions);
|
NodeID n = readBinaryOSRMGraphFromStream(in, edgeList, &internalToExternaleNodeMapping, inputRestrictions);
|
||||||
@ -132,24 +120,24 @@ int main (int argc, char *argv[]) {
|
|||||||
DELETE(edgeBasedGraphFactory);
|
DELETE(edgeBasedGraphFactory);
|
||||||
|
|
||||||
WritableGrid * writeableGrid = new WritableGrid();
|
WritableGrid * writeableGrid = new WritableGrid();
|
||||||
std::cout << "building grid ..." << std::flush;
|
INFO("building grid ...");
|
||||||
writeableGrid->ConstructGrid(nodeBasedEdgeList, &internalToExternaleNodeMapping, ramIndexOut, fileIndexOut);
|
writeableGrid->ConstructGrid(nodeBasedEdgeList, &internalToExternaleNodeMapping, ramIndexOut, fileIndexOut);
|
||||||
DELETE( writeableGrid );
|
DELETE( writeableGrid );
|
||||||
std::cout << "writing node map ..." << std::flush;
|
nodeBasedEdgeList.clear();
|
||||||
ofstream mapOutFile(nodeOut, ios::binary);
|
std::vector<EdgeBasedGraphFactory::EdgeBasedNode>().swap(nodeBasedEdgeList);
|
||||||
|
|
||||||
for(NodeID i = 0; i < internalToExternaleNodeMapping.size(); i++) {
|
INFO("writing node map ...");
|
||||||
mapOutFile.write((char *)&(internalToExternaleNodeMapping.at(i)), sizeof(NodeInfo));
|
std::ofstream mapOutFile(nodeOut, ios::binary);
|
||||||
|
BOOST_FOREACH(NodeInfo & info, internalToExternaleNodeMapping) {
|
||||||
|
mapOutFile.write((char *)&(info), sizeof(NodeInfo));
|
||||||
}
|
}
|
||||||
mapOutFile.close();
|
mapOutFile.close();
|
||||||
std::cout << "ok" << std::endl;
|
|
||||||
|
|
||||||
internalToExternaleNodeMapping.clear();
|
internalToExternaleNodeMapping.clear();
|
||||||
std::vector<NodeInfo>().swap(internalToExternaleNodeMapping);
|
std::vector<NodeInfo>().swap(internalToExternaleNodeMapping);
|
||||||
inputRestrictions.clear();
|
inputRestrictions.clear();
|
||||||
std::vector<_Restriction>().swap(inputRestrictions);
|
std::vector<_Restriction>().swap(inputRestrictions);
|
||||||
|
|
||||||
std::cout << "initializing contractor ..." << std::flush;
|
INFO("initializing contractor");
|
||||||
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
||||||
double contractionStartedTimestamp(get_timestamp());
|
double contractionStartedTimestamp(get_timestamp());
|
||||||
contractor->Run();
|
contractor->Run();
|
||||||
@ -160,24 +148,25 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
ContractionCleanup * cleanup = new ContractionCleanup(n, contractedEdges);
|
ContractionCleanup * cleanup = new ContractionCleanup(n, contractedEdges);
|
||||||
contractedEdges.clear();
|
contractedEdges.clear();
|
||||||
|
std::vector<ContractionCleanup::Edge>().swap(contractedEdges);
|
||||||
cleanup->Run();
|
cleanup->Run();
|
||||||
|
|
||||||
std::vector< InputEdge> cleanedEdgeList;
|
std::vector< InputEdge> cleanedEdgeList;
|
||||||
cleanup->GetData(cleanedEdgeList);
|
cleanup->GetData(cleanedEdgeList);
|
||||||
DELETE( cleanup );
|
DELETE( cleanup );
|
||||||
|
|
||||||
std::cout << "Serializing edges " << std::flush;
|
INFO("Serializing edges ");
|
||||||
ofstream edgeOutFile(edgeOut, ios::binary);
|
ofstream edgeOutFile(edgeOut, ios::binary);
|
||||||
Percent p(cleanedEdgeList.size());
|
Percent p(cleanedEdgeList.size());
|
||||||
for(std::vector< InputEdge>::iterator it = cleanedEdgeList.begin(); it != cleanedEdgeList.end(); it++) {
|
BOOST_FOREACH(InputEdge & edge, cleanedEdgeList) {
|
||||||
p.printIncrement();
|
p.printIncrement();
|
||||||
edgeOutFile.write((char *)&(it->data), sizeof(EdgeData));
|
edgeOutFile.write((char *)&(edge.data), sizeof(EdgeData));
|
||||||
edgeOutFile.write((char *)&(it->source), sizeof(NodeID));
|
edgeOutFile.write((char *)&(edge.source), sizeof(NodeID));
|
||||||
edgeOutFile.write((char *)&(it->target), sizeof(NodeID));
|
edgeOutFile.write((char *)&(edge.target), sizeof(NodeID));
|
||||||
}
|
}
|
||||||
edgeOutFile.close();
|
edgeOutFile.close();
|
||||||
cleanedEdgeList.clear();
|
cleanedEdgeList.clear();
|
||||||
|
|
||||||
std::cout << "finished" << std::endl;
|
INFO("finished preprocessing");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,19 +70,16 @@ bool removeIfUnused(ClassT n) { return (false == n.used); }
|
|||||||
|
|
||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
if(argc <= 1) {
|
GUARANTEE((argc > 1) ,"usage: \n" << argv[0] << " <file.osm/.osm.bz2/.osm.pbf>");
|
||||||
cerr << "usage: " << endl << argv[0] << " <file.osm/.osm.bz2/.osm.pbf>" << endl;
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "[extractor] extracting data from input file " << argv[1] << endl;
|
INFO("extracting data from input file " << argv[1]);
|
||||||
bool isPBF = false;
|
bool isPBF(false);
|
||||||
string outputFileName(argv[1]);
|
std::string outputFileName(argv[1]);
|
||||||
string restrictionsFileName(argv[1]);
|
std::string restrictionsFileName(argv[1]);
|
||||||
string::size_type pos = outputFileName.find(".osm.bz2");
|
std::string::size_type pos = outputFileName.find(".osm.bz2");
|
||||||
if(pos==string::npos) {
|
if(pos==std::string::npos) {
|
||||||
pos = outputFileName.find(".osm.pbf");
|
pos = outputFileName.find(".osm.pbf");
|
||||||
if(pos!=string::npos) {
|
if(pos!=std::string::npos) {
|
||||||
isPBF = true;
|
isPBF = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,7 +96,7 @@ int main (int argc, char *argv[]) {
|
|||||||
restrictionsFileName.append(".osrm.restrictions");
|
restrictionsFileName.append(".osrm.restrictions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string adressFileName(outputFileName);
|
std::string adressFileName(outputFileName);
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
|
||||||
boost::property_tree::ptree pt;
|
boost::property_tree::ptree pt;
|
||||||
@ -109,15 +106,15 @@ int main (int argc, char *argv[]) {
|
|||||||
INFO("Found the following speed profiles: ");
|
INFO("Found the following speed profiles: ");
|
||||||
int profileCounter(0);
|
int profileCounter(0);
|
||||||
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child("")) {
|
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child("")) {
|
||||||
string name = v.first;
|
std::string name = v.first;
|
||||||
cout << " [" << profileCounter << "]" << name << endl;
|
cout << " [" << profileCounter << "]" << name << endl;
|
||||||
++profileCounter;
|
++profileCounter;
|
||||||
}
|
}
|
||||||
string usedSpeedProfile(pt.get_child("").begin()->first);
|
std::string usedSpeedProfile(pt.get_child("").begin()->first);
|
||||||
INFO("Using profile \"" << usedSpeedProfile << "\"")
|
INFO("Using profile \"" << usedSpeedProfile << "\"")
|
||||||
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child(usedSpeedProfile)) {
|
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child(usedSpeedProfile)) {
|
||||||
string name = v.first;
|
std::string name = v.first;
|
||||||
string value = v.second.get<string>("");
|
std::string value = v.second.get<std::string>("");
|
||||||
DEBUG("inserting " << name << "=" << value);
|
DEBUG("inserting " << name << "=" << value);
|
||||||
if(name == "obeyOneways") {
|
if(name == "obeyOneways") {
|
||||||
if(value == "no")
|
if(value == "no")
|
||||||
@ -150,23 +147,21 @@ int main (int argc, char *argv[]) {
|
|||||||
unsigned amountOfRAM = 1;
|
unsigned amountOfRAM = 1;
|
||||||
unsigned installedRAM = GetPhysicalmemory();
|
unsigned installedRAM = GetPhysicalmemory();
|
||||||
if(installedRAM < 2048264) {
|
if(installedRAM < 2048264) {
|
||||||
cout << "[Warning] Machine has less than 2GB RAM." << endl;
|
WARN("Machine has less than 2GB RAM.");
|
||||||
}
|
}
|
||||||
if(testDataFile("extractor.ini")) {
|
if(testDataFile("extractor.ini")) {
|
||||||
ExtractorConfiguration extractorConfig("extractor.ini");
|
ExtractorConfiguration extractorConfig("extractor.ini");
|
||||||
unsigned memoryAmountFromFile = atoi(extractorConfig.GetParameter("Memory").c_str());
|
unsigned memoryAmountFromFile = atoi(extractorConfig.GetParameter("Memory").c_str());
|
||||||
if( memoryAmountFromFile != 0 && memoryAmountFromFile <= installedRAM/(1024*1024))
|
if( memoryAmountFromFile != 0 && memoryAmountFromFile <= installedRAM/(1024*1024))
|
||||||
amountOfRAM = memoryAmountFromFile;
|
amountOfRAM = memoryAmountFromFile;
|
||||||
cout << "[extractor] using " << amountOfRAM << " GB of RAM for buffers" << endl;
|
INFO("Using " << amountOfRAM << " GB of RAM for buffers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringMap stringMap;
|
||||||
STXXLContainers externalMemory;
|
STXXLContainers externalMemory;
|
||||||
|
|
||||||
unsigned usedNodeCounter = 0;
|
unsigned usedNodeCounter = 0;
|
||||||
unsigned usedEdgeCounter = 0;
|
unsigned usedEdgeCounter = 0;
|
||||||
|
|
||||||
StringMap stringMap;
|
|
||||||
|
|
||||||
double time = get_timestamp();
|
double time = get_timestamp();
|
||||||
|
|
||||||
stringMap[""] = 0;
|
stringMap[""] = 0;
|
||||||
@ -178,13 +173,9 @@ int main (int argc, char *argv[]) {
|
|||||||
parser = new XMLParser(argv[1]);
|
parser = new XMLParser(argv[1]);
|
||||||
}
|
}
|
||||||
parser->RegisterCallbacks(&nodeFunction, &restrictionFunction, &wayFunction, &adressFunction);
|
parser->RegisterCallbacks(&nodeFunction, &restrictionFunction, &wayFunction, &adressFunction);
|
||||||
if(parser->Init()) {
|
GUARANTEE(parser->Init(), "Parser not initialized!");
|
||||||
parser->Parse();
|
parser->Parse();
|
||||||
} else {
|
DELETE(parser);
|
||||||
cerr << "[error] parser not initialized!" << endl;
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
delete parser;
|
|
||||||
stringMap.clear();
|
stringMap.clear();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -31,8 +31,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define VERBOSE(x) x
|
|
||||||
#define VERBOSE2(x)
|
|
||||||
#ifdef STXXL_VERBOSE_LEVEL
|
#ifdef STXXL_VERBOSE_LEVEL
|
||||||
#undef STXXL_VERBOSE_LEVEL
|
#undef STXXL_VERBOSE_LEVEL
|
||||||
#endif
|
#endif
|
||||||
@ -41,12 +39,12 @@ using namespace std;
|
|||||||
#define INFO(x) do {std::cout << "[info " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
#define INFO(x) do {std::cout << "[info " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
||||||
#define ERR(x) do {std::cerr << "[error " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl; exit(-1);} while(0);
|
#define ERR(x) do {std::cerr << "[error " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl; exit(-1);} while(0);
|
||||||
#define WARN(x) do {std::cerr << "[warn " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
#define WARN(x) do {std::cerr << "[warn " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
||||||
|
#define GUARANTEE(x,y) do { {do{ if(false == (x)) { ERR(y) } } while(0);} } while(0);
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define DEBUG(x)
|
#define DEBUG(x)
|
||||||
#define GUARANTEE(x,y)
|
|
||||||
#else
|
#else
|
||||||
#define DEBUG(x) do {std::cout << "[debug " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
#define DEBUG(x) do {std::cout << "[debug " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
|
||||||
#define GUARANTEE(x,y) do { {do{ if(false == (x)) { ERR(y) } } while(0);} } while(0);
|
|
||||||
#endif
|
#endif
|
||||||
#define DELETE(x) do { if(NULL != x) { delete x; x = NULL; } }while(0);
|
#define DELETE(x) do { if(NULL != x) { delete x; x = NULL; } }while(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user