FileFilter Class Template Reference
[File and Directory Processing Utilities]

#include <FileFilter.hpp>

Inheritance diagram for FileFilter:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class FileData>
class gpstk::FileFilter< FileData >

This class is a framework for sorting and filtering file data.

It borrows several datatypes from FileSpec for cohesion of data types. Add the data to the filter, specify the parameters (date, exclusion filters, etc.), then process it. For the specific data type, you can specify your own operators for sorting, uniqueness, or almost anything else you want to do to the data.

Warning:
The FFData class you're sorting MUST have a weak strict ordering as defined in the FileFilterOperator.

Definition at line 79 of file FileFilter.hpp.

Public Member Functions

 FileFilter (void)
 Default constructor.
virtual ~FileFilter ()
 Destructor.
FileFilteraddData (const FileData &ffd)
 Adds the given data into the filter.
FileFilteraddData (const std::list< FileData > &datavec)
 Adds arbitrary data to the filter.
template<class Compare>
FileFiltersort (Compare comp)
 Sorts the data.
FileFiltermerge (const FileFilter &right)
 Combines the data from the input filter to this object.
template<class Compare>
FileFiltermerge (const FileFilter &right, Compare bp)
 Combines the data from the input filter to this object using the predicate to sort the data it merges.
template<class BinaryPredicate>
FileFilterunique (BinaryPredicate bp)
 After sorting, use this to filter the data.
template<class Predicate>
FileFilterfilter (Predicate up)
 This filters data based on a single test.
template<class Operation>
FileFiltertouch (Operation &op)
 Applies Operation on all the data elements, counting each one that gets modified (for which Operation returns true).
template<class Operation>
FileFiltertouch (const Operation &op)
 a const operator touch for the classes that need it.
template<class BinaryPredicate>
std::pair< std::list< FileData >,
std::list< FileData > > 
diff (const FileFilter< FileData > &r, BinaryPredicate p) const
 Returns two lists - one of the data in *this that isn't in r and the second of data in r that isn't in *this.
template<class Predicate>
std::list< FileData > findAll (Predicate p) const
 Returns a list of data matching the given unary predicate.
int getFiltered () const
 Returns the number of items filtered from the last filter() touch() or unique() call.
std::list< FileData > & getData (void)
 Returns the contents of the data list.
std::list< FileData > getData (void) const
 Returns the contents of the data list, const.
std::list< FileData >::size_type getDataCount (void) const
 Returns the number of data items in the filter.
std::list< FileData >::const_iterator begin () const
std::list< FileData >::const_iterator end () const
std::list< FileData >::iterator begin ()
std::list< FileData >::iterator end ()
bool empty () const
void clear ()
std::list< FileData >::size_type size ()
FileData & front ()
const FileData & front () const
FileData & back ()
const FileData & back () const

Protected Types

typedef std::list< FileData > lType
 List of file data to be filtered.
typedef std::list< FileData
>::iterator 
lItrType

Protected Attributes

lType dataVec
int filtered
 A count of the last number of items filtered.


Member Typedef Documentation

typedef std::list<FileData>::iterator lItrType [protected]
 

Definition at line 337 of file FileFilter.hpp.

typedef std::list<FileData> lType [protected]
 

List of file data to be filtered.

Definition at line 335 of file FileFilter.hpp.


Constructor & Destructor Documentation

FileFilter void   ) 
 

Default constructor.

Definition at line 368 of file FileFilter.hpp.

~FileFilter  )  [virtual]
 

Destructor.

Definition at line 373 of file FileFilter.hpp.


Member Function Documentation

FileFilter< FileData > & addData const std::list< FileData > &  datavec  ) 
 

Adds arbitrary data to the filter.

Definition at line 387 of file FileFilter.hpp.

References FileFilter::dataVec.

FileFilter< FileData > & addData const FileData &  ffd  ) 
 

Adds the given data into the filter.

Definition at line 379 of file FileFilter.hpp.

References FileFilter::dataVec.

Referenced by RTFileFrame::getFileFilter(), and main().

const FileData& back  )  const [inline]
 

Definition at line 330 of file FileFilter.hpp.

FileData& back  )  [inline]
 

Definition at line 327 of file FileFilter.hpp.

std::list<FileData>::iterator begin  )  [inline]
 

Definition at line 306 of file FileFilter.hpp.

std::list<FileData>::const_iterator begin  )  const [inline]
 

