Helios++
Helios software for LiDAR simulations
helios::filems::SimpleFileReader< ReadArg > Class Template Reference

Abstract class defining the fundamental of any file reader that uses standard file input stream as reading mechanism. More...

#include <SimpleFileReader.h>

Inheritance diagram for helios::filems::SimpleFileReader< ReadArg >:
Collaboration diagram for helios::filems::SimpleFileReader< ReadArg >:

Public Member Functions

 SimpleFileReader (string const &path, ios_base::openmode openMode=ios_base::in)
 Default constructor for simple file reader. More...
 
ReadArg read () override
 Read from file simply by applying the reading strategy. Therefore, there is no concurrency handling mechanism and usage of simple file reader is not thread safe. More...
 
void setPath (string const &path) override
 Set the path to the file to be read, also opening the input stream for the new file and updating the strategy. It assures the previous input file stream is closed before opening the new one. More...
 
- Public Member Functions inherited from helios::filems::FileReader< ReadArg >
 FileReader (string const &path)
 Default constructor for file reader. More...
 
virtual string getPath () const
 Obtain the path to the file to be read. More...
 

Protected Attributes

ifstream ifs
 The input file stream to read from.
 
ios_base::openmode openMode
 The open mode flags for the input file stream. More...
 
- Protected Attributes inherited from helios::filems::FileReader< ReadArg >
string path
 Path to the file to be read.
 
shared_ptr< ReadingStrategy< ReadArg > > readingStrategy
 The reading strategy to be used by the file reader. More...
 

Additional Inherited Members

- Protected Member Functions inherited from helios::filems::FileReader< ReadArg >
virtual void makeStrategy ()=0
 Build the strategy for the file reader.
 

Detailed Description

template<typename ReadArg>
class helios::filems::SimpleFileReader< ReadArg >

Abstract class defining the fundamental of any file reader that uses standard file input stream as reading mechanism.

Author
Alberto M. Esmoris Pena
Version
1.0
Template Parameters
ReadArgType of what is read from file
See also
filems::FileReader

Constructor & Destructor Documentation

◆ SimpleFileReader()

template<typename ReadArg >
helios::filems::SimpleFileReader< ReadArg >::SimpleFileReader ( string const &  path,
ios_base::openmode  openMode = ios_base::in 
)
inline

Member Function Documentation

◆ read()

template<typename ReadArg >
ReadArg helios::filems::SimpleFileReader< ReadArg >::read ( )
inlineoverridevirtual

Read from file simply by applying the reading strategy. Therefore, there is no concurrency handling mechanism and usage of simple file reader is not thread safe.

See also
filems::FileReader::read
filems::SimpleReadingStrategy

Implements helios::filems::FileReader< ReadArg >.

◆ setPath()

template<typename ReadArg >
void helios::filems::SimpleFileReader< ReadArg >::setPath ( string const &  path)
inlineoverridevirtual

Set the path to the file to be read, also opening the input stream for the new file and updating the strategy. It assures the previous input file stream is closed before opening the new one.

See also
filems::FileReader::setPath

Reimplemented from helios::filems::FileReader< ReadArg >.

Member Data Documentation

◆ openMode

template<typename ReadArg >
ios_base::openmode helios::filems::SimpleFileReader< ReadArg >::openMode
protected

The open mode flags for the input file stream.

See also
filems::SimpleFileReader::ifs

The documentation for this class was generated from the following file: