MRootFileWriter.hh
Go to the documentation of this file.00001
00049 #ifndef _M_ROOT_FILE_WRITER_H_
00050 #define _M_ROOT_FILE_WRITER_H_
00051
00052 #include <string>
00053 #include "QCuore.hh"
00054 #include "QFileWriter.hh"
00055 #include "TObjString.h"
00056
00057 class TFile;
00058 class TObejct;
00059 class QTree;
00060 class QEventR;
00061 class QObjectR;
00062 namespace Cuore{class QObject;}
00063
00064 class MRootFileWriter : public QFileWriter {
00065
00066 public:
00067 MRootFileWriter(QSequence *s);
00068
00069 virtual ~MRootFileWriter();
00070
00071 void Open(const std::string& filename);
00072
00073 void Dump(const QEvent& ev);
00074
00075 void Close();
00076
00077 protected:
00078 static TFile* GetCurrentFile() { return fRootOutput; }
00079
00080 private:
00081 static TFile *fRootOutput;
00082 QTree* fTree;
00083 QEventR* fEvent;
00084 bool fFirstDumpCall;
00085
00086
00087 template<class T> class Datum {
00088 public:
00089 Datum(const std::string& name) { fName = name; }
00090 std::string fName;
00091 T fObj;
00092 };
00093
00094 std::list<Datum<int> > fIntList;
00095 std::list<Datum<double> > fDoubleList;
00096 std::list<Datum<float> > fFloatList;
00097 std::list<Datum<bool> > fBoolList;
00098 std::list<Datum<TObjString*> > fStringList;
00099 std::list<Datum<QObjectR*> > fQObjectList;
00100 std::list<Datum<const TObject*> > fTObjectList;
00101
00102 };
00103
00104 class MRootFileWriterFriend : public MRootFileWriter {
00105
00106 public:
00107 ~MRootFileWriterFriend() {};
00108
00109 private:
00110 MRootFileWriterFriend(QSequence* s) : MRootFileWriter(s) {};
00111
00112 friend class LRootGlobalWriter;
00113 };
00114 #endif