00001 00002 #ifndef _QBASE_PULSER_CONTROLLER_HH_ 00003 #define _QBASE_PULSER_CONTROLLER_HH_ 00004 00005 #include "QTimer.hh" 00006 00007 #include <map> 00008 #include <vector> 00009 00010 class QPulserConfig; 00011 class QPulserChannel; 00012 class QPulserGroup; 00013 class QSlowControlClient; 00014 class QBaseDigitalController; 00015 00021 class QBasePulserController 00022 { 00023 public: 00025 QBasePulserController(); 00026 00028 virtual ~QBasePulserController(); 00029 00031 int Run(); 00032 00037 void Fire(); 00038 00040 void PrepareNext(); 00041 00043 void HandleTimeOut(); 00044 00046 void StartDelayTimers(); 00047 00049 void StopDelayTimers(); 00050 00051 00052 protected: 00054 std::vector<QPulserGroup*> fGroups; 00056 std::vector<QPulserGroup*>::const_iterator fGroupsIt; 00057 QTimer<QBasePulserController> fBaseTimer; 00058 unsigned long fTimeBase; 00059 00061 const unsigned long kPulserMinDelay; 00062 00069 virtual void HandleTimeOutChild() = 0; 00070 00072 virtual void StorePulseId(unsigned int pulseId) {} 00073 00075 void InitSlowClient(int settingsBasket); 00076 00078 void InitDioCtrl(); 00079 00081 void ConnectDelayTimers(); 00082 00083 private: 00084 00085 QSlowControlClient *fSlowClient; 00086 QBaseDigitalController *fDioCtrl; 00087 00088 unsigned int fNextGroupId; 00089 long fDelay; 00090 00091 00092 00094 void BuildDelayIndexes(const std::map<unsigned int, QPulserChannel*>& 00095 pChans); 00096 00097 void ApplySlowConfig(const unsigned int& pulseId, 00098 const QPulserConfig* config); 00099 00100 00101 void PrepareDigital(const unsigned int& pulseId, 00102 const QPulserConfig* config); 00103 00104 }; 00105 00106 #endif