Main MRPT website > C++ reference for MRPT 1.9.9
io/CFileGZOutputStream.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/io/CStream.h>
12 
13 namespace mrpt
14 {
15 namespace io
16 {
17 /** Saves data to a file and transparently compress the data using the given
18  * compression level.
19  * The generated files are in gzip format ("file.gz").
20  * This class requires compiling MRPT with wxWidgets. If wxWidgets is not
21  * available then the class is actually mapped to the standard CFileOutputStream
22  *
23  * \sa CFileOutputStream
24  * \ingroup mrpt_io_grp
25  */
27 {
28  private:
29  void* m_f;
30 
31  public:
32  /** Constructor: opens an output file with compression level = 1 (minimum,
33  * fastest).
34  * \param fileName The file to be open in this stream
35  * \sa open
36  */
37  CFileGZOutputStream(const std::string& fileName);
38 
39  /** Constructor, without opening the file.
40  * \sa open
41  */
43 
46 
47  /** Destructor */
48  virtual ~CFileGZOutputStream();
49 
50  /** Open a file for write, choosing the compression level
51  * \param fileName The file to be open in this stream
52  * \param compress_level 0:no compression, 1:fastest, 9:best
53  * \return true on success, false on any error.
54  */
55  bool open(const std::string& fileName, int compress_level = 1);
56  /** Close the file */
57  void close();
58  /** Returns true if the file was open without errors. */
59  bool fileOpenCorrectly() const;
60  /** Returns true if the file was open without errors. */
61  bool is_open() { return fileOpenCorrectly(); }
62  /** Method for getting the current cursor position, where 0 is the first
63  * byte and TotalBytesCount-1 the last one. */
64  uint64_t getPosition() const override;
65 
66  /** This method is not implemented in this class */
68  /** This method is not implemented in this class */
69  uint64_t getTotalBytesCount() const override;
70  size_t Read(void* Buffer, size_t Count) override;
71  size_t Write(const void* Buffer, size_t Count) override;
72 }; // End of class def.
73 static_assert(
76  "Copy Check");
77 } // End of namespace
78 } // end of namespace
mrpt::io::CStream::TSeekOrigin
TSeekOrigin
Used in CStream::Seek.
Definition: io/CStream.h:34
mrpt::io::CFileGZOutputStream::operator=
CFileGZOutputStream & operator=(const CFileGZOutputStream &)=delete
mrpt::io::CFileGZOutputStream::Write
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
Definition: CFileGZOutputStream.cpp:60
mrpt::io::CFileGZOutputStream::getPosition
uint64_t getPosition() const override
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
Definition: CFileGZOutputStream.cpp:69
int64_t
__int64 int64_t
Definition: rptypes.h:49
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::io::CFileGZOutputStream::m_f
void * m_f
Definition: io/CFileGZOutputStream.h:29
mrpt::io::CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level.
Definition: io/CFileGZOutputStream.h:26
mrpt::io::CFileGZOutputStream::CFileGZOutputStream
CFileGZOutputStream()
Constructor, without opening the file.
Definition: CFileGZOutputStream.cpp:31
mrpt::io::CStream::sFromBeginning
@ sFromBeginning
Definition: io/CStream.h:36
uint64_t
unsigned __int64 uint64_t
Definition: rptypes.h:50
mrpt::io::CFileGZOutputStream::~CFileGZOutputStream
virtual ~CFileGZOutputStream()
Destructor.
Definition: CFileGZOutputStream.cpp:45
mrpt::io::CFileGZOutputStream::getTotalBytesCount
uint64_t getTotalBytesCount() const override
This method is not implemented in this class.
Definition: CFileGZOutputStream.cpp:84
CStream.h
mrpt::io::CFileGZOutputStream::fileOpenCorrectly
bool fileOpenCorrectly() const
Returns true if the file was open without errors.
Definition: CFileGZOutputStream.cpp:78
mrpt::io::CFileGZOutputStream::close
void close()
Close the file.
Definition: CFileGZOutputStream.cpp:46
mrpt::io::CFileGZOutputStream::open
bool open(const std::string &fileName, int compress_level=1)
Open a file for write, choosing the compression level.
Definition: CFileGZOutputStream.cpp:32
value
GLsizei const GLfloat * value
Definition: glext.h:4117
mrpt::io::CFileGZOutputStream::is_open
bool is_open()
Returns true if the file was open without errors.
Definition: io/CFileGZOutputStream.h:61
mrpt::io::CFileGZOutputStream::Seek
uint64_t Seek(int64_t, CStream::TSeekOrigin=sFromBeginning) override
This method is not implemented in this class.
Definition: CFileGZOutputStream.cpp:79
mrpt::io::CFileGZOutputStream::Read
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream.
Definition: CFileGZOutputStream.cpp:55
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::io::CStream
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: io/CStream.h:30



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST