00001 #pragma ident "$Id: FileHunter.hpp 70 2006-08-01 18:36:21Z ehagen $"
00002
00003
00004
00010 #ifndef GPSTK_FILEHUNTER_HPP
00011 #define GPSTK_FILEHUNTER_HPP
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #include "FileSpec.hpp"
00055
00056 namespace gpstk
00057 {
00060
00063 NEW_EXCEPTION_CLASS(FileHunterException, gpstk::Exception);
00064
00104 class FileHunter
00105 {
00106 public:
00107
00110 enum FileChunking
00111 {
00112 WEEK,
00113 DAY,
00114 HOUR,
00115 MINUTE
00116 };
00117
00120 typedef std::pair<FileSpec::FileSpecType, std::vector<std::string> >
00121 FilterPair;
00122
00129 FileHunter(const std::string& filespec)
00130 throw(FileHunterException);
00131
00136 FileHunter(const FileSpec& filespec)
00137 throw(FileHunterException);
00138
00144 FileHunter& newHunt(const std::string& filespec)
00145 throw(FileHunterException);
00146
00151 FileHunter& newHunt(const FileSpec& filespec)
00152 throw(FileHunterException)
00153 {return newHunt(filespec.getSpecString());}
00154
00162 FileHunter& setFilter(const FileSpec::FileSpecType fst,
00163 const std::vector<std::string>& filter)
00164 throw(FileHunterException);
00165
00180 std::vector<std::string>
00181 find(const gpstk::DayTime& start = gpstk::DayTime::BEGINNING_OF_TIME,
00182 const gpstk::DayTime& end = gpstk::DayTime::END_OF_TIME,
00183 const FileSpec::FileSpecSortType fsst = FileSpec::ascending,
00184 enum FileChunking chunk = DAY) const
00185 throw(FileHunterException);
00186
00188 void dump(std::ostream& o) const;
00189
00190 private:
00191
00192 FileHunter();
00193 FileHunter(const FileHunter& fh);
00194 FileHunter& operator=(const FileHunter& fh);
00195
00196 protected:
00198 void init(const std::string& filespec)
00199 throw(FileHunterException);
00200
00204 std::vector<std::string>
00205 searchHelper(const std::string& directory,
00206 const FileSpec& fs) const
00207 throw(FileHunterException);
00208
00211 void filterHelper(std::vector<std::string>& fileList,
00212 const FileSpec& fs) const
00213 throw(FileHunterException);
00214
00216 std::vector<FileSpec> fileSpecList;
00217
00219 std::vector<FilterPair> filterList;
00220 };
00221
00223
00224 }
00225
00226
00227
00228
00229 #endif