QDaqServer.hh

Go to the documentation of this file.
00001 
00009 #ifndef __QDAQSERVER_HH_
00010 #define __QDAQSERVER_HH_
00011 
00012 #include <map>
00013 #include <vector>
00014 #include <string>
00015 
00016 #include "QCuore.hh"
00017 #include "QCommand.hh"
00018 #include "QDaqCommonDefs.hh"
00019 #include "QDaqDefs.hh"
00020 #include "QError.hh"
00021 
00022 class QDaqServer
00023 {
00024 public:
00026    static QDaqServer& GetInstance();
00027 
00029    virtual ~QDaqServer();
00030    
00032    inline const QDaqState GetState() const {return fDaqState;}
00033 
00035    int GetCurrentRun() const { return fRun; }
00036    
00037    bool SetTriggerFlag(const unsigned int crateId, const bool flag);
00038 
00039    // state commands
00040    bool StartProcesses(int settingsBasket, int run, int shifterSet);
00041    bool Pause();
00042    bool Resume();
00043    bool Stop(int shifterSet);
00044 
00045    void ResetError() { fError.Set(QERR_SUCCESS); }
00046    bool HasError() const { return fError != QERR_SUCCESS; }
00047    const QError& GetError() const { return fError; }
00048 
00049 private:
00051    QDaqServer();
00052    
00053    QDaqState fDaqState;   
00054    int fSettingsBasket;   
00055    int fRun;                  
00056    std::string fDaqUser;      
00057    std::string fPathBin;      
00058    std::string fPathLog;      
00059    std::string fReceiverAddr; 
00060    std::string fPulserAddr; 
00061    std::string fLoggerAddr;   
00062    std::string fLoggerPort;   
00063    std::string fDianaCfg;     
00064    std::string fEnvFile;      
00065    int  ReceiverBasePort;     
00066    bool fUseMuonReader;       
00067    bool fUsePulser;           
00068    bool fUseBuilder;          
00069    bool fReleaseReceiver;     
00070    bool fSaveChannels;     
00071    int  fSimulaHardware;   
00072    const float fTimeOut;      
00073    bool fBuilderIsRunning;   
00074    bool fPulserControllerIsRunning; 
00075    bool fMuonReaderIsRunning; 
00076    QError fError; 
00079    std::map<std::string,std::string> fReaders;
00081    std::map<std::string,std::string> fSenders;
00083    std::vector<std::string> fReceivers;
00084 
00085 
00091    bool StartRun();
00092 
00106    bool Abort();
00107 
00109    inline void SetState(const QDaqState& s) {fDaqState=s;}
00110    
00118    bool StartMuonReader(const std::string& address);
00119 
00127    bool StartPulserController(const std::string& address);
00128 
00139    bool StartReader(int crateId, const std::string& address, int extClock);
00140 
00150    bool StartSender(int crateId, const std::string& address);
00151 
00160    bool StartReceiver(int crateId);
00161 
00169    bool StartBuilder();
00170    
00184    bool StartProcess(const std::string& process,
00185                      const std::string& address,
00186                      const std::string& options,
00187                      ProcessStatus_t    status);
00188 
00189    bool KillProcess(const std::string& process,
00190                     const std::string& host,
00191                     const std::string& signal);
00192 
00193    bool KillProcess(const std::string& process,
00194                     const std::string& host,
00195                     const std::string& signal,
00196                     const std::string& killOpts);
00197 
00198    ProcessStatus_t AskStatus(const std::string& process);
00199 
00210    bool CheckStatus(const std::string& process,
00211                     ProcessStatus_t    status,
00212                     float              timeout);
00213 
00223    bool Unregistered(const std::string& process, float timeout);
00224 
00225 
00231    ProcessStatus_t GetStatusCode(const std::string& message);
00232 
00233    // clear all internal variables
00234    void Clear();
00235 
00236    // get formatted date string
00237    const char* GetDateString() const;
00238 };
00239 
00240 #endif

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1