Helios++
Helios software for LiDAR simulations
helios::filems::LineFileReader Class Reference

Class supporting line by line reading of text files. More...

#include <LineFileReader.h>

Inheritance diagram for helios::filems::LineFileReader:
Collaboration diagram for helios::filems::LineFileReader:

Public Member Functions

 LineFileReader (string const &path, std::ios_base::openmode openMode=std::ios_base::in, long const maxCharsPerLine=8192, bool const constructStrategy=true)
 Default constructor for line file reader. More...
 
virtual long getMaxCharsPerLine ()
 Obtain the maximum number of characters per line. More...
 
virtual void setMaxCharsPerLine (long const maxCharsPerLine)
 Set the maximum number of characters per line and update strategy accordingly. More...
 
- Public Member Functions inherited from helios::filems::SimpleFileReader< string >
 SimpleFileReader (string const &path, ios_base::openmode openMode=ios_base::in)
 Default constructor for simple file reader. More...
 
string 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< ReadType >
 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 Member Functions

void makeStrategy () override
 Build a line reading strategy for the line file reader. More...
 

Protected Attributes

long maxCharsPerLine
 The maximum number of characters that a line is expected to have. More...
 
- Protected Attributes inherited from helios::filems::SimpleFileReader< string >
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< ReadType >
string path
 Path to the file to be read.
 
shared_ptr< ReadingStrategy< ReadType > > readingStrategy = nullptr
 The reading strategy to be used by the file reader. More...
 

Detailed Description

Class supporting line by line reading of text files.

Author
Alberto M. Esmoris Pena
Version
1.0
See also
filems::SimpleFileReader
filems::LineReadingStrategy

Constructor & Destructor Documentation

◆ LineFileReader()

helios::filems::LineFileReader::LineFileReader ( string const &  path,
std::ios_base::openmode  openMode = std::ios_base::in,
long const  maxCharsPerLine = 8192,
bool const  constructStrategy = true 
)
inline

Default constructor for line file reader.

See also
filems::SimpleFileReader::SimpleFileReader

Member Function Documentation

◆ getMaxCharsPerLine()

virtual long helios::filems::LineFileReader::getMaxCharsPerLine ( )
inlinevirtual

Obtain the maximum number of characters per line.

Returns
Maximum number of characters per line
See also
filems::LineFileReader::maxCharsPerLine
filems::LineFileReader::setMaxCharsPerLine()

◆ makeStrategy()

void helios::filems::LineFileReader::makeStrategy ( )
inlineoverrideprotectedvirtual

Build a line reading strategy for the line file reader.

See also
FileReader::makeStrategy

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

◆ setMaxCharsPerLine()

virtual void helios::filems::LineFileReader::setMaxCharsPerLine ( long const  maxCharsPerLine)
inlinevirtual

Set the maximum number of characters per line and update strategy accordingly.

Parameters
maxCharsPerLineNew maximum number of characters per line
See also
filems::LineFileReader::maxCharsPerLine
filems::LineFileReader::getMaxCharsPerLine()

Member Data Documentation

◆ maxCharsPerLine

long helios::filems::LineFileReader::maxCharsPerLine
protected

The maximum number of characters that a line is expected to have.

If a file having lines of more than maxCharsPerLine characters is read, then problems might arise

See also
filems::LineReadingStrategy::maxCharsPerLine

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