Main MRPT website > C++ reference
MRPT logo

mrpt::utils::CFileInputStream Class Reference

This CStream derived class allow using a file as a read-only, binary stream. More...

#include <mrpt/utils/CFileInputStream.h>

Inheritance diagram for mrpt::utils::CFileInputStream:
Inheritance graph
[legend]
Collaboration diagram for mrpt::utils::CFileInputStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CFileInputStream (const std::string &fileName)
 Constructor.
 CFileInputStream ()
 Default constructor.
bool open (const std::string &fileName)
 Open a file for reading.
void close ()
 Close the stream.
virtual ~CFileInputStream ()
 Destructor.
bool fileOpenCorrectly ()
 Says if file was open successfully or not.
bool checkEOF ()
 Will be true if EOF has been already reached.
size_t Seek (long Offset, CStream::TSeekOrigin Origin=sFromBeginning)
 Method for moving to a specified position in the streamed resource.
size_t getTotalBytesCount ()
 Method for getting the total number of bytes in the buffer.
size_t getPosition ()
 Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one.
bool readLine (std::string &str)
 Reads one string line from the file (until a new-line character).

Protected Member Functions

size_t Read (void *Buffer, size_t Count)
 Method responsible for reading from the stream.
size_t Write (const void *Buffer, size_t Count)
 Method responsible for writing to the stream.

Private Attributes

std::ifstream m_if
 The actual input file stream.

Detailed Description

This CStream derived class allow using a file as a read-only, binary stream.

See also:
CStream, CFileStream, CFileGZInputStream

Definition at line 46 of file CFileInputStream.h.


Constructor & Destructor Documentation

mrpt::utils::CFileInputStream::CFileInputStream ( const std::string &  fileName  ) 

Constructor.

Parameters:
fileName The file to be open in this stream
Exceptions:
std::exception On error trying to open the file.
mrpt::utils::CFileInputStream::CFileInputStream (  ) 

Default constructor.

virtual mrpt::utils::CFileInputStream::~CFileInputStream (  )  [virtual]

Destructor.


Member Function Documentation

bool mrpt::utils::CFileInputStream::checkEOF (  ) 

Will be true if EOF has been already reached.

void mrpt::utils::CFileInputStream::close (  ) 

Close the stream.

bool mrpt::utils::CFileInputStream::fileOpenCorrectly (  ) 

Says if file was open successfully or not.

size_t mrpt::utils::CFileInputStream::getPosition (  )  [virtual]

Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the last one.

Implements mrpt::utils::CStream.

size_t mrpt::utils::CFileInputStream::getTotalBytesCount (  )  [virtual]

Method for getting the total number of bytes in the buffer.

Implements mrpt::utils::CStream.

bool mrpt::utils::CFileInputStream::open ( const std::string &  fileName  ) 

Open a file for reading.

Parameters:
fileName The file to be open in this stream
Returns:
true on success.
size_t mrpt::utils::CFileInputStream::Read ( void *  Buffer,
size_t  Count 
) [protected, virtual]

Method responsible for reading from the stream.

Implements mrpt::utils::CStream.

bool mrpt::utils::CFileInputStream::readLine ( std::string &  str  ) 

Reads one string line from the file (until a new-line character).

Returns:
true if a line has been read, false on EOF or error.
size_t mrpt::utils::CFileInputStream::Seek ( long  Offset,
CStream::TSeekOrigin  Origin = sFromBeginning 
) [virtual]

Method for moving to a specified position in the streamed resource.

See documentation of CStream::Seek

Implements mrpt::utils::CStream.

size_t mrpt::utils::CFileInputStream::Write ( const void *  Buffer,
size_t  Count 
) [protected, 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::utils::CStream.


Member Data Documentation

std::ifstream mrpt::utils::CFileInputStream::m_if [private]

The actual input file stream.

Definition at line 59 of file CFileInputStream.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010