00001 00012 #ifndef __QASCII_HH_ 00013 #define __QASCII_HH_ 00014 00015 #include <string> 00016 #include <vector> 00017 #include "QVector.hh" 00018 #include "QTime.hh" 00019 #include "QRunData.hh" 00020 00021 using namespace Cuore; 00022 00023 00024 class QASCII { 00025 public: 00029 QASCII(); 00030 00035 QASCII(const QASCII& orig); 00036 00041 QASCII(std::string filename); 00042 00046 virtual ~QASCII(); 00047 00051 bool Exists(); 00052 00058 int NumberOfLines(bool ExcludeComments=true); 00059 00064 QVector* ReadQVector(); 00065 00072 QVector* ReadQVector(int ColumnNumber, int startline=0, int endline=-1); 00073 00080 int WriteQVector(QVector outputVector, bool append=false); 00081 00090 int WriteQVectors(std::vector<QVector> outputVector, bool append=false); 00091 00098 bool WriteString(std::string outputString, bool append=false); 00099 00106 bool WriteLine(std::string line, bool append=true); 00107 00113 bool Comment(std::string comment); 00114 00120 std::string ReadComment(int commentNumber=0); 00121 00127 std::string ReadString(int startline = 0, int endline = -1); 00128 00133 std::vector<double> ReadVector(); 00134 00141 std::vector<double> ReadVector(int ColumnNumber, int startline=0, int endline=-1); 00142 00149 int WriteVector(std::vector<double> outputVector, bool append=false); 00150 int WriteVector(std::vector<int> outputVector, bool append=false); 00151 00160 int WriteVectors(std::vector<std::vector<double> > outputVector, bool append=false); 00161 00168 bool WriteQTime(QTime* qt, bool append=true); 00169 00175 QTime* ReadQTime(int startline=0); 00176 00183 bool WriteQRunData(QRunData* qrd, bool append=false); 00184 00190 QRunData* ReadQRunData(int startline=0, int endline=-1); 00191 00192 00196 void DeleteFile(){ remove(fFilename.c_str()); } 00197 00204 int FindLine(std::string pattern, int startline=0); 00205 00206 00207 00208 private: 00210 std::string fFilename; 00211 00212 }; 00213 00214 00215 00216 00217 #endif