13 #define _SCL_SECURE_NO_WARNINGS 19 #if MRPT_HAS_GZ_STREAMS 23 #define THE_GZFILE reinterpret_cast<gzFile>(m_f) 36 "Error trying to open file: '%s'", fileName.c_str());
47 bool CFileGZOutputStream::open(
const string& fileName,
int compress_level)
54 m_f = gzopen(fileName.c_str(),
format(
"wb%i", compress_level).c_str());
55 return m_f !=
nullptr;
63 CFileGZOutputStream::~CFileGZOutputStream() { close(); }
67 void CFileGZOutputStream::close()
80 size_t CFileGZOutputStream::Read(
void* Buffer,
size_t Count)
91 size_t CFileGZOutputStream::Write(
const void* Buffer,
size_t Count)
97 return gzwrite(
THE_GZFILE, const_cast<void*>(Buffer), Count);
103 uint64_t CFileGZOutputStream::getPosition()
115 bool CFileGZOutputStream::fileOpenCorrectly() {
return m_f !=
nullptr; }
116 #endif // MRPT_HAS_GZ_STREAMS Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
unsigned __int64 uint64_t
#define CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level...