Permalink
Browse files

Adding compile flag to get rid of STXXL dependency for osrm-routed

  • Loading branch information...
1 parent ee1b3af commit 8e1d69ac8b7516127edebb165c7bfea908b7db70 DennisOSRM committed Jan 1, 2012
Showing with 13 additions and 2 deletions.
  1. +12 −1 DataStructures/NNGrid.h
  2. +1 −1 SConstruct
View
@@ -27,7 +27,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include <fstream>
#include <limits>
#include <vector>
+
+#ifndef ROUTED
#include <stxxl.h>
+#endif
#ifdef _WIN32
#include <math.h>
@@ -71,9 +74,11 @@ class NNGrid {
~NNGrid() {
if(ramInFile.is_open()) ramInFile.close();
+#ifndef ROUTED
if (WriteAccess) {
entries.clear();
}
+#endif
if(localStream.get() && localStream->is_open()) {
localStream->close();
}
@@ -87,6 +92,7 @@ class NNGrid {
template<typename EdgeT>
void ConstructGrid(std::vector<EdgeT> & edgeList, char * ramIndexOut, char * fileIndexOut) {
+#ifndef ROUTED
Percent p(edgeList.size());
BOOST_FOREACH(EdgeT & edge, edgeList) {
p.printIncrement();
@@ -139,9 +145,10 @@ class NNGrid {
ramFile.write((char *)&ramIndexTable[0], sizeof(unsigned long)*1024*1024 );
//close ram index file
ramFile.close();
+#endif
}
- bool FindPhantomNodeForCoordinate( const _Coordinate & location, PhantomNode & resultNode) {
+ bool FindPhantomNodeForCoordinate( const _Coordinate & location, PhantomNode & resultNode) {
bool foundNode = false;
_Coordinate startCoord(100000*(lat2y(static_cast<double>(location.lat)/100000.)), location.lon);
/** search for point on edge close to source */
@@ -397,11 +404,13 @@ class NNGrid {
}
void AddEdge(_GridEdge edge) {
+#ifndef ROUTED
std::vector<BresenhamPixel> indexList;
GetListOfIndexesForEdgeAndGridSize(edge.startCoord, edge.targetCoord, indexList);
for(unsigned i = 0; i < indexList.size(); ++i) {
entries.push_back(GridEntry(edge, indexList[i].first, indexList[i].second));
}
+#endif
}
inline double ComputeDistance(const _Coordinate& inputPoint, const _Coordinate& source, const _Coordinate& target, _Coordinate& nearest, double *r) {
@@ -502,7 +511,9 @@ class NNGrid {
ofstream indexOutFile;
ifstream ramInFile;
+#ifndef ROUTED
stxxl::vector<GridEntry> entries;
+#endif
std::vector<unsigned long> ramIndexTable; //8 MB for first level index in RAM
std::string iif;
// LRUCache<int,std::vector<unsigned> > cellCache;
View
@@ -172,6 +172,6 @@ env.Program(target = 'osrm-extract', source = ["extractor.cpp", Glob('DataStruct
env.Program(target = 'osrm-prepare', source = ["createHierarchy.cpp", 'Contractor/EdgeBasedGraphFactory.cpp', Glob('Util/SRTMLookup/*.cpp')])
env.Append(CCFLAGS = ['-lboost_regex', '-lboost_iostreams', '-lbz2', '-lz', '-lprotobuf'])
env.Append(LINKFLAGS = ['-lboost_system'])
-env.Program(target = 'osrm-routed', source = ["routed.cpp", 'Descriptors/DescriptionFactory.cpp'])
+env.Program(target = 'osrm-routed', source = ["routed.cpp", 'Descriptors/DescriptionFactory.cpp'], CCFLAGS = ['-DROUTED'])
env = conf.Finish()

0 comments on commit 8e1d69a

Please sign in to comment.