From 17f32f4ca14fac451c54a9336a1167f45537e03e Mon Sep 17 00:00:00 2001 From: Tomonobu Saito Date: Wed, 9 Oct 2019 13:35:19 +0900 Subject: [PATCH] fix coding format --- include/extractor/raster_source.hpp | 40 +++++++++++++++++------------ include/storage/io.hpp | 22 +++++++++++----- src/extractor/raster_source.cpp | 6 +++-- 3 files changed, 42 insertions(+), 26 deletions(-) mode change 100755 => 100644 include/extractor/raster_source.hpp mode change 100755 => 100644 src/extractor/raster_source.cpp diff --git a/include/extractor/raster_source.hpp b/include/extractor/raster_source.hpp old mode 100755 new mode 100644 index 48d69d4c4..939b3ee60 --- a/include/extractor/raster_source.hpp +++ b/include/extractor/raster_source.hpp @@ -4,22 +4,22 @@ #include "util/coordinate.hpp" #include "util/exception.hpp" -#include #include +#include #include #include #include +#include #include #include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include using namespace std; namespace osrm @@ -58,17 +58,21 @@ class RasterGrid buf.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11 BOOST_ASSERT(xdim * 11 <= buf.size()); - for (unsigned int y = 0 ; y < ydim ; y++) { + for (unsigned int y = 0; y < ydim; y++) + { // read one line from file. file_reader.ReadLine(&buf[0], xdim * 11); boost::algorithm::trim(buf); std::vector result; - boost::split(result, buf, boost::is_any_of(" \r\n\0"), boost::algorithm::token_compress_on); - //boost::split(result, buf, boost::is_any_of(" \r\n\0")); + boost::split( + result, buf, boost::is_any_of(" \r\n\0"), boost::algorithm::token_compress_on); + // boost::split(result, buf, boost::is_any_of(" \r\n\0")); unsigned int x = 0; - BOOST_FOREACH(std::string s, result) { - if (x < xdim) _data[(y * xdim) + x] = atoi(s.c_str()); + BOOST_FOREACH (std::string s, result) + { + if (x < xdim) + _data[(y * xdim) + x] = atoi(s.c_str()); ++x; } BOOST_ASSERT(x == xdim); @@ -146,18 +150,20 @@ class RasterContainer // << singletone >> RasterCache class RasterCache { -public: + public: // class method to get the instance - static RasterCache& getInstance() { - if (NULL == g_instance) { + static RasterCache &getInstance() + { + if (NULL == g_instance) + { g_instance = new RasterCache(); } return *g_instance; } // get reference of cache - std::vector& getLoadedSources() { return LoadedSources; } - std::unordered_map& getLoadedSourcePaths() { return LoadedSourcePaths; } -private: + std::vector &getLoadedSources() { return LoadedSources; } + std::unordered_map &getLoadedSourcePaths() { return LoadedSourcePaths; } + private: // constructor RasterCache() = default; // member diff --git a/include/storage/io.hpp b/include/storage/io.hpp index 0a6eb0775..8635bd2c9 100644 --- a/include/storage/io.hpp +++ b/include/storage/io.hpp @@ -62,20 +62,28 @@ class FileReader std::size_t GetSize() { const boost::filesystem::path path(filepath); - try { - return std::size_t(boost::filesystem::file_size(path)) - ((fingerprint == FingerprintFlag::VerifyFingerprint) ? sizeof(util::FingerPrint) : 0); + try + { + return std::size_t(boost::filesystem::file_size(path)) - + ((fingerprint == FingerprintFlag::VerifyFingerprint) ? sizeof(util::FingerPrint) + : 0); } - catch (boost::filesystem::filesystem_error& ex) { + catch (boost::filesystem::filesystem_error &ex) + { std::cout << ex.what() << std::endl; throw; } } /* Read one line */ - template void ReadLine(T *dest, const std::size_t count) { - if (0 < count) { - const auto &ios = input_stream.getline(reinterpret_cast(dest), count * sizeof(T)); - for (std::size_t n = ios.gcount(); n < count; ++n) { + template void ReadLine(T *dest, const std::size_t count) + { + if (0 < count) + { + const auto &ios = + input_stream.getline(reinterpret_cast(dest), count * sizeof(T)); + for (std::size_t n = ios.gcount(); n < count; ++n) + { reinterpret_cast(dest)[n] = '\0'; } } diff --git a/src/extractor/raster_source.cpp b/src/extractor/raster_source.cpp old mode 100755 new mode 100644 index 5b69ebd56..10b517ef7 --- a/src/extractor/raster_source.cpp +++ b/src/extractor/raster_source.cpp @@ -130,7 +130,8 @@ RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, dou if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1) { throw util::exception("Attempted to access source " + std::to_string(source_id) + - ", but there are only " + std::to_string(RasterCache::getInstance().getLoadedSources().size()) + + ", but there are only " + + std::to_string(RasterCache::getInstance().getLoadedSources().size()) + " loaded" + SOURCE_REF); } @@ -151,7 +152,8 @@ RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1) { throw util::exception("Attempted to access source " + std::to_string(source_id) + - ", but there are only " + std::to_string(RasterCache::getInstance().getLoadedSources().size()) + + ", but there are only " + + std::to_string(RasterCache::getInstance().getLoadedSources().size()) + " loaded" + SOURCE_REF); }