QWPSlowConfigHandler.hh

Go to the documentation of this file.
00001 
00008 #ifndef _QWPSLOW_CONFIG_HANDLER_HH_
00009 #define _QWPSLOW_CONFIG_HANDLER_HH_
00010 
00011 #include "QCuore.hh"
00012 #include "QDaqClient.hh"
00013 #include "QSlowControlClient.hh"
00014 
00015 #include <map>
00016 #include <list>
00017 #include <vector>
00018 
00019 class QEleChannelConfig;
00020 
00021 class QWPSlowConfigHandler
00022 {
00023 public:
00024    
00026    static QWPSlowConfigHandler& GetInstance();
00027    
00029    virtual ~QWPSlowConfigHandler();
00030 
00031    void KillDaqCrates(bool kill) { fKillDaq = kill; }
00032 
00033    QError GetPresentConfig(const unsigned int lg,QEleChannelConfig& config);
00042    const QEleChannelConfig* GetConfig(const unsigned int lg,
00043                                   const unsigned int id) const;
00044 
00063    virtual bool AddConfig(const unsigned int lg, QEleChannelConfig* config);
00064    
00081    bool Schedule(const unsigned int lg, QEleChannelConfig* config);
00082 
00090    const QEleChannelConfig* GetNextScheduled(const unsigned int lg) const;
00091    
00101    void EraseNextScheduled(const unsigned int lg);
00102    
00108    const QEleChannelConfig* GetLastConfig(const unsigned int lg) const;
00109 
00117    bool AddNextScheduled(const unsigned int lg);
00118 
00125    virtual void SetConfDone(const unsigned int lg,const unsigned int id);
00126 
00131    bool IsConfDone() const { return fCurrentConfig.empty(); }
00132 
00139    virtual bool SetActiveChannels(const std::list<unsigned int>& channels);
00140 
00145    const std::list<unsigned int>& GetActiveChannels() const 
00146    { return fChannels; }
00147 
00152    void Clear();
00153 
00171    bool Consolidate(bool triggerFlag);
00172 
00173    void Dump() const;
00174 
00175    bool SetSleepTime(const unsigned int sleepTime);
00176    
00177    unsigned int GetSleepTime() const { return fSleepTime; }
00178 
00179    void Update()  { UpdateDaq(false); }
00180 
00181 
00182 protected:
00184    QWPSlowConfigHandler();
00192    std::map<unsigned int,std::vector<QEleChannelConfig*> > fConfigMap;
00193 
00195    std::list<unsigned int> fChannels;
00196 private:
00197    bool fKillDaq;
00198    void UpdateDaq(bool reset);
00199    bool fTriggerFlag;
00200 
00201    void InitSlowClient();
00202 
00209    std::map<unsigned int, std::list<QEleChannelConfig*> > fScheduled;
00210    std::map<unsigned int, QEleChannelConfig> fPresentConfigs;
00211 
00217    std::map<unsigned int,unsigned int> fCurrentConfig;
00218 
00219 
00227    std::list<unsigned int> fCrates;
00228 
00235    std::map<unsigned int, QEleChannelConfig*> fNextConfig;
00236 
00238    time_t fSleepTime;
00239 
00240    QDaqClient fDaqClient;
00241    QSlowControlClient fSlowClient;
00242 
00254    bool ApplyConfig(const unsigned int lg,
00255                     QEleChannelConfig* conf,
00256                     const QEleChannelConfig* oldConf);
00257 
00258 
00260    void GetCratesToKill();
00261 
00267    bool CheckSlowStatus();
00268 };
00269 
00270 #endif

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