Public Member Functions | Protected Attributes | Friends | List of all members
gnsstk::RTFileFrame< FileStream, FileData > Class Template Reference

Detailed Description

template<class FileStream, class FileData>
class gnsstk::RTFileFrame< FileStream, FileData >

This class supports two iteration semantics.

RTFileFrameIterator<SMODFStream, SMODFData> itr = rtf.begin();
while(itr != rtf.end())
{
// do something
cout << *itr << endl;
itr++;
}
rtf.waitForData(10);

and the legacy interface

while(rtf.getRecord())
{
// use data() to get the last read record
cout << rtf.data() << endl;
}
rtf.waitForData(10);

The waitForData() call will ready the internal file stream for the next read. Remember that RTFileFrameIterator is a past-the-end style iterator, so you must reset it to begin() when it has finished otherwise you'll get no data. In Dumb mode, you will need to use the openNextDay() function to advance to tne next day. When you reach the end of a data set, there are three ways to restore the valid state of the RTFileFrame iteration:

rtf.waitForData(900)

This is the best option for either Smart or Dumb mode, ensuring that the file gets reopened correctly.

rtf.openCurrentFile()

Reopens the current file, destroying the current read position. In other words, don't use this in Smart mode.

rtf.openNextDay()

This will open the next day's file, obviously resetting the read position for the stream.

Warning
In Smart mode, you could potentially miss data when you pass to the start of a new day if data gets written to the file of the previous day.
DO NOT MIX THE TWO ITERATOR SEMANTICS. Doing so, you will definately miss data.

Definition at line 82 of file RTFileFrame.hpp.

#include <RTFileFrame.hpp>

Public Member Functions

RTFileFrameIterator< FileStream, FileData > begin ()
 
void closeCurrentFile ()
 close the file currentFileName More...
 
const FileData & data () const
 returns the last read data More...
 
RTFileFrameIterator< FileStream, FileData > end ()
 end of data set iterator, useful for loops More...
 
bool endOfDataSet ()
 Returns true if all data for the given time has been read. More...
 
std::string getCurrentFile () const
 returns the name of the current file begin used More...
 
gnsstk::CommonTime getCurrentTime () const
 returns the current time used for finding files More...
 
FileFilter< FileData > getFileFilter () const
 
std::list< FileData > getList () const
 
bool getRecord ()
 
bool hasFileChanged ()
 
bool openCurrentFile ()
 reopens the file currentFileName More...
 
void openNextDay ()
 when in Dumb mode, use this function to advance to the next day. More...
 
 RTFileFrame (const gnsstk::FileSpec &fnFormat, const gnsstk::CommonTime &beginning=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &ending=gnsstk::CommonTime::END_OF_TIME, const RTFileFrameHelper::FileReadingMode frm=AppendedData, const RTFileFrameHelper::GetRecordMode grm=Dumb)
 
RTFileFramesetFileReadingMode (const FileReadingMode f)
 Allows changing of the FileReadingMode. More...
 
RTFileFramesetGetRecordMode (const GetRecordMode g)
 Allows changing of the GetRecordMode. More...
 
void waitForData (unsigned wait=0)
 
 ~RTFileFrame ()
 destructor More...
 

Protected Attributes

std::string currentFileName
 the last file to be read More...
 
gnsstk::CommonTime currentTime
 time last used for finding a file More...
 
gnsstk::CommonTime endTime
 
struct stat fileInfo
 keeps track of the last modify date for the last file read More...
 
FileStream * fileStream
 the internal file stream for the internal iterator More...
 
gnsstk::FileSpec fs
 the file spec for determining file names More...
 
GetRecordMode getMode
 the GetRecordMode for the reader More...
 
bool isOK
 
FileData lastData
 
std::streampos lastPosition
 the last get position from the file More...
 
FileReadingMode readMode
 the FileReadingMode for the reader More...
 
gnsstk::CommonTime startTime
 start time for file searching More...
 

Friends

class RTFileFrameIterator< FileStream, FileData >
 let the iterator see this class's insides More...
 

Constructor & Destructor Documentation

◆ RTFileFrame()

