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::io
14 {
15 /** Saves data to a file and transparently compress the data using the given
16  * compression level.
17  * The generated files are in gzip format ("file.gz").
18  * This class requires compiling MRPT with wxWidgets. If wxWidgets is not
19  * available then the class is actually mapped to the standard CFileOutputStream
20  *
21  * \sa CFileOutputStream
22  * \ingroup mrpt_io_grp
23  */
25 {
26  private:
27  void* m_f;
28 
29  public:
30  /** Constructor: opens an output file with compression level = 1 (minimum,
31  * fastest).
32  * \param fileName The file to be open in this stream
33  * \sa open
34  */
35  CFileGZOutputStream(const std::string& fileName);
36 
37  /** Constructor, without opening the file.
38  * \sa open
39  */
41 
44 
45  /** Destructor */
46  virtual ~CFileGZOutputStream();
47 
48  /** Open a file for write, choosing the compression level
49  * \param fileName The file to be open in this stream
50  * \param compress_level 0:no compression, 1:fastest, 9:best
51  * \return true on success, false on any error.
52  */
53  bool open(const std::string& fileName, int compress_level = 1);
54  /** Close the file */
55  void close();
56  /** Returns true if the file was open without errors. */
57  bool fileOpenCorrectly() const;
58  /** Returns true if the file was open without errors. */
59  bool is_open() { return fileOpenCorrectly(); }
60  /** Method for getting the current cursor position, where 0 is the first
61  * byte and TotalBytesCount-1 the last one. */
62  uint64_t getPosition() const override;
63 
64  /** This method is not implemented in this class */
66  /** This method is not implemented in this class */
67  uint64_t getTotalBytesCount() const override;
68  size_t Read(void* Buffer, size_t Count) override;
69  size_t Write(const void* Buffer, size_t Count) override;
70 }; // End of class def.
71 static_assert(
74  "Copy Check");
75 }
76 
TSeekOrigin
Used in CStream::Seek.
Definition: io/CStream.h:32
virtual ~CFileGZOutputStream()
Destructor.
uint64_t getPosition() const override
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
bool fileOpenCorrectly() const
Returns true if the file was open without errors.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: io/CStream.h:28
__int64 int64_t
Definition: rptypes.h:49
GLsizei const GLchar ** string
Definition: glext.h:4101
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream.
uint64_t getTotalBytesCount() const override
This method is not implemented in this class.
unsigned __int64 uint64_t
Definition: rptypes.h:50
bool is_open()
Returns true if the file was open without errors.
CFileGZOutputStream & operator=(const CFileGZOutputStream &)=delete
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
uint64_t Seek(int64_t, CStream::TSeekOrigin=sFromBeginning) override
This method is not implemented in this class.
CFileGZOutputStream()
Constructor, without opening the file.
GLsizei const GLfloat * value
Definition: glext.h:4117
bool open(const std::string &fileName, int compress_level=1)
Open a file for write, choosing the compression level.
Saves data to a file and transparently compress the data using the given compression level...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020