Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | List of all members
gnsstk::FFTextStream Class Reference

Detailed Description

An FFStream is meant for reading text. This also includes an internal line count and a read line method. When reading and using the formattedGetLine() call, the lineNumber automatically increments. However, any other read and all write calls do not update the line number - the derived class or programmer needs to make sure that the reader or writer increments lineNumber in these cases.

Definition at line 63 of file FFTextStream.hpp.

#include <FFTextStream.hpp>

Inheritance diagram for gnsstk::FFTextStream:
Inheritance graph
[legend]

Public Member Functions

 FFTextStream ()
 Default constructor. More...
 
 FFTextStream (const char *fn, std::ios::openmode mode=std::ios::in)
 
 FFTextStream (const std::string &fn, std::ios::openmode mode=std::ios::in)
 
void formattedGetLine (std::string &line, const bool expectEOF=false)
 
virtual void open (const char *fn, std::ios::openmode mode)
 Overrides open to reset the line number. More...
 
virtual void open (const std::string &fn, std::ios::openmode mode)
 Overrides open to reset the line number. More...
 
virtual ~FFTextStream ()
 Destructor. More...
 
- Public Member Functions inherited from gnsstk::FFStream
void conditionalThrow (void)
 
void dumpState (std::ostream &s=std::cout) const
 A function to help debug FFStreams. More...
 
 FFStream ()
 Default constructor, initialize internal data. More...
 
 FFStream (const char *fn, std::ios::openmode mode=std::ios::in)
 
 FFStream (const std::string &fn, std::ios::openmode mode=std::ios::in)
 
virtual ~FFStream ()
 Virtual destructor, close the stream etc. More...
 

Public Attributes

unsigned int lineNumber
 
- Public Attributes inherited from gnsstk::FFStream
std::string filename
 file name More...
 
FFStreamError mostRecentException
 This stores the most recently thrown exception. More...
 
unsigned int recordNumber
 keeps track of the number of records read More...
 

Protected Member Functions

virtual void tryFFStreamGet (FFData &rec)
 
virtual void tryFFStreamPut (const FFData &rec)
 

Private Member Functions

void init ()
 Initialize internal data structures. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from gnsstk::FFStream
static bool isFFStream (std::istream &i)
 Check if the input stream is the kind of RinexObsStream. More...
 

Constructor & Destructor Documentation

◆ FFTextStream() [1/3]

gnsstk::FFTextStream::FFTextStream ( )

Default constructor.

Definition at line 49 of file FFTextStream.cpp.

◆ ~FFTextStream()

gnsstk::FFTextStream::~FFTextStream ( )
virtual

Destructor.

Definition at line 56 of file FFTextStream.cpp.

◆ FFTextStream() [2/3]

gnsstk::FFTextStream::FFTextStream ( const char *  fn,
std::ios::openmode  mode = std::ios::in 
)

Common constructor.

Parameters
fnfile name.
modefile open mode (std::ios)

Definition at line 62 of file FFTextStream.cpp.

◆ FFTextStream() [3/3]

gnsstk::FFTextStream::FFTextStream ( const std::string &  fn,
std::ios::openmode  mode = std::ios::in 
)

Common constructor.

Parameters
fnfile name.
modefile open mode (std::ios)

Definition at line 71 of file FFTextStream.cpp.

Member Function Documentation

◆ formattedGetLine()

void gnsstk::FFTextStream::formattedGetLine ( std::string &  line,
const bool  expectEOF = false 
)

Like std::istream::getline but checks for EOF and removes '/r'. Also increments lineNumber. When expectEOF is true and EOF is found, an gnsstk::EndOfFile exception is thrown. If expectEOF is false and an EOF is encountered, an gnsstk::FFStreamError is thrown.

Parameters
[out]lineis set to the value of the line read from the file.
[in]expectEOFset true if finding EOF on this read is acceptable.
Exceptions
EndOfFileif expectEOF is true and an EOF is encountered.
FFStreamErrorif EOF is found and expectEOF is false
gnsstk::StringUtils::StringExceptionwhen a string error occurs or if any other error happens.
Warning
There is a maximum line length of 1500 characters when using this function.

Definition at line 149 of file FFTextStream.cpp.

◆ init()

void gnsstk::FFTextStream::init ( )
private

Initialize internal data structures.

Definition at line 97 of file FFTextStream.cpp.

◆ open() [1/2]

void gnsstk::FFTextStream::open ( const char *  fn,
std::ios::openmode  mode 
)
virtual

◆ open() [2/2]

void gnsstk::FFTextStream::open ( const std::string &  fn,
std::ios::openmode  mode 
)
virtual

Overrides open to reset the line number.

Reimplemented from gnsstk::FFStream.

Reimplemented in gnsstk::RinexObsStream, gnsstk::Rinex3ObsStream, and gnsstk::RinexClockStream.

Definition at line 89 of file FFTextStream.cpp.

◆ tryFFStreamGet()

void gnsstk::FFTextStream::tryFFStreamGet ( FFData rec)
protectedvirtual

calls FFStream::tryFFStreamGet and adds line number information

Exceptions
FFStreamError
StringUtils::StringException

Reimplemented from gnsstk::FFStream.

Definition at line 104 of file FFTextStream.cpp.

◆ tryFFStreamPut()

void gnsstk::FFTextStream::tryFFStreamPut ( const FFData rec)
protectedvirtual

calls FFStream::tryFFStreamPut and adds line number information

Exceptions
FFStreamError
StringUtils::StringException

Reimplemented from gnsstk::FFStream.

Definition at line 124 of file FFTextStream.cpp.

Member Data Documentation

◆ lineNumber

unsigned int gnsstk::FFTextStream::lineNumber

The internal line count. When writing, make sure to increment this.

Definition at line 98 of file FFTextStream.hpp.


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


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:44