THMSSLogFile.h

00001 #ifndef gridripper_util_THMSSLogFile_h
00002 #define gridripper_util_THMSSLogFile_h
00003 
00004 #include <gridripper/io/IOException.h>
00005 #include <gridripper/lang/IllegalArgumentException.h>
00006 #include <gridripper/tvalarray.h>
00007 #ifdef HAVE_GSTREAM
00008 #include <gstream/gstream.h>
00009 #else
00010 #include <fstream>
00011 #endif
00012 #include <time.h>
00013 
00014 namespace gridripper { namespace util {
00015 
00016 using namespace gridripper::io;
00017 using namespace std;
00018 
00026 class THMSSLogFile
00027 {
00028 private:
00029     long long timeInit;
00030 //    long long int timeEff;
00031 #ifdef HAVE_GSTREAM
00032     ogstream writer;
00033 #else
00034     ofstream writer;
00035 #endif
00036     string lastLine;
00037 
00038 public:
00044     THMSSLogFile(string f, bool append) throw(IOException&);
00045 
00046 //    time_t getTimeEff() {
00047 //      return timeEff;
00048 //    }
00049 
00054     string getLastLine() const {
00055         return lastLine;
00056     }
00057 
00062     void write(string s) throw(IOException&);
00063 
00069     void write(string ts, /*time_t teff,*/ string s) throw(IOException&);
00070 
00074     void close() throw(IOException&);
00075 
00076 private:
00077     static string format(string ts, long long int t0/*, time_t teff*/);
00078 
00079     static tvalarray<long long int> readLastRuntimes(string f)
00080         throw(IOException&);
00081 
00082     static string getBuildInfo();
00083 
00084     static string getSystemDescription();
00085 
00086     static int parseInt(const string& s) throw(IllegalArgumentException&);
00087 
00088     static double parseDouble(const string& s) throw(IllegalArgumentException&);
00089 
00090     static long long int microsecTime();
00091 };
00092 
00093 } } // namespace gridripper::util
00094 
00095 #endif /* gridripper_util_THMSSLogFile_h */

Generated on Wed Jun 17 18:46:47 2009 for GridRipper by  doxygen 1.5.6