17 #ifndef CARTOGRAPHER_COMMON_PORT_H_ 18 #define CARTOGRAPHER_COMMON_PORT_H_ 24 #include <boost/iostreams/device/back_inserter.hpp> 25 #include <boost/iostreams/filter/gzip.hpp> 26 #include <boost/iostreams/filtering_stream.hpp> 42 inline int RoundToInt(
const float x) {
return std::lround(x); }
44 inline int RoundToInt(
const double x) {
return std::lround(x); }
51 boost::iostreams::filtering_ostream out;
53 boost::iostreams::gzip_compressor(boost::iostreams::zlib::best_speed));
54 out.push(boost::iostreams::back_inserter(*compressed));
55 boost::iostreams::write(out,
56 reinterpret_cast<const char*>(uncompressed.data()),
61 boost::iostreams::filtering_ostream out;
62 out.push(boost::iostreams::gzip_decompressor());
63 out.push(boost::iostreams::back_inserter(*decompressed));
64 boost::iostreams::write(out, reinterpret_cast<const char*>(compressed.data()),
71 #endif // CARTOGRAPHER_COMMON_PORT_H_ void FastGzipString(const string &uncompressed, string *compressed)
int RoundToInt(const float x)
void FastGunzipString(const string &compressed, string *decompressed)
int64 RoundToInt64(const float x)