This class is a wrapper for FileSpecFind and FileFilter, allowing you to easily pick what files you want to process and how to process them. In the constructors, providing a start and end time will allow FileSpecFind to pick the correct files for that date range. After the object is built, it is ready for filtering.
Use the filter(), sort(), unique() and touch() operators to run whatever operations you want to on the data, then write out the files when you're done. You can also get access to the data with getData() and run whatever other post processing tools you would like to.
See the examples in FileFilterFrameTest.cpp for a demonstration.
Definition at line 73 of file FileFilterFrame.hpp.
#include <FileFilterFrame.hpp>
Public Member Functions | |
FileFilterFrame (const FileSpec &spec, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME, const FileSpecFind::Filter &filter=FileSpecFind::Filter()) | |
FileFilterFrame (const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME) | |
FileFilterFrame (const std::string &filename, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME) | |
FileFilterFrame (const std::vector< std::string > &fileList, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME) | |
FileFilterFrame & | newSource (const FileSpec &filespec, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME, const FileSpecFind::Filter &filter=FileSpecFind::Filter()) |
FileFilterFrame & | newSource (const std::string &filename, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME) |
FileFilterFrame & | newSource (const std::vector< std::string > &fileList, const gnsstk::CommonTime &start=gnsstk::CommonTime::BEGINNING_OF_TIME, const gnsstk::CommonTime &end=gnsstk::CommonTime::END_OF_TIME) |
bool | writeFile (const std::string &outputFile, const bool append=false) const |
bool | writeFile (FileStream &stream) const |
virtual | ~FileFilterFrame () |
![]() | |
FileFilter & | addData (const FileData &ffd) |
Adds the given data into the filter. More... | |
FileFilter & | addData (const std::list< FileData > &datavec) |
Adds arbitrary data to the filter. More... | |
FileData & | back () |
const FileData & | back () const |
std::list< FileData >::iterator | begin () |
std::list< FileData >::const_iterator | begin () const |
void | clear () |
template<class BinaryPredicate > | |
std::pair< std::list< FileData >, std::list< FileData > > | diff (const FileFilter< FileData > &r, BinaryPredicate p) const |
bool | empty () const |
std::list< FileData >::iterator | end () |
std::list< FileData >::const_iterator | end () const |
FileFilter (void) | |
Default constructor. More... | |
template<class Predicate > | |
FileFilter & | filter (Predicate up) |
template<class Predicate > | |
std::list< FileData > | findAll (Predicate p) const |
Returns a list of data matching the given unary predicate. More... | |
FileData & | front () |
const FileData & | front () const |
std::list< FileData > & | getData (void) |
Returns the contents of the data list. More... | |
std::list< FileData > | getData (void) const |
Returns the contents of the data list, const. More... | |
std::list< FileData >::size_type | getDataCount (void) const |
Returns the number of data items in the filter. More... | |
int | getFiltered () const |
FileFilter & | merge (const FileFilter &right) |
Combines the data from the input filter to this object. More... | |
template<class Compare > | |
FileFilter & | merge (const FileFilter &right, Compare bp) |
std::list< FileData >::size_type | size () |
template<class Compare > | |
FileFilter & | sort (Compare comp) |
template<class Operation > | |
FileFilter & | touch (const Operation &op) |
a const operator touch for the classes that need it. More... | |
template<class Operation > | |
FileFilter & | touch (Operation &op) |
template<class BinaryPredicate > | |
FileFilter & | unique (BinaryPredicate bp) |
virtual | ~FileFilter () |
Destructor. More... | |
Protected Member Functions | |
void | init (const FileSpecFind::Filter &filter=FileSpecFind::Filter()) |
Protected Attributes | |
gnsstk::CommonTime | endTime |
FileSpec | fs |
The file spec for this filter. More... | |
gnsstk::CommonTime | startTime |
the start and end dates for the filter. More... | |
![]() | |
lType | dataVec |
int | filtered |
A count of the last number of items filtered. More... | |
Additional Inherited Members | |
![]() | |
typedef std::list< FileData >::iterator | lItrType |
typedef std::list< FileData > | lType |
List of file data to be filtered. More... | |
gnsstk::FileFilterFrame< FileStream, FileData >::FileFilterFrame | ( | const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME |
||
) |
gnsstk::FileFilterFrame< FileStream, FileData >::FileFilterFrame | ( | const std::vector< std::string > & | fileList, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME |
||
) |
Takes a list of files to open in lieu of day times.
Exception |
Definition at line 194 of file FileFilterFrame.hpp.
gnsstk::FileFilterFrame< FileStream, FileData >::FileFilterFrame | ( | const std::string & | filename, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME |
||
) |
Takes a file name for a single file filter.
Exception | when there's a file error. |
Definition at line 209 of file FileFilterFrame.hpp.
gnsstk::FileFilterFrame< FileStream, FileData >::FileFilterFrame | ( | const FileSpec & | spec, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME , |
||
const FileSpecFind::Filter & | filter = FileSpecFind::Filter() |
||
) |
Uses the FileSpec to retrieve files. Use filter like you would in FileSpecFind, to filter FOR stations, receivers, etc.
Exception | when there's a file error. |
Definition at line 219 of file FileFilterFrame.hpp.
|
inlinevirtual |
Definition at line 141 of file FileFilterFrame.hpp.
|
protected |
Run init() to load the data into the filter.
Exception |
Definition at line 281 of file FileFilterFrame.hpp.
FileFilterFrame< FileStream, FileData > & gnsstk::FileFilterFrame< FileStream, FileData >::newSource | ( | const FileSpec & | filespec, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME , |
||
const FileSpecFind::Filter & | filter = FileSpecFind::Filter() |
||
) |
Gets the files from the file spec and the time, then adds the data to the filter. Use filter like you would in FileSpecFind, to filter FOR stations, receivers, etc.
Exception |
Definition at line 231 of file FileFilterFrame.hpp.
FileFilterFrame< FileStream, FileData > & gnsstk::FileFilterFrame< FileStream, FileData >::newSource | ( | const std::string & | filename, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME |
||
) |
Reads in the file and adds the data to the filter.
Exception |
Definition at line 247 of file FileFilterFrame.hpp.
FileFilterFrame< FileStream, FileData > & gnsstk::FileFilterFrame< FileStream, FileData >::newSource | ( | const std::vector< std::string > & | fileList, |
const gnsstk::CommonTime & | start = gnsstk::CommonTime::BEGINNING_OF_TIME , |
||
const gnsstk::CommonTime & | end = gnsstk::CommonTime::END_OF_TIME |
||
) |
Takes a list of files to open in lieu of day times
Exception |
Definition at line 262 of file FileFilterFrame.hpp.
bool gnsstk::FileFilterFrame< FileStream, FileData >::writeFile | ( | const std::string & | outputFile, |
const bool | append = false |
||
) | const |
Writes the data to the file outputFile, truncating the output file if it already exists unless append is true. This can throw an exception when there's a file error.
Exception |
Definition at line 303 of file FileFilterFrame.hpp.
bool gnsstk::FileFilterFrame< FileStream, FileData >::writeFile | ( | FileStream & | stream | ) | const |
Writes the data to the supplied stream. This can throw an exception when there's a file error.
Exception |
Definition at line 326 of file FileFilterFrame.hpp.
|
protected |
Definition at line 179 of file FileFilterFrame.hpp.
|
protected |
The file spec for this filter.
Definition at line 177 of file FileFilterFrame.hpp.
|
protected |
the start and end dates for the filter.
Definition at line 179 of file FileFilterFrame.hpp.