Improvement of raster source loading to reduce consumed memory size.

This commit is contained in:
Tomonobu Saito
2019-10-03 16:44:27 +09:00
parent 62c8b70f78
commit d316ff9d41
3 changed files with 62 additions and 5 deletions
+13 -1
View File
@@ -69,7 +69,10 @@ class FileReader
std::cout << ex.what() << std::endl;
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();
@@ -94,7 +97,16 @@ class FileReader
{
return file_size;
}
*/
}
*/
/* Read one line */
template <typename T> void ReadLine(T *dest, const std::size_t count) {
if (0 < count) {
const auto &ios = input_stream.getline(reinterpret_cast<char *>(dest), count * sizeof(T));
for (std::size_t n = ios.gcount(); n < count; ++n) {
reinterpret_cast<char *>(dest)[n] = '\0';
}
}
}
/* Read count objects of type T into pointer dest */