From 2b5e11071969aa10639feb3aec2007a72c93519c Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Sun, 6 Jan 2013 19:03:04 +0100 Subject: [PATCH] Splitting utility header with ambigious name into two files with better names --- DataStructures/MercatorUtil.h | 38 +++++++++++++++++++++++++ DataStructures/NNGrid.h | 4 +-- DataStructures/{Util.h => TimingUtil.h} | 26 ++--------------- Extractor/ExtractionContainers.h | 2 +- Extractor/ExtractorStructs.h | 2 +- Server/Connection.h | 1 - 6 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 DataStructures/MercatorUtil.h rename DataStructures/{Util.h => TimingUtil.h} (68%) diff --git a/DataStructures/MercatorUtil.h b/DataStructures/MercatorUtil.h new file mode 100644 index 000000000..15bea275a --- /dev/null +++ b/DataStructures/MercatorUtil.h @@ -0,0 +1,38 @@ +/* + open source routing machine + Copyright (C) Dennis Luxen, others 2010 + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +#ifndef MERCATORUTIL_H_ +#define MERCATORUTIL_H_ + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +inline double y2lat(double a) { + return 180/M_PI * (2 * atan(exp(a*M_PI/180)) - M_PI/2); +} + +inline double lat2y(double a) { + return 180/M_PI * log(tan(M_PI/4+a*(M_PI/180)/2)); +} + +#endif /* MERCATORUTIL_H_ */ diff --git a/DataStructures/NNGrid.h b/DataStructures/NNGrid.h index 1ee131317..365f59675 100644 --- a/DataStructures/NNGrid.h +++ b/DataStructures/NNGrid.h @@ -44,12 +44,12 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include "DeallocatingVector.h" -//#include "ExtractorStructs.h" #include "GridEdge.h" #include "Percent.h" #include "PhantomNodes.h" -#include "Util.h" +#include "MercatorUtil.h" #include "StaticGraph.h" +#include "TimingUtil.h" #include "../Algorithms/Bresenham.h" namespace NNGrid{ diff --git a/DataStructures/Util.h b/DataStructures/TimingUtil.h similarity index 68% rename from DataStructures/Util.h rename to DataStructures/TimingUtil.h index 8448e4ce6..6e980e26f 100644 --- a/DataStructures/Util.h +++ b/DataStructures/TimingUtil.h @@ -18,16 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. */ -#ifndef TIMEUTIL_H_ -#define TIMEUTIL_H_ +#ifndef TIMINGUTIL_H_ +#define TIMINGUTIL_H_ #include -#include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif #ifdef _WIN32 #include @@ -43,13 +39,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #endif -#ifdef _WIN32 - #include -#else - #include -#endif -#include - /** Returns a timestamp (now) in seconds (incl. a fractional part). */ static inline double get_timestamp() { struct timeval tp; @@ -57,14 +46,5 @@ static inline double get_timestamp() { return double(tp.tv_sec) + tp.tv_usec / 1000000.; } -static inline double y2lat(double a) { return 180/M_PI * (2 * atan(exp(a*M_PI/180)) - M_PI/2); } -static inline double lat2y(double a) { return 180/M_PI * log(tan(M_PI/4+a*(M_PI/180)/2)); } -static inline unsigned boost_thread_id_hash(boost::thread::id const& id) { - std::stringstream ostr; - ostr << id; - std::tr1::hash h; - return h(ostr.str()); -} - -#endif /* TIMEUTIL_H_ */ +#endif /* TIMINGUTIL_H_ */ diff --git a/Extractor/ExtractionContainers.h b/Extractor/ExtractionContainers.h index b683e7153..7e8a1d7be 100644 --- a/Extractor/ExtractionContainers.h +++ b/Extractor/ExtractionContainers.h @@ -25,7 +25,7 @@ #include #include "ExtractorStructs.h" -#include "../DataStructures/Util.h" +#include "../DataStructures/TimingUtil.h" class ExtractionContainers { public: diff --git a/Extractor/ExtractorStructs.h b/Extractor/ExtractorStructs.h index 36194f119..fe5dd1b40 100644 --- a/Extractor/ExtractorStructs.h +++ b/Extractor/ExtractorStructs.h @@ -34,7 +34,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "../DataStructures/ImportNode.h" #include "../DataStructures/NodeCoords.h" #include "../DataStructures/Restriction.h" -#include "../DataStructures/Util.h" +#include "../DataStructures/TimingUtil.h" #include "../typedefs.h" typedef boost::unordered_map StringMap; diff --git a/Server/Connection.h b/Server/Connection.h index ea1ebd933..5dd4b7913 100644 --- a/Server/Connection.h +++ b/Server/Connection.h @@ -30,7 +30,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include -#include "../DataStructures/Util.h" #include "BasicDatastructures.h" #include "RequestHandler.h" #include "RequestParser.h"