00001 #ifndef _INCLUDE_DATAFILE_H
00002 #define _INCLUDE_DATAFILE_H
00003
00004 #include <ParseException.h>
00005 #include <FileNotFoundException.h>
00006 #include <vector>
00007 #include <map>
00008 #include <fstream>
00009
00010 namespace ICLIB {
00011
00012 typedef std::vector< double > Values;
00013 typedef std::map< std::string,double > ValueMap;
00014
00015 class DataFile {
00016
00017 public:
00018 typedef std::vector< std::pair< std::string,Values > > ValuesMap;
00019
00020 virtual ~DataFile() {}
00021
00022 void clear() { mValues.clear(); }
00023 virtual void load(const std::string& filename) =0;
00024 virtual void save(const std::string& filename) =0;
00025
00026 const Values& getValues(const std::string& key) const ;
00027 void setValues(const std::string& key,const Values& data) ;
00028
00029 virtual void getArrayValues(vector<double>& array,int& xdim,int& ydim) =0;
00030 virtual void setArrayValues(const vector<double>& array,int xdim,int ydim) =0;
00031
00032 protected:
00033 ValuesMap mValues;
00034 Values mEmpty;
00035 std::string mFilename;
00036 };
00037
00038 }
00039
00040 #endif // _INCLUDE_DATAFILE_H