remove unused lines

This commit is contained in:
Tomonobu Saito 2019-10-03 17:24:42 +09:00
parent d316ff9d41
commit e4aaf07879
3 changed files with 4 additions and 75 deletions

View File

@ -50,13 +50,13 @@ class RasterGrid
xdim = _xdim; xdim = _xdim;
ydim = _ydim; ydim = _ydim;
_data.reserve(ydim * xdim); _data.reserve(ydim * xdim);
BOOST_ASSERT(_data.capacity() >= ydim * xdim); BOOST_ASSERT(ydim * xdim <= _data.capacity());
// Construct FileReader // Construct FileReader
storage::io::FileReader file_reader(filepath, storage::io::FileReader::HasNoFingerprint); storage::io::FileReader file_reader(filepath, storage::io::FileReader::HasNoFingerprint);
std::string buf; std::string buf;
buf.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11 buf.resize(xdim * 11); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11
BOOST_ASSERT(buf.size() >= xdim * 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. // read one line from file.
@ -74,37 +74,6 @@ class RasterGrid
} }
BOOST_ASSERT(x == xdim); BOOST_ASSERT(x == xdim);
} }
/*
std::string buffer;
buffer.resize(file_reader.GetSize());
BOOST_ASSERT(buffer.size() > 1);
file_reader.ReadInto(&buffer[0], buffer.size());
boost::algorithm::trim(buffer);
auto itr = buffer.begin();
auto end = buffer.end();
bool r = false;
try
{
r = boost::spirit::qi::parse(
itr, end, +boost::spirit::qi::int_ % +boost::spirit::qi::space, _data);
}
catch (std::exception const &ex)
{
throw util::exception("Failed to read from raster source " + filepath.string() + ": " +
ex.what() + SOURCE_REF);
}
if (!r || itr != end)
{
throw util::exception("Failed to parse raster source: " + filepath.string() +
SOURCE_REF);
}
*/
} }
RasterGrid(const RasterGrid &) = default; RasterGrid(const RasterGrid &) = default;

View File

@ -70,35 +70,7 @@ class FileReader
throw; throw;
} }
} }
/*
std::size_t GetSize()
{
const boost::filesystem::ifstream::pos_type position = input_stream.tellg();
input_stream.seekg(0, std::ios::end);
const boost::filesystem::ifstream::pos_type file_size = input_stream.tellg();
if (file_size == boost::filesystem::ifstream::pos_type(-1))
{
throw util::RuntimeError("Unable to determine file size for " +
std::string(filepath.string()),
ErrorCode::FileIOError,
SOURCE_REF,
std::strerror(errno));
}
// restore the current position
input_stream.seekg(position, std::ios::beg);
if (fingerprint == FingerprintFlag::VerifyFingerprint)
{
return std::size_t(file_size) - sizeof(util::FingerPrint);
}
else
{
return file_size;
}
}
*/
/* Read one line */ /* Read one line */
template <typename T> void ReadLine(T *dest, const std::size_t count) { template <typename T> void ReadLine(T *dest, const std::size_t count) {
if (0 < count) { if (0 < count) {

View File

@ -95,13 +95,7 @@ int RasterContainer::LoadRasterSource(const std::string &path_string,
const auto _xmax = static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{xmax})); const auto _xmax = static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{xmax}));
const auto _ymin = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymin})); const auto _ymin = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymin}));
const auto _ymax = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymax})); const auto _ymax = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymax}));
/*
// for debug : list up all keys and values
util::Log() << "Num of Raster Sources : " << LoadedSourcePaths.size();
for (auto i = LoadedSourcePaths.begin(); i != LoadedSourcePaths.end(); ++i) {
util::Log() << "Key : " << i->first << " Value: " << i->second;
}
*/
const auto itr = LoadedSourcePaths.find(path_string); const auto itr = LoadedSourcePaths.find(path_string);
if (itr != LoadedSourcePaths.end()) if (itr != LoadedSourcePaths.end())
{ {
@ -130,13 +124,7 @@ int RasterContainer::LoadRasterSource(const std::string &path_string,
LoadedSources.push_back(std::move(source)); LoadedSources.push_back(std::move(source));
util::Log() << "[source loader] ok, after " << TIMER_SEC(loading_source) << "s"; util::Log() << "[source loader] ok, after " << TIMER_SEC(loading_source) << "s";
/*
// for debug : list up all keys and values
util::Log() << "Num of Raster Sources : " << LoadedSourcePaths.size();
for (auto i = LoadedSourcePaths.begin(); i != LoadedSourcePaths.end(); ++i) {
util::Log() << "Key : " << i->first << " Value: " << i->second;
}
*/
return source_id; return source_id;
} }