00001 #pragma ident "$Id: FileStore.hpp 70 2006-08-01 18:36:21Z ehagen $"
00002
00003
00004
00010 #ifndef GPSTK_FILE_STORE_HPP
00011 #define GPSTK_FILE_STORE_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 <vector>
00055
00056 #include "Exception.hpp"
00057
00058 namespace gpstk
00059 {
00069 template <class HeaderType> class FileStore
00070 {
00071 public:
00072
00074 FileStore() throw() {};
00075
00077 virtual ~FileStore() {};
00078
00079 std::vector<std::string> getFileNames() const
00080 {
00081 typedef typename FFDataMap::const_iterator const_iterator;
00082 std::vector<std::string> nv;
00083 const_iterator i;
00084 for (i=headerMap.begin(); i!=headerMap.end(); i++)
00085 nv.push_back(i->first);
00086 return nv;
00087 }
00088
00089 void addFile(const std::string& fn, const HeaderType& header) throw()
00090 { headerMap[fn] = header; };
00091
00092 const HeaderType& getHeader(const std::string& fn) throw()
00093 { return headerMap[fn]; };
00094
00096 virtual void loadFile(const std::string& fileName)
00097 throw (FileMissingException) = 0;
00098
00099 virtual void loadFiles(const std::vector<std::string>& fileNames)
00100 {
00101 std::vector<std::string>::const_iterator f=fileNames.begin();
00102 for (f=fileNames.begin(); f!=fileNames.end(); f++)
00103 loadFile(*f);
00104 };
00105
00107 unsigned size() const throw() { return headerMap.size(); }
00108
00109 private:
00110
00111 typedef std::map<std::string, HeaderType> FFDataMap;
00112
00114 FFDataMap headerMap;
00115 };
00116
00118
00119 }
00120
00121 #endif