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

Class defining the strategy to read line by line from a file input stream. More...

#include <LineReadingStrategy.h>

Inheritance diagram for helios::filems::LineReadingStrategy:
Collaboration diagram for helios::filems::LineReadingStrategy:

Public Member Functions

 LineReadingStrategy (ifstream &ifs, long const &maxCharsPerLine)
 Default constructor for line reading strategy. More...
 
string read () override
 Read line from text file. More...
 
- Public Member Functions inherited from helios::filems::SimpleReadingStrategy< string >
 SimpleReadingStrategy (ifstream &ifs)
 Default constructor for simple reading strategy.
 
- Public Member Functions inherited from helios::filems::ReadingStrategy< ReadType >
 ReadingStrategy ()=default
 Default constructor for reading strategy.
 

Protected Attributes

long const & maxCharsPerLine
 The maximum number of characters that a line is expected to have. More...
 
char * buffer = nullptr
 Buffer where the read line is stored.
 
- Protected Attributes inherited from helios::filems::SimpleReadingStrategy< string >
ifstream & ifs
 Reference to the input file stream to read from.
 

Detailed Description

Class defining the strategy to read line by line from a file input stream.

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

Constructor & Destructor Documentation

◆ LineReadingStrategy()

helios::filems::LineReadingStrategy::LineReadingStrategy ( ifstream &  ifs,
long const &  maxCharsPerLine 
)
inline

Default constructor for line reading strategy.

See also
filems::SimpleReadingStrategy::SimpleReadingStrategy

Member Function Documentation

◆ read()

string helios::filems::LineReadingStrategy::read ( )
inlineoverridevirtual

Read line from text file.

Returns
Either what has been read from input file or throw an exception if end of file was reached ( filems::EndOfReadingException )
See also
helios::filems::EndOfReadingException

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

Member Data Documentation

◆ maxCharsPerLine

long const& helios::filems::LineReadingStrategy::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::LineFileReader::maxCharsPerLine

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