This class supports two iteration semantics.
and the legacy interface
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:
This is the best option for either Smart or Dumb mode, ensuring that the file gets reopened correctly.
Reopens the current file, destroying the current read position. In other words, don't use this in Smart mode.
This will open the next day's file, obviously resetting the read position for the stream.
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) | |
RTFileFrame & | setFileReadingMode (const FileReadingMode f) |
Allows changing of the FileReadingMode. More... | |
RTFileFrame & | setGetRecordMode (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... | |
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
fnFormat | string defining how the files names are formatted |
beginning | time of data to start streaming from |
ending | time of data to stop streaming at |
frm | mode used to read file (new data or all) |
grm | mode used when end of file is reached (new data or all) |
Exception | an error ocurred |
gnsstk::RTFileFrame< FileStream, FileData >::~RTFileFrame |
destructor
Definition at line 366 of file RTFileFrame.hpp.
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.
void gnsstk::RTFileFrame< FileStream, FileData >::closeCurrentFile |
close the file currentFileName
Definition at line 579 of file RTFileFrame.hpp.
|
inline |
returns the last read data
Definition at line 288 of file RTFileFrame.hpp.
RTFileFrameIterator< FileStream, FileData > gnsstk::RTFileFrame< FileStream, FileData >::end |
end of data set iterator, useful for loops
Definition at line 440 of file RTFileFrame.hpp.
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.
|
inline |
returns the name of the current file begin used
Definition at line 303 of file RTFileFrame.hpp.
|
inline |
returns the current time used for finding files
Definition at line 306 of file RTFileFrame.hpp.
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.
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.
bool gnsstk::RTFileFrame< FileStream, FileData >::getRecord |
reads the next record in the file
Definition at line 465 of file RTFileFrame.hpp.
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.
bool gnsstk::RTFileFrame< FileStream, FileData >::openCurrentFile |
reopens the file currentFileName
Definition at line 556 of file RTFileFrame.hpp.
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.
RTFileFrame< FileStream, FileData > & gnsstk::RTFileFrame< FileStream, FileData >::setFileReadingMode | ( | const FileReadingMode | f | ) |
Allows changing of the FileReadingMode.
Definition at line 378 of file RTFileFrame.hpp.
RTFileFrame< FileStream, FileData > & gnsstk::RTFileFrame< FileStream, FileData >::setGetRecordMode | ( | const GetRecordMode | g | ) |
Allows changing of the GetRecordMode.
Definition at line 388 of file RTFileFrame.hpp.
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.
wait | number of seconds to sleep. |
Definition at line 396 of file RTFileFrame.hpp.
|
friend |
let the iterator see this class's insides
Definition at line 309 of file RTFileFrame.hpp.
|
protected |
the last file to be read
Definition at line 325 of file RTFileFrame.hpp.
|
protected |
time last used for finding a file
Definition at line 330 of file RTFileFrame.hpp.
|
protected |
end time for file searching
Definition at line 331 of file RTFileFrame.hpp.
|
protected |
keeps track of the last modify date for the last file read
Definition at line 337 of file RTFileFrame.hpp.
|
protected |
the internal file stream for the internal iterator
Definition at line 319 of file RTFileFrame.hpp.
|
protected |
the file spec for determining file names
Definition at line 327 of file RTFileFrame.hpp.
|
protected |
the GetRecordMode for the reader
Definition at line 335 of file RTFileFrame.hpp.
|
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.
|
protected |
Definition at line 321 of file RTFileFrame.hpp.
|
protected |
the last get position from the file
Definition at line 323 of file RTFileFrame.hpp.
|
protected |
the FileReadingMode for the reader
Definition at line 333 of file RTFileFrame.hpp.
|
protected |
start time for file searching
Definition at line 329 of file RTFileFrame.hpp.