QDriver.hh

Go to the documentation of this file.
00001 
00031 #ifndef _Q_DRIVER_H_
00032 #define _Q_DRIVER_H_
00033 
00034 #include "QBaseModule.hh"
00035 #include "QOptions.hh"
00036 #include <vector>
00037 
00038 using namespace Cuore;
00039 
00040 class QDriver : public QBaseModule {
00041 
00042         public:
00043 
00044                 QDriver(const std::string&, QSequence *s);
00045                 
00046                 virtual ~QDriver();
00047 
00048         bool StopRun()      { return fStopRun; }
00049 
00050         void SetModulesList(const std::vector<QBaseModule*>& modList) { fModules = modList; }
00051 
00052         const std::vector<QBaseModule*>& GetModulesList() const { return fModules; };
00053         protected:
00054 
00055 
00056 
00057         std::map<std::string, QVdt*> GetModuleParameters(const std::string& mod, int occ) { return QOptions::GetInstance().GetModuleParameters(GetSequence().GetName(), mod,occ);}
00058 
00059 
00061         const QError& JumpToEvent(unsigned int event) { return GetSequence().JumpToEvent(event,this) ;}
00062         enum ActionId {
00063             ACT_NONE,
00064             ACT_NEXTEV,
00065             ACT_PREVEV,
00066             ACT_GOTOEV,
00067             ACT_RERUN,
00068             ACT_QUIT,
00069         };
00070 
00071         class Action {
00072             public:
00073                 Action() {};
00074                 Action(ActionId id) { fActionId = id; }
00075 
00076                 ActionId fActionId;
00077                 int fEventNumber;
00078         };
00079 
00081                 virtual Action Init() = 0;
00082 
00084                 virtual Action Do(QEvent* ev) = 0;
00085                 
00087                 virtual Action Done() = 0;
00088     
00089         
00090         private:
00092             void Begin();
00093 
00095                 QEvent* Process( QEvent* ev); 
00096                 
00098                 void End();
00099 
00100         void HandleAction(Action action);
00101 
00102         Action fLastAction;
00103         bool fStopRun;
00104         int fCurrentEventNumber;
00105         std::vector<QBaseModule*> fModules;
00106 
00107 };
00108 
00109 #undef REGISTER_MODULE
00110 #define REGISTER_MODULE(clazz) REGISTER_MOD(clazz,QDriver)
00111 
00112 #endif

Generated on Tue Nov 16 10:49:56 2010 for CUORE Software by  doxygen 1.5.6