69 bool is_open() {
return fileOpenCorrectly(); }
79 uint64_t getPositionI();
80 uint64_t getPositionO();
84 bool readLine( std::
string &str );
This CStream derived class allow using a file as a read/write binary stream, creating it if the file ...
bool is_open()
Returns true if the file was open without errors.
bool fileOpenCorrectly()
Returns true if the file was open without errors.
virtual ~CFileStream()
Destructor.
size_t Write(const void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for writing to the stream.
size_t Read(void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for reading from the stream.
bool checkEOF()
Will be true if EOF has been already reached.
void close()
Closes the file.
std::fstream m_f
The actual input file stream.
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
Method for moving to a specified position in the streamed resource.
uint64_t getTotalBytesCount() MRPT_OVERRIDE
Method for getting the total number of bytes writen to buffer.
bool open(const std::string &fileName, TFileOpenModes mode=fomRead|fomWrite)
Opens the file, returning true on success.
CFileStream()
Constructor.
CFileStream(const std::string &fileName, TFileOpenModes mode=fomRead|fomWrite)
Constructor and open a file.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
TSeekOrigin
Used in CStream::Seek.
The base class of classes that cannot be copied: compile-time errors will be issued on any copy opera...
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
int TFileOpenModes
File open modes are used in CFileStream Posible values are:
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.