template<class FileStream , class FileData >
gnsstk::RTFileFrame< FileStream, FileData >::RTFileFrame ( const gnsstk::FileSpec fnFormat,
const gnsstk::CommonTime beginning = gnsstk::CommonTime::BEGINNING_OF_TIME,
const gnsstk::CommonTime ending = gnsstk::CommonTime::END_OF_TIME,
const RTFileFrameHelper::FileReadingMode  frm = AppendedData,
const RTFileFrameHelper::GetRecordMode  grm = Dumb 
)

constructor

Parameters
fnFormatstring defining how the files names are formatted
beginningtime of data to start streaming from
endingtime of data to stop streaming at
frmmode used to read file (new data or all)
grmmode used when end of file is reached (new data or all)
Exceptions
Exceptionan error ocurred

◆ ~RTFileFrame()

template<class FileStream , class FileData >
gnsstk::RTFileFrame< FileStream, FileData >::~RTFileFrame

destructor

Definition at line 366 of file RTFileFrame.hpp.

Member Function Documentation

◆ begin()

template<class FileStream , class FileData >
RTFileFrameIterator< FileStream, FileData > gnsstk::RTFileFrame< FileStream, FileData >::begin

start of data set, set appropriately for the given FileReadingMode. if in AppendedData mode, begin will start at the next record that hasn't been read. if in FromTheBeginning mode, begin starts at the start of the current file.

Definition at line 447 of file RTFileFrame.hpp.

◆ closeCurrentFile()

template<class FileStream , class FileData >
void gnsstk::RTFileFrame< FileStream, FileData >::closeCurrentFile

close the file currentFileName

Definition at line 579 of file RTFileFrame.hpp.

◆ data()

template<class FileStream , class FileData >
const FileData& gnsstk::RTFileFrame< FileStream, FileData >::data ( ) const
inline

returns the last read data

Definition at line 288 of file RTFileFrame.hpp.

◆ end()

template<class FileStream , class FileData >
RTFileFrameIterator< FileStream, FileData > gnsstk::RTFileFrame< FileStream, FileData >::end

end of data set iterator, useful for loops

Definition at line 440 of file RTFileFrame.hpp.

◆ endOfDataSet()

template<class FileStream , class FileData >
bool gnsstk::RTFileFrame< FileStream, FileData >::endOfDataSet

Returns true if all data for the given time has been read.

Definition at line 430 of file RTFileFrame.hpp.

◆ getCurrentFile()

template<class FileStream , class FileData >
std::string gnsstk::RTFileFrame< FileStream, FileData >::getCurrentFile ( ) const
inline

returns the name of the current file begin used

Definition at line 303 of file RTFileFrame.hpp.

◆ getCurrentTime()

template<class FileStream , class FileData >
gnsstk::CommonTime gnsstk::RTFileFrame< FileStream, FileData >::getCurrentTime ( ) const
inline

returns the current time used for finding files

Definition at line 306 of file RTFileFrame.hpp.

◆ getFileFilter()

template<class FileStream , class FileData >
FileFilter< FileData > gnsstk::RTFileFrame< FileStream, FileData >::getFileFilter

this traverses the RTFileFrame from begin() to end(), adding each item to a FileFilter that gets returned. Using this will change the file position, so getRecord and any iterators will not be the same after this call.

Definition at line 542 of file RTFileFrame.hpp.

◆ getList()

template<class FileStream , class FileData >
std::list< FileData > gnsstk::RTFileFrame< FileStream, FileData >::getList

this traverses the RTFileFrame from begin() to end(), adding each item to a list that gets returned. Using this will change the file position, so getRecord and any iterators will not be the same after this call.

Definition at line 528 of file RTFileFrame.hpp.

◆ getRecord()

template<class FileStream , class FileData >
bool gnsstk::RTFileFrame< FileStream, FileData >::getRecord

reads the next record in the file

Returns
true if a record was read, otherwise false.

Definition at line 465 of file RTFileFrame.hpp.

◆ hasFileChanged()

template<class FileStream , class FileData >
bool gnsstk::RTFileFrame< FileStream, FileData >::hasFileChanged

returns true if the file currently being read from has changed since its last read

Definition at line 417 of file RTFileFrame.hpp.

◆ openCurrentFile()

template<class FileStream , class FileData >
bool gnsstk::RTFileFrame< FileStream, FileData >::openCurrentFile

reopens the file currentFileName

Definition at line 556 of file RTFileFrame.hpp.

◆ openNextDay()

template<class FileStream , class FileData >
void gnsstk::RTFileFrame< FileStream, FileData >::openNextDay