Definition at line 300 of file FileFilter.hpp.

Referenced by FileFilter::diff(), and main().

void clear void   )  [inline]
 

Definition at line 315 of file FileFilter.hpp.

std::pair< std::list<FileData>, std::list<FileData> > diff const FileFilter< FileData > &  r,
BinaryPredicate  p
const [inline]
 

Returns two lists - one of the data in *this that isn't in r and the second of data in r that isn't in *this.

Remember that /a p has to be a strict weak ordering on the data.

Warning:
the input data needs to be sorted according to /a p before running diff(). This also means that /a p is a strict weak ordering on the data (i.e. /a p sorts the data).

Definition at line 249 of file FileFilter.hpp.

References FileFilter::begin(), FileFilter::dataVec, and FileFilter::end().

bool empty void   )  const [inline]
 

Definition at line 312 of file FileFilter.hpp.

std::list<FileData>::iterator end  )  [inline]
 

Definition at line 309 of file FileFilter.hpp.

std::list<FileData>::const_iterator end  )  const [inline]
 

Definition at line 303 of file FileFilter.hpp.

Referenced by FileFilter::diff(), and main().

FileFilter& filter Predicate  up  )  [inline]
 

This filters data based on a single test.

All data that passes the UnaryPredicate (i.e. it returns true) is removed

Warning:
Depending on the filter, your data may need to be sorted

Definition at line 194 of file FileFilter.hpp.

Referenced by main().

std::list<FileData> findAll Predicate  p  )  const [inline]
 

Returns a list of data matching the given unary predicate.

Definition at line 270 of file FileFilter.hpp.

const FileData& front  )  const [inline]
 

Definition at line 324 of file FileFilter.hpp.

FileData& front  )  [inline]
 

Definition at line 321 of file FileFilter.hpp.

std::list<FileData> getData void   )  const [inline]
 

Returns the contents of the data list, const.

Definition at line 294 of file FileFilter.hpp.

std::list<FileData>& getData void   )  [inline]
 

Returns the contents of the data list.

Definition at line 291 of file FileFilter.hpp.

Referenced by FileFilter::merge().

std::list<FileData>::size_type getDataCount void   )  const [inline]
 

Returns the number of data items in the filter.

Definition at line 297 of file FileFilter.hpp.

int getFiltered  )  const [inline]
 

Returns the number of items filtered from the last filter() touch() or unique() call.

Definition at line 288 of file FileFilter.hpp.

FileFilter& merge const FileFilter< FileData > &  right,
Compare  bp
[inline]
 

Combines the data from the input filter to this object using the predicate to sort the data it merges.

This should use list::merge(list, bp) but since it's broken in forte...

Definition at line 154 of file FileFilter.hpp.

References merge(), and gpstk::sort().

FileFilter< FileData > & merge const FileFilter< FileData > &  right  ) 
 

Combines the data from the input filter to this object.

Definition at line 397 of file FileFilter.hpp.

References FileFilter::dataVec, and FileFilter::getData().

std::list<FileData>::size_type size void   )  [inline]
 

Definition at line 318 of file FileFilter.hpp.

FileFilter& sort Compare  comp  )  [inline]
 

Sorts the data.

Warning:
bp MUST be a strict weak ordering!

Definition at line 97 of file FileFilter.hpp.

Referenced by main().

FileFilter& touch const Operation &  op  )  [inline]
 

a const operator touch for the classes that need it.

Definition at line 238 of file FileFilter.hpp.

FileFilter& touch Operation &  op  )  [inline]
 

Applies Operation on all the data elements, counting each one that gets modified (for which Operation returns true).

The operation is passed by reference so that it can retain state information for use by the program calling it.

Definition at line 220 of file FileFilter.hpp.

FileFilter& unique BinaryPredicate  bp  )  [inline]
 

After sorting, use this to filter the data.

Warning:
The data must be sorted first

Definition at line 160 of file FileFilter.hpp.

Referenced by main().


Member Data Documentation

lType dataVec [protected]
 

Definition at line 336 of file FileFilter.hpp.

Referenced by FileFilter::addData(), FileFilter::diff(), and FileFilter::merge().

int filtered [protected]
 

A count of the last number of items filtered.

Definition at line 362 of file FileFilter.hpp.


The documentation for this class was generated from the following file:
Generated on Tue May 21 03:31:50 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1