00001 00008 #ifndef _MQ_READER_HH_ 00009 #define _MQ_READER_HH_ 00010 00011 #include "QBaseModule.hh" 00012 #include "QError.hh" 00013 #include "QDbDetector.hh" 00014 #include <string> 00015 #include <vector> 00016 00017 using namespace Cuore; 00018 00019 class QReader : public QBaseModule 00020 { 00021 public: 00023 QReader(const std::string& name, QSequence* s); 00024 00026 virtual ~QReader(); 00027 00029 virtual void Init() = 0; 00030 00034 virtual QEvent* Do( QEvent* ev) = 0; 00035 00037 virtual void Done() = 0; 00038 00043 virtual const QError& JumpToEvent(unsigned int event); 00044 00046 const int& GetFileNumber() {return fFileNumber;} 00047 00049 static std::list<std::string> GetFilesList() { return fFullPathFilesList; } 00050 00052 unsigned int GetEventNumber() const {return fEventNumber > 0 ? (fEventNumber-1) : 0;} 00053 00054 protected: 00057 void InitFileManager(); 00059 void OpenNewFile(const std::string& fileName); 00061 int fFileNumber; 00063 std::vector<std::string> fFileList; 00064 static std::list<std::string> fFullPathFilesList; 00065 00067 QError fErr; 00069 unsigned int fEventNumber; 00070 00072 int fEventNumberPrintStep; 00073 00075 bool fReadFileList; 00077 std::string fFileListPath; 00078 private: 00080 void ReadFilesList(std::string path); 00081 00082 void Begin(); 00083 QEvent* Process(QEvent* ev); 00084 void End() { Done(); } 00085 00086 std::vector<std::string>::const_iterator fFileListIter; 00087 friend class QSequence; 00088 00089 }; 00090 00091 #undef REGISTER_MODULE 00092 #define REGISTER_MODULE(clazz) REGISTER_MOD(clazz,QReader) 00093 00094 #endif