|
4 | 4 | #include "util/coordinate.hpp" |
5 | 5 | #include "util/exception.hpp" |
6 | 6 |
|
7 | | -#include <boost/algorithm/string/trim.hpp> |
8 | 7 | #include <boost/algorithm/string.hpp> |
| 8 | +#include <boost/algorithm/string/trim.hpp> |
9 | 9 | #include <boost/assert.hpp> |
10 | 10 | #include <boost/filesystem.hpp> |
11 | 11 | #include <boost/filesystem/fstream.hpp> |
| 12 | +#include <boost/foreach.hpp> |
12 | 13 | #include <boost/spirit/include/qi.hpp> |
13 | 14 | #include <boost/spirit/include/qi_int.hpp> |
14 | | -#include <boost/foreach.hpp> |
15 | 15 |
|
16 | 16 | #include <storage/io.hpp> |
17 | 17 |
|
| 18 | +#include <iostream> |
18 | 19 | #include <iterator> |
19 | | -#include <unordered_map> |
20 | | -#include <string> |
21 | 20 | #include <list> |
22 | | -#include <iostream> |
| 21 | +#include <string> |
| 22 | +#include <unordered_map> |
23 | 23 | using namespace std; |
24 | 24 |
|
25 | 25 | namespace osrm |
@@ -58,17 +58,21 @@ class RasterGrid |
58 | 58 | buf.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11 |
59 | 59 | BOOST_ASSERT(xdim * 11 <= buf.size()); |
60 | 60 |
|
61 | | - for (unsigned int y = 0 ; y < ydim ; y++) { |
| 61 | + for (unsigned int y = 0; y < ydim; y++) |
| 62 | + { |
62 | 63 | // read one line from file. |
63 | 64 | file_reader.ReadLine(&buf[0], xdim * 11); |
64 | 65 | boost::algorithm::trim(buf); |
65 | 66 |
|
66 | 67 | std::vector<std::string> result; |
67 | | - boost::split(result, buf, boost::is_any_of(" \r\n\0"), boost::algorithm::token_compress_on); |
68 | | - //boost::split(result, buf, boost::is_any_of(" \r\n\0")); |
| 68 | + boost::split( |
| 69 | + result, buf, boost::is_any_of(" \r\n\0"), boost::algorithm::token_compress_on); |
| 70 | + // boost::split(result, buf, boost::is_any_of(" \r\n\0")); |
69 | 71 | unsigned int x = 0; |
70 | | - BOOST_FOREACH(std::string s, result) { |
71 | | - if (x < xdim) _data[(y * xdim) + x] = atoi(s.c_str()); |
| 72 | + BOOST_FOREACH (std::string s, result) |
| 73 | + { |
| 74 | + if (x < xdim) |
| 75 | + _data[(y * xdim) + x] = atoi(s.c_str()); |
72 | 76 | ++x; |
73 | 77 | } |
74 | 78 | BOOST_ASSERT(x == xdim); |
@@ -146,18 +150,20 @@ class RasterContainer |
146 | 150 | // << singletone >> RasterCache |
147 | 151 | class RasterCache |
148 | 152 | { |
149 | | -public: |
| 153 | + public: |
150 | 154 | // class method to get the instance |
151 | | - static RasterCache& getInstance() { |
152 | | - if (NULL == g_instance) { |
| 155 | + static RasterCache &getInstance() |
| 156 | + { |
| 157 | + if (NULL == g_instance) |
| 158 | + { |
153 | 159 | g_instance = new RasterCache(); |
154 | 160 | } |
155 | 161 | return *g_instance; |
156 | 162 | } |
157 | 163 | // get reference of cache |
158 | | - std::vector<RasterSource>& getLoadedSources() { return LoadedSources; } |
159 | | - std::unordered_map<std::string, int>& getLoadedSourcePaths() { return LoadedSourcePaths; } |
160 | | -private: |
| 164 | + std::vector<RasterSource> &getLoadedSources() { return LoadedSources; } |
| 165 | + std::unordered_map<std::string, int> &getLoadedSourcePaths() { return LoadedSourcePaths; } |
| 166 | + private: |
161 | 167 | // constructor |
162 | 168 | RasterCache() = default; |
163 | 169 | // member |
|
0 commit comments