MRPT
2.0.4
|
Saves data to a file and transparently compress the data using the given compression level.
The generated files are in gzip format ("file.gz"). This class requires compiling MRPT with wxWidgets. If wxWidgets is not available then the class is actually mapped to the standard CFileOutputStream
Definition at line 26 of file io/CFileGZOutputStream.h.
#include <mrpt/io/CFileGZOutputStream.h>
Classes | |
struct | Impl |
Public Types | |
enum | TSeekOrigin { sFromBeginning = 0, sFromCurrent = 1, sFromEnd = 2 } |
Used in CStream::Seek. More... | |
Public Member Functions | |
CFileGZOutputStream (const std::string &fileName) | |
Constructor: opens an output file with compression level = 1 (minimum, fastest). More... | |
CFileGZOutputStream () | |
Constructor, without opening the file. More... | |
CFileGZOutputStream (const CFileGZOutputStream &)=delete | |
CFileGZOutputStream & | operator= (const CFileGZOutputStream &)=delete |
~CFileGZOutputStream () override | |
Destructor. More... | |
bool | open (const std::string &fileName, int compress_level=1, mrpt::optional_ref< std::string > error_msg=std::nullopt) |
Open a file for write, choosing the compression level. More... | |
void | close () |
Close the file. More... | |
bool | fileOpenCorrectly () const |
Returns true if the file was open without errors. More... | |
bool | is_open () |
Returns true if the file was open without errors. More... | |
uint64_t | getPosition () const override |
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one. More... | |
uint64_t | Seek (int64_t, CStream::TSeekOrigin=sFromBeginning) override |
This method is not implemented in this class. More... | |
uint64_t | getTotalBytesCount () const override |
This method is not implemented in this class. More... | |
size_t | Read (void *Buffer, size_t Count) override |
Introduces a pure virtual method responsible for reading from the stream. More... | |
size_t | Write (const void *Buffer, size_t Count) override |
Introduces a pure virtual method responsible for writing to the stream. More... | |
virtual size_t | ReadBufferImmediate (void *Buffer, size_t Count) |
Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read, without waiting for more extra bytes to arrive (just those already enqued in the stream). More... | |
virtual int | printf (const char *fmt,...) MRPT_printf_format_check(2 |
Writes a string to the stream in a textual form. More... | |
template<typename CONTAINER_TYPE > | |
virtual int void | printf_vector (const char *fmt, const CONTAINER_TYPE &V, char separator=',') |
Prints a vector in the format [A,B,C,...] using CStream::printf, and the fmt string for each vector element T . More... | |
bool | getline (std::string &out_str) |
Reads from the stream until a ' ' character is found ('' characters are ignored). More... | |
Private Attributes | |
mrpt::pimpl< Impl > | m_f |
|
inherited |
Used in CStream::Seek.
Enumerator | |
---|---|
sFromBeginning | |
sFromCurrent | |
sFromEnd |
Definition at line 32 of file io/CStream.h.
CFileGZOutputStream::CFileGZOutputStream | ( | const std::string & | fileName | ) |
Constructor: opens an output file with compression level = 1 (minimum, fastest).
fileName | The file to be open in this stream |
Definition at line 32 of file CFileGZOutputStream.cpp.
References mrpt::format(), MRPT_END, MRPT_START, open(), and THROW_EXCEPTION.
CFileGZOutputStream::CFileGZOutputStream | ( | ) |
Constructor, without opening the file.
Definition at line 27 of file CFileGZOutputStream.cpp.
|
delete |
|
override |
Destructor.
Definition at line 61 of file CFileGZOutputStream.cpp.
References close().
void CFileGZOutputStream::close | ( | ) |
Close the file.
Definition at line 62 of file CFileGZOutputStream.cpp.
References m_f.
Referenced by mrpt::apps::RawlogGrabberApp::runImpl(), and ~CFileGZOutputStream().
bool CFileGZOutputStream::fileOpenCorrectly | ( | ) | const |
Returns true if the file was open without errors.
Definition at line 94 of file CFileGZOutputStream.cpp.
References m_f.
Referenced by mrpt::io::zip::compress_gz_file(), is_open(), mrpt::maps::CGasConcentrationGridMap2D::save_Gaussian_Wind_Grid_To_File(), and mrpt::nav::CPTG_DiffDrive_CollisionGridBased::saveColGridsToFile().
|
inherited |
Reads from the stream until a '
' character is found ('' characters are ignored).
Definition at line 69 of file CStream.cpp.
|
overridevirtual |
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one.
Implements mrpt::io::CStream.
Definition at line 85 of file CFileGZOutputStream.cpp.
References m_f, and THROW_EXCEPTION.
|
overridevirtual |
This method is not implemented in this class.
Implements mrpt::io::CStream.
Definition at line 103 of file CFileGZOutputStream.cpp.
References THROW_EXCEPTION.
|
inline |
Returns true if the file was open without errors.
Definition at line 64 of file io/CFileGZOutputStream.h.
References fileOpenCorrectly().
bool CFileGZOutputStream::open | ( | const std::string & | fileName, |
int | compress_level = 1 , |
||
mrpt::optional_ref< std::string > | error_msg = std::nullopt |
||
) |
Open a file for write, choosing the compression level.
fileName | The file to be open in this stream |
compress_level | 0:no compression, 1:fastest, 9:best |
Definition at line 44 of file CFileGZOutputStream.cpp.
References mrpt::format(), m_f, MRPT_END, and MRPT_START.
Referenced by CFileGZOutputStream(), mrpt::io::zip::compress_gz_file(), mrpt::nav::CAbstractPTGBasedReactive::enableLogFile(), mrpt::apps::RawlogGrabberApp::runImpl(), and TEST().
|
delete |
|
virtualinherited |
Writes a string to the stream in a textual form.
Definition at line 30 of file CStream.cpp.
References MRPT_END, MRPT_START, and mrpt::system::os::vsnprintf().
Referenced by mrpt::hmtslam::CTopLCDetector_GridMatching::computeTopologicalObservationModel(), mrpt::apps::MonteCarloLocalization_Base::do_pf_localization(), mrpt::io::CStream::printf_vector(), mrpt::apps::CGridMapAlignerApp::run(), mrpt::apps::RBPF_SLAM_App_Base::run(), and mrpt::apps::ICP_SLAM_App_Base::run().
|
inlineinherited |
Prints a vector in the format [A,B,C,...] using CStream::printf, and the fmt string for each vector element T
.
CONTAINER_TYPE | can be any vector<T>, deque<T> or alike. |
Definition at line 102 of file io/CStream.h.
References mrpt::io::CStream::printf().
Referenced by mrpt::hmtslam::CTopLCDetector_GridMatching::computeTopologicalObservationModel().
|
overridevirtual |
Introduces a pure virtual method responsible for reading from the stream.
Implements mrpt::io::CStream.
Definition at line 71 of file CFileGZOutputStream.cpp.
References THROW_EXCEPTION.
|
inlinevirtualinherited |
Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read, without waiting for more extra bytes to arrive (just those already enqued in the stream).
Note that this method will fallback to ReadBuffer() in most CStream classes but in some hardware-related classes.
std::exception | On any error, or if ZERO bytes are read. |
Reimplemented in mrpt::comms::CInterfaceFTDI.
Definition at line 62 of file io/CStream.h.
References mrpt::io::CStream::Read().
|
overridevirtual |
This method is not implemented in this class.
Implements mrpt::io::CStream.
Definition at line 98 of file CFileGZOutputStream.cpp.
References THROW_EXCEPTION.
|
overridevirtual |
Introduces a pure virtual method responsible for writing to the stream.
Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.
Implements mrpt::io::CStream.
Definition at line 76 of file CFileGZOutputStream.cpp.
References m_f, and THROW_EXCEPTION.
Referenced by mrpt::io::zip::compress_gz_file(), mrpt::maps::CPointsMapXYZI::saveToKittiVelodyneFile(), and TEST().
|
private |
Definition at line 29 of file io/CFileGZOutputStream.h.
Referenced by close(), fileOpenCorrectly(), getPosition(), open(), and Write().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |