00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ProMCBook_H
00014 #define ProMCBook_H
00015
00016 #include <string>
00017 #include <iostream>
00018 #include <fstream>
00019 #include <iomanip>
00020 #include "zipios++/zipios-config.h"
00021 #include "zipios++/meta-iostreams.h"
00022 #include "zipios++/zipoutputstream.h"
00023 #include "zipios++/zipfile.h"
00024 #include "zipios++/zipinputstream.h"
00025 #include <ctime>
00026 #include <iostream>
00027 #include <fstream>
00028 #include <exception>
00029 #include "ProMC.pb.h"
00030 #include "ProMCHeader.pb.h"
00031 #include "ProMCStat.pb.h"
00032 #include "ProMCDescription.pb.h"
00033
00034 using namespace promc;
00035 using namespace std;
00036 using namespace zipios ;
00037
00038
00039
00040 using std::cerr ;
00041 using std::cout ;
00042 using std::endl ;
00043 using std::ios ;
00044 using std::string ;
00045 using std::exception ;
00046 using std::istream;
00047 using std::ofstream;
00048 using std::ifstream;
00049 using std::setw;
00050
00051
00052 class ProMCBook{
00053 public:
00054
00055 ProMCBook();
00056 ~ProMCBook();
00057 ProMCBook(const char* filename, const char * option);
00058 void open(const char* filename, const char * option);
00059 ProMCEvent get();
00060 ProMCEvent event(long idx);
00061 int next();
00062 int getTimestamp() { return timestamp; };
00063 int getVersion() { return version; };
00064 string getDescription() { return description; };
00065 void setDescription(int events, string s);
00066 int getEvents() { return nev; };
00067 int getEventsRequested() { return requested_nev; };
00068 ProMCHeader getHeader();
00069 void setHeader(ProMCHeader h);
00070 void setStatistics(ProMCStat h);
00071 ProMCStat getStatistics();
00072 void close();
00073 void write(ProMCEvent e );
00074 void clear();
00075 unsigned int size();
00076 static const int current_version=3;
00077
00078
00079 private:
00080
00081 int timestamp;
00082 int version;
00083 string description;
00084 ProMCStat hStat;
00085 unsigned long nev;
00086 unsigned long requested_nev;
00087 ZipOutputStream *outzip;
00088 ZipInputStream *inpzip;
00089 bool isToWrite;
00090 ZipFile *zfile;
00091
00092 };
00093
00094 #endif