21     !std::is_copy_constructible_v<CFileStream> &&
    22         !std::is_copy_assignable_v<CFileStream>,
    34     std::ios_base::openmode mode = std::ios_base::in;
    36         mode = std::ios_base::in;
    47     m_f.open(fileName.c_str(), mode);
    49         throw std::runtime_error(
    50             std::string(
"CFileStream: Error creating/opening: ") + fileName);
    58     std::ios_base::openmode mode = std::ios_base::in;
    60         mode = std::ios_base::in;
    70     if (
m_f.is_open()) 
m_f.close();
    72     m_f.open(fileName.c_str(), ios_base::binary | mode);
    90     if (!
m_f.is_open()) 
return 0;
    91     m_f.read(static_cast<char*>(Buffer), Count);
    92     return m_f.fail() ? 0 : Count;
   101     if (!
m_f.is_open()) 
return 0;
   103     m_f.write(static_cast<const char*>(Buffer), Count);
   104     return m_f.fail() ? 0 : Count;
   114     if (!
m_f.is_open()) 
return 0;
   116     fstream::off_type offset = Offset;
   117     fstream::seekdir way;
   131             throw std::runtime_error(
   132                 "[CFileStream::Seek] Invalid value for 'Origin'");
   135     m_f.seekp(offset, way);
   136     m_f.seekg(offset, way);
   145     auto& f = 
const_cast<std::fstream&
>(
m_f);
   147     const uint64_t previousPos = f.tellg();
   149     uint64_t fileSize = f.tellg();
   150     f.seekg(previousPos, ios_base::beg);
   156     auto& f = 
const_cast<std::fstream&
>(
m_f);
   195     if (!
m_f.is_open()) 
return false;
   197     std::getline(
m_f, str);
   198     return !
m_f.fail() && !
m_f.eof();
   206     if (!
m_f.is_open()) 
return true;
   212     if (
m_f.is_open()) 
m_f.clear();
 
TSeekOrigin
Used in CStream::Seek. 
 
uint64_t Seek(int64_t off, CStream::TSeekOrigin org=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
 
bool readLine(std::string &str)
Reads one string line from the file (until a new-line character) 
 
bool fileOpenCorrectly() const
Returns true if the file was open without errors. 
 
uint64_t getPositionI()
The current Input cursor position, where 0 is the first byte. 
 
std::fstream m_f
The actual input file stream. 
 
void close()
Closes the file. 
 
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream. 
 
uint64_t getPosition() const override
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
 
int TFileOpenModes
File open modes are used in CFileStream Posible values are: 
 
~CFileStream() override
Destructor. 
 
uint64_t getPositionO()
The current Input cursor position, where 0 is the first byte. 
 
void clearError()
Resets stream error status bits (e.g. 
 
CFileStream()
Constructor. 
 
bool open(const std::string &fileName, TFileOpenModes mode=fomRead|fomWrite)
Opens the file, returning true on success. 
 
const_iterator end() const
 
mrpt::vision::TStereoCalibResults out
 
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream. 
 
bool checkEOF()
Will be true if EOF has been already reached. 
 
uint64_t getTotalBytesCount() const override
Returns the total amount of bytes in the stream.