when in Dumb mode, use this function to advance to the next day.

Definition at line 518 of file RTFileFrame.hpp.

◆ setFileReadingMode()

template<class FileStream , class FileData >
RTFileFrame< FileStream, FileData > & gnsstk::RTFileFrame< FileStream, FileData >::setFileReadingMode ( const FileReadingMode  f)

Allows changing of the FileReadingMode.

Definition at line 378 of file RTFileFrame.hpp.

◆ setGetRecordMode()

template<class FileStream , class FileData >
RTFileFrame< FileStream, FileData > & gnsstk::RTFileFrame< FileStream, FileData >::setGetRecordMode ( const GetRecordMode  g)

Allows changing of the GetRecordMode.

Definition at line 388 of file RTFileFrame.hpp.

◆ waitForData()

template<class FileStream , class FileData >
void gnsstk::RTFileFrame< FileStream, FileData >::waitForData ( unsigned  wait = 0)

Waits wait number of seconds, then reopens the file and sets the next read as appropriate for the FileReadingMode.

Parameters
waitnumber of seconds to sleep.

Definition at line 396 of file RTFileFrame.hpp.

Friends And Related Function Documentation

◆ RTFileFrameIterator< FileStream, FileData >

template<class FileStream , class FileData >
friend class RTFileFrameIterator< FileStream, FileData >
friend

let the iterator see this class's insides

Definition at line 309 of file RTFileFrame.hpp.

Member Data Documentation

◆ currentFileName

template<class FileStream , class FileData >
std::string gnsstk::RTFileFrame< FileStream, FileData >::currentFileName
protected

the last file to be read

Definition at line 325 of file RTFileFrame.hpp.

◆ currentTime

template<class FileStream , class FileData >
gnsstk::CommonTime gnsstk::RTFileFrame< FileStream, FileData >::currentTime
protected

time last used for finding a file

Definition at line 330 of file RTFileFrame.hpp.

◆ endTime

template<class FileStream , class FileData >
gnsstk::CommonTime gnsstk::RTFileFrame< FileStream, FileData >::endTime
protected

end time for file searching

Definition at line 331 of file RTFileFrame.hpp.

◆ fileInfo

template<class FileStream , class FileData >
struct stat gnsstk::RTFileFrame< FileStream, FileData >::fileInfo
protected

keeps track of the last modify date for the last file read

Definition at line 337 of file RTFileFrame.hpp.

◆ fileStream

template<class FileStream , class FileData >
FileStream* gnsstk::RTFileFrame< FileStream, FileData >::fileStream
protected

the internal file stream for the internal iterator

Definition at line 319 of file RTFileFrame.hpp.

◆ fs

template<class FileStream , class FileData >
gnsstk::FileSpec gnsstk::RTFileFrame< FileStream, FileData >::fs
protected

the file spec for determining file names

Definition at line 327 of file RTFileFrame.hpp.

◆ getMode

template<class FileStream , class FileData >
GetRecordMode gnsstk::RTFileFrame< FileStream, FileData >::getMode
protected

the GetRecordMode for the reader

Definition at line 335 of file RTFileFrame.hpp.

◆ isOK

template<class FileStream , class FileData >
bool gnsstk::RTFileFrame< FileStream, FileData >::isOK
protected

isOK is only false when the user needs to take action to continue reading - by calling waitForData(), openNextDay(), or openCurrentFile()

Definition at line 341 of file RTFileFrame.hpp.

◆ lastData

template<class FileStream , class FileData >
FileData gnsstk::RTFileFrame< FileStream, FileData >::lastData
protected

Definition at line 321 of file RTFileFrame.hpp.

◆ lastPosition

template<class FileStream , class FileData >
std::streampos gnsstk::RTFileFrame< FileStream, FileData >::lastPosition
protected

the last get position from the file

Definition at line 323 of file RTFileFrame.hpp.

◆ readMode

template<class FileStream , class FileData >
FileReadingMode gnsstk::RTFileFrame< FileStream, FileData >::readMode
protected

the FileReadingMode for the reader

Definition at line 333 of file RTFileFrame.hpp.

◆ startTime

template<class FileStream , class FileData >
gnsstk::CommonTime gnsstk::RTFileFrame< FileStream, FileData >::startTime
protected

start time for file searching

Definition at line 329 of file RTFileFrame.hpp.


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


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