00001
00002
00004 #ifndef __ReadAscii__
00005 #define __ReadAscii__
00006
00007 #include "CUtils.h"
00008
00009 #define NCOLMAX 50
00010
00011 using namespace std;
00012
00018 class ReadAscii{
00019
00020 public:
00021
00043 ReadAscii(const string afilename, const string aformat="UNKNOWN");
00044
00048 virtual ~ReadAscii(void);
00049
00057 inline int GetNLine(void){ return (int)mylines.size(); };
00058
00062 inline int GetNRow(void){ return (int)mylines.size(); };
00063
00067 inline int GetNCol(void){ return (int)Vformat.size(); };
00068
00075 bool GetLine(string &line, const int li);
00076
00083 bool GetCol(vector<int> &col, const int co);
00084
00091 bool GetCol(vector<double> &col, const int co);
00092
00099 bool GetCol(vector<string> &col, const int co);
00100
00108 bool GetElement(int &element, const int li, const int co);
00109
00117 bool GetElement(double &element, const int li, const int co);
00118
00126 bool GetElement(string &element, const int li, const int co);
00127
00135 bool SetFormat(const int co, const char aformat);
00136
00137 private:
00138
00139
00140 bool ExtractFormat(void);
00141 bool ExtractLines(void);
00142 bool ExtractCol(void);
00143 void GetMinMax(const int co);
00144
00145 string ffilename;
00146 string fformat;
00147 vector<string> Vformat;
00148 vector <string> mylines;
00149 vector <string> scol[NCOLMAX];
00150 vector <double> dcol[NCOLMAX];
00151 vector <int> icol[NCOLMAX];
00152 double colmin[NCOLMAX];
00153 double colmax[NCOLMAX];
00154 };
00155
00156 #endif
00157
00158
00159
00160
00161
00162
00163
00164
00165