Adding a number of explicit namespace declarations

This commit is contained in:
DennisOSRM 2012-04-14 18:18:18 +02:00
parent 969d5c8558
commit 78ade5b7d7
7 changed files with 31 additions and 33 deletions

View File

@ -29,7 +29,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
class PolylineCompressor { class PolylineCompressor {
private: private:
inline void encodeVectorSignedNumber(vector<int> & numbers, string & output) { inline void encodeVectorSignedNumber(std::vector<int> & numbers, std::string & output) {
for(unsigned i = 0; i < numbers.size(); ++i) { for(unsigned i = 0; i < numbers.size(); ++i) {
numbers[i] <<= 1; numbers[i] <<= 1;
if (numbers[i] < 0) { if (numbers[i] < 0) {
@ -41,7 +41,7 @@ private:
} }
} }
inline void encodeNumber(int numberToEncode, string & output) { inline void encodeNumber(int numberToEncode, std::string & output) {
while (numberToEncode >= 0x20) { while (numberToEncode >= 0x20) {
int nextValue = (0x20 | (numberToEncode & 0x1f)) + 63; int nextValue = (0x20 | (numberToEncode & 0x1f)) + 63;
output += (static_cast<char> (nextValue)); output += (static_cast<char> (nextValue));
@ -57,8 +57,8 @@ private:
} }
public: public:
inline void printEncodedString(const vector<SegmentInformation>& polyline, string &output) { inline void printEncodedString(const std::vector<SegmentInformation>& polyline, std::string &output) {
vector<int> deltaNumbers; std::vector<int> deltaNumbers;
output += "\""; output += "\"";
if(!polyline.empty()) { if(!polyline.empty()) {
_Coordinate lastCoordinate = polyline[0].location; _Coordinate lastCoordinate = polyline[0].location;
@ -77,8 +77,8 @@ public:
} }
inline void printEncodedString(const vector<_Coordinate>& polyline, string &output) { inline void printEncodedString(const std::vector<_Coordinate>& polyline, std::string &output) {
vector<int> deltaNumbers(2*polyline.size()); std::vector<int> deltaNumbers(2*polyline.size());
output += "\""; output += "\"";
if(!polyline.empty()) { if(!polyline.empty()) {
deltaNumbers[0] = polyline[0].lat; deltaNumbers[0] = polyline[0].lat;
@ -92,9 +92,9 @@ public:
output += "\""; output += "\"";
} }
inline void printUnencodedString(vector<_Coordinate> & polyline, string & output) { inline void printUnencodedString(std::vector<_Coordinate> & polyline, std::string & output) {
output += "["; output += "[";
string tmp; std::string tmp;
for(unsigned i = 0; i < polyline.size(); i++) { for(unsigned i = 0; i < polyline.size(); i++) {
convertInternalLatLonToString(polyline[i].lat, tmp); convertInternalLatLonToString(polyline[i].lat, tmp);
output += "["; output += "[";
@ -110,9 +110,9 @@ public:
output += "]"; output += "]";
} }
inline void printUnencodedString(vector<SegmentInformation> & polyline, string & output) { inline void printUnencodedString(std::vector<SegmentInformation> & polyline, std::string & output) {
output += "["; output += "[";
string tmp; std::string tmp;
for(unsigned i = 0; i < polyline.size(); i++) { for(unsigned i = 0; i < polyline.size(); i++) {
if(!polyline[i].necessary) if(!polyline[i].necessary)
continue; continue;

View File

@ -46,7 +46,7 @@ struct _Node : NodeInfo{
return _Node(0,0,0, false, false); return _Node(0,0,0, false, false);
} }
static _Node max_value() { static _Node max_value() {
return _Node((numeric_limits<int>::max)(), (numeric_limits<int>::max)(), (numeric_limits<unsigned int>::max)(), false, false); return _Node((std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)(), (std::numeric_limits<unsigned int>::max)(), false, false);
} }
NodeID key() const { NodeID key() const {
return id; return id;

View File

@ -241,7 +241,7 @@ public:
} }
} }
_Coordinate tmp; _Coordinate tmp;
double dist = (numeric_limits<double>::max)(); double dist = (std::numeric_limits<double>::max)();
BOOST_FOREACH(_GridEdge candidate, candidates) { BOOST_FOREACH(_GridEdge candidate, candidates) {
double r = 0.; double r = 0.;
double tmpDist = ComputeDistance(inputCoordinate, candidate.startCoord, candidate.targetCoord, tmp, &r); double tmpDist = ComputeDistance(inputCoordinate, candidate.startCoord, candidate.targetCoord, tmp, &r);
@ -265,7 +265,7 @@ public:
} }
} }
_Coordinate tmp; _Coordinate tmp;
double dist = (numeric_limits<double>::max)(); double dist = (std::numeric_limits<double>::max)();
BOOST_FOREACH(_GridEdge candidate, candidates) { BOOST_FOREACH(_GridEdge candidate, candidates) {
double r = 0.; double r = 0.;
double tmpDist = ComputeDistance(startCoord, candidate.startCoord, candidate.targetCoord, tmp, &r); double tmpDist = ComputeDistance(startCoord, candidate.startCoord, candidate.targetCoord, tmp, &r);
@ -300,12 +300,12 @@ private:
} }
unsigned FillCell(std::vector<GridEntry>& entriesWithSameRAMIndex, const unsigned long fileOffset ) { unsigned FillCell(std::vector<GridEntry>& entriesWithSameRAMIndex, const unsigned long fileOffset ) {
vector<char> tmpBuffer(32*32*4096,0); std::vector<char> tmpBuffer(32*32*4096,0);
unsigned long indexIntoTmpBuffer = 0; unsigned long indexIntoTmpBuffer = 0;
unsigned numberOfWrittenBytes = 0; unsigned numberOfWrittenBytes = 0;
assert(indexOutFile.is_open()); assert(indexOutFile.is_open());
vector<unsigned long> cellIndex(32*32,ULONG_MAX); std::vector<unsigned long> cellIndex(32*32,ULONG_MAX);
boost::unordered_map< unsigned, unsigned, IdenticalHashFunction > cellMap(1024); boost::unordered_map< unsigned, unsigned, IdenticalHashFunction > cellMap(1024);
unsigned ramIndex = entriesWithSameRAMIndex.begin()->ramIndex; unsigned ramIndex = entriesWithSameRAMIndex.begin()->ramIndex;
@ -355,7 +355,7 @@ private:
return numberOfWrittenBytes; return numberOfWrittenBytes;
} }
unsigned FlushEntriesWithSameFileIndexToBuffer( std::vector<GridEntry> &vectorWithSameFileIndex, vector<char> & tmpBuffer, const unsigned long index) { unsigned FlushEntriesWithSameFileIndexToBuffer( std::vector<GridEntry> &vectorWithSameFileIndex, std::vector<char> & tmpBuffer, const unsigned long index) {
tmpBuffer.resize(tmpBuffer.size()+(sizeof(_GridEdge)*vectorWithSameFileIndex.size()) + sizeof(unsigned) ); tmpBuffer.resize(tmpBuffer.size()+(sizeof(_GridEdge)*vectorWithSameFileIndex.size()) + sizeof(unsigned) );
unsigned counter = 0; unsigned counter = 0;
@ -524,8 +524,8 @@ private:
const static unsigned long END_OF_BUCKET_DELIMITER = UINT_MAX; const static unsigned long END_OF_BUCKET_DELIMITER = UINT_MAX;
ofstream indexOutFile; std::ofstream indexOutFile;
ifstream ramInFile; std::ifstream ramInFile;
#ifndef ROUTED #ifndef ROUTED
stxxl::vector<GridEntry> entries; stxxl::vector<GridEntry> entries;
#endif #endif

View File

@ -39,10 +39,10 @@ struct NodeCoords {
NodeT id; NodeT id;
static NodeCoords<NodeT> min_value() { static NodeCoords<NodeT> min_value() {
return NodeCoords<NodeT>(-90*100000,-180*100000,numeric_limits<NodeT>::min()); return NodeCoords<NodeT>(-90*100000,-180*100000,std::numeric_limits<NodeT>::min());
} }
static NodeCoords<NodeT> max_value() { static NodeCoords<NodeT> max_value() {
return NodeCoords<NodeT>(90*100000, 180*100000, numeric_limits<NodeT>::max()); return NodeCoords<NodeT>(90*100000, 180*100000, std::numeric_limits<NodeT>::max());
} }
value_type operator[](std::size_t n) const { value_type operator[](std::size_t n) const {

View File

@ -56,7 +56,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
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(_Node));
int2ExtNodeMap->push_back(NodeInfo(node.lat, node.lon, node.id)); int2ExtNodeMap->push_back(NodeInfo(node.lat, node.lon, node.id));
ext2IntNodeMap.insert(make_pair(node.id, i)); ext2IntNodeMap.insert(std::make_pair(node.id, i));
if(node.bollard) if(node.bollard)
bollardNodes.push_back(i); bollardNodes.push_back(i);
if(node.trafficLight) if(node.trafficLight)
@ -162,7 +162,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
return n; return n;
} }
template<typename EdgeT> template<typename EdgeT>
NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<NodeInfo> * int2ExtNodeMap) { NodeID readDTMPGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeList, std::vector<NodeInfo> * int2ExtNodeMap) {
NodeID n, source, target, id; NodeID n, source, target, id;
EdgeID m; EdgeID m;
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open) int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
@ -172,7 +172,7 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
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(std::make_pair(id, i));
} }
in >> m; in >> m;
DEBUG(" and " << m << " edges"); DEBUG(" and " << m << " edges");
@ -269,13 +269,13 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
edgeList.push_back(inputEdge); edgeList.push_back(inputEdge);
} }
ext2IntNodeMap.clear(); ext2IntNodeMap.clear();
vector<ImportEdge>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates. std::vector<ImportEdge>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
cout << "ok" << endl; std::cout << "ok" << std::endl;
return n; return n;
} }
template<typename EdgeT> template<typename EdgeT>
NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<NodeID> & int2ExtNodeMap) { NodeID readDDSGGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeList, std::vector<NodeID> & int2ExtNodeMap) {
ExternalNodeMap nodeMap; ExternalNodeMap nodeMap;
NodeID n, source, target; NodeID n, source, target;
unsigned numberOfNodes = 0; unsigned numberOfNodes = 0;
@ -319,14 +319,14 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
EdgeT inputEdge(source, target, 0, weight, forward, backward, 1 ); EdgeT inputEdge(source, target, 0, weight, forward, backward, 1 );
edgeList.push_back(inputEdge); edgeList.push_back(inputEdge);
} }
vector<EdgeT>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates. std::vector<EdgeT>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
nodeMap.clear(); nodeMap.clear();
return numberOfNodes; return numberOfNodes;
} }
template<typename NodeT, typename EdgeT> template<typename NodeT, typename EdgeT>
unsigned readHSGRFromStream(istream &in, vector<NodeT>& nodeList, vector<EdgeT> & edgeList, unsigned * checkSum) { unsigned readHSGRFromStream(std::istream &in, std::vector<NodeT>& nodeList, std::vector<EdgeT> & edgeList, unsigned * checkSum) {
unsigned numberOfNodes = 0; unsigned numberOfNodes = 0;
in.read((char*) checkSum, sizeof(unsigned)); in.read((char*) checkSum, sizeof(unsigned));
in.read((char*) & numberOfNodes, sizeof(unsigned)); in.read((char*) & numberOfNodes, sizeof(unsigned));

View File

@ -29,13 +29,13 @@ std::string NasaGridSquare::make_filename(const char* ext) const {
char EW =(longitude>=0 ? 'E' : 'W' ); char EW =(longitude>=0 ? 'E' : 'W' );
char NS =(latitude >=0 ? 'N' : 'S'); char NS =(latitude >=0 ? 'N' : 'S');
std::stringstream ss; std::stringstream ss;
ss<<setfill('0') ss<<std::setfill('0')
<< ROOT_PATH << ROOT_PATH
<< "/" << "/"
<<NS <<NS
<<setw(2)<<abs(latitude)<<setw(0) <<std::setw(2)<<std::abs(latitude)<<std::setw(0)
<<EW <<EW
<<setw(3)<<abs(longitude)<<setw(0) <<std::setw(3)<<std::abs(longitude)<<std::setw(0)
<<'.'<<ext; <<'.'<<ext;
return ss.str(); return ss.str();
} }

View File

@ -39,8 +39,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "Util/LinuxStackTrace.h" #include "Util/LinuxStackTrace.h"
#endif #endif
using namespace std;
typedef http::RequestHandler RequestHandler; typedef http::RequestHandler RequestHandler;
#ifdef _WIN32 #ifdef _WIN32