Skip to content

Commit 17f32f4

Browse files
Tomonobu SaitoTomonobu Saito
authored andcommitted
fix coding format
1 parent 542c3ba commit 17f32f4

File tree

3 files changed

+41
-25
lines changed

3 files changed

+41
-25
lines changed

include/extractor/raster_source.hpp

100755100644
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
#include "util/coordinate.hpp"
55
#include "util/exception.hpp"
66

7-
#include <boost/algorithm/string/trim.hpp>
87
#include <boost/algorithm/string.hpp>
8+
#include <boost/algorithm/string/trim.hpp>
99
#include <boost/assert.hpp>
1010
#include <boost/filesystem.hpp>
1111
#include <boost/filesystem/fstream.hpp>
12+
#include <boost/foreach.hpp>
1213
#include <boost/spirit/include/qi.hpp>
1314
#include <boost/spirit/include/qi_int.hpp>
14-
#include <boost/foreach.hpp>
1515

1616
#include <storage/io.hpp>
1717

18+
#include <iostream>
1819
#include <iterator>
19-
#include <unordered_map>
20-
#include <string>
2120
#include <list>
22-
#include <iostream>
21+
#include <string>
22+
#include <unordered_map>
2323
using namespace std;
2424

2525
namespace osrm
@@ -58,17 +58,21 @@ class RasterGrid
5858
buf.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11
5959
BOOST_ASSERT(xdim * 11 <= buf.size());
6060

61-
for (unsigned int y = 0 ; y < ydim ; y++) {
61+
for (unsigned int y = 0; y < ydim; y++)
62+
{
6263
// read one line from file.
6364
file_reader.ReadLine(&buf[0], xdim * 11);
6465
boost::algorithm::trim(buf);
6566

6667
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"));
6971
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());
7276
++x;
7377
}
7478
BOOST_ASSERT(x == xdim);
@@ -146,18 +150,20 @@ class RasterContainer
146150
// << singletone >> RasterCache
147151
class RasterCache
148152
{
149-
public:
153+
public:
150154
// 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+
{
153159
g_instance = new RasterCache();
154160
}
155161
return *g_instance;
156162
}
157163
// 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:
161167
// constructor
162168
RasterCache() = default;
163169
// member

include/storage/io.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,28 @@ class FileReader
6262
std::size_t GetSize()
6363
{
6464
const boost::filesystem::path path(filepath);
65-
try {
66-
return std::size_t(boost::filesystem::file_size(path)) - ((fingerprint == FingerprintFlag::VerifyFingerprint) ? sizeof(util::FingerPrint) : 0);
65+
try
66+
{
67+
return std::size_t(boost::filesystem::file_size(path)) -
68+
((fingerprint == FingerprintFlag::VerifyFingerprint) ? sizeof(util::FingerPrint)
69+
: 0);
6770
}
68-
catch (boost::filesystem::filesystem_error& ex) {
71+
catch (boost::filesystem::filesystem_error &ex)
72+
{
6973
std::cout << ex.what() << std::endl;
7074
throw;
7175
}
7276
}
7377

7478
/* Read one line */
75-
template <typename T> void ReadLine(T *dest, const std::size_t count) {
76-
if (0 < count) {
77-
const auto &ios = input_stream.getline(reinterpret_cast<char *>(dest), count * sizeof(T));
78-
for (std::size_t n = ios.gcount(); n < count; ++n) {
79+
template <typename T> void ReadLine(T *dest, const std::size_t count)
80+
{
81+
if (0 < count)
82+
{
83+
const auto &ios =
84+
input_stream.getline(reinterpret_cast<char *>(dest), count * sizeof(T));
85+
for (std::size_t n = ios.gcount(); n < count; ++n)
86+
{
7987
reinterpret_cast<char *>(dest)[n] = '\0';
8088
}
8189
}

src/extractor/raster_source.cpp

100755100644
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, dou
130130
if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
131131
{
132132
throw util::exception("Attempted to access source " + std::to_string(source_id) +
133-
", but there are only " + std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
133+
", but there are only " +
134+
std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
134135
" loaded" + SOURCE_REF);
135136
}
136137

@@ -151,7 +152,8 @@ RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l
151152
if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
152153
{
153154
throw util::exception("Attempted to access source " + std::to_string(source_id) +
154-
", but there are only " + std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
155+
", but there are only " +
156+
std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
155157
" loaded" + SOURCE_REF);
156158
}
157159

0 commit comments

Comments
 (0)