00001
00002 #ifndef _JAFAR_DATAREADER_HPP_
00003 #define _JAFAR_DATAREADER_HPP_
00004
00005 #include <string>
00006 #include <map>
00007
00008 #include "kernel/keyValueFile.hpp"
00009
00010 namespace jafar {
00011 namespace datareader {
00012
00013 class StereoReader;
00014 class MonoReader;
00015 class PanoReader;
00016 class PositionReader;
00017
00022 class DataReader {
00023 public:
00030 DataReader(std::string seriesname = s_seriesname, int serienumber = s_serienumber, std::string basepath = s_basepath );
00031
00032 public:
00038 StereoReader* getStereoReader(int index, bool fatal = true);
00044 StereoReader* getStereoReader(std::string benchName)
00045 {
00046 return getStereoReader(m_benchNames2index[ benchName ]);
00047 }
00053 MonoReader* getMonoReader(int index, bool fatal = true) { return getMonoReader(index, 0, fatal); }
00059 MonoReader* getMonoReader(std::string benchName)
00060 {
00061 return getMonoReader(m_benchNames2index[ benchName ]);
00062 }
00068 MonoReader* getPanoReader(int index, bool fatal = true) { return getMonoReader(index, 1, fatal); }
00074 inline MonoReader* getPanoReader(std::string benchName)
00075 {
00076 return getPanoReader(m_benchNames2index[ benchName ]);
00077 }
00078 public:
00079 inline std::string dataPath() { return m_datapath; }
00080 public:
00085 inline static void setDefaultBasePath(std::string s) { s_basepath = s; }
00089 inline static std::string defaultBasePath() { return s_basepath; }
00094 inline static void setDefaultSeriesName(std::string s) { s_seriesname = s; }
00098 inline static std::string defaultSeriesName() { return s_seriesname; }
00103 inline static void setDefaultSerieNumber(int n) { s_serienumber = n; }
00107 inline static int defaultSerieNumber() { return s_serienumber; }
00108 private:
00116 void getBasicSensorInfo(int index, std::string& sensorbase, std::string& sensorname, std::string& benchtype);
00117 MonoReader* getMonoReader(int index, int type, bool fatal = true);
00118 private:
00119 static std::string s_basepath;
00120 static std::string s_seriesname;
00121 static int s_serienumber;
00122 std::string m_datapath;
00123 int m_nbSensors;
00124 std::map< std::string, int> m_benchNames2index;
00125 jafar::kernel::KeyValueFile m_keyValueFile;
00126 };
00127
00128 }
00129 }
00130
00131 #endif