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 "QError.hh"
00020 
00021 class QDaqServer
00022 {
00023 public:
00025    static QDaqServer& GetInstance();
00026 
00028    virtual ~QDaqServer();
00029    
00031    inline const QDaqCommonDefs::QDaqState GetState() const {return fDaqState;}
00032 
00034    int GetCurrentRun() const { return fRun; }
00035    
00036    bool SetTriggerFlag(const unsigned int crateId, const bool flag);
00037 
00038    // state commands
00039    bool StartProcesses(int settingsBasket,
00040                        int run,
00041                        int shifterSet,
00042                        const std::string& comments);
00043 
00044    bool Pause();
00045    bool Resume();
00046    bool Stop(int shifterSet, const std::string& comments);
00047 
00048    void ResetError() { fError.Set(QERR_SUCCESS); }
00049    bool HasError() const { return fError != QERR_SUCCESS; }
00050    const QError& GetError() const { return fError; }
00051 
00052 private:
00054    QDaqServer();
00055    
00056    QDaqCommonDefs::QDaqState fDaqState;   
00057    int fSettingsBasket;   
00058    int fRun;                  
00059    std::string fDaqUser;      
00060    std::string fPathBin;      
00061    std::string fPathLog;      
00062    std::string fReceiverAddr; 
00063    std::string fPulserAddr; 
00064    std::string fLoggerAddr;   
00065    std::string fLoggerPort;   
00066    std::string fDianaCfg;     
00067    std::string fEnvFile;      
00068    int  ReceiverBasePort;     
00069    bool fUseMuonReader;       
00070    bool fUsePulser;           
00071    bool fUseBuilder;          
00072    bool fReleaseReceiver;     
00073    bool fSaveChannels;     
00074    int  fSimulaHardware;   
00075    const float fTimeOut;      
00076    bool fBuilderIsRunning;   
00077    bool fPulserControllerIsRunning; 
00078    bool fMuonReaderIsRunning; 
00079    QError fError; 
00082    std::map<std::string,std::string> fReaders;
00084    std::map<std::string,std::string> fSenders;
00086    std::vector<std::string> fReceivers;
00087 
00088 
00094    bool StartRun();
00095 
00109    bool Abort();
00110 
00112    inline void SetState(const QDaqCommonDefs::QDaqState& s) {fDaqState=s;}
00113    
00121    bool StartMuonReader(const std::string& address);
00122 
00130    bool StartPulserController(const std::string& address);
00131 
00142    bool StartReader(int crateId, const std::string& address, int extClock);
00143 
00153    bool StartSender(int crateId, const std::string& address);
00154 
00163    bool StartReceiver(int crateId);
00164 
00172    bool StartBuilder();
00173    
00187    bool StartProcess(const std::string& process,
00188                      const std::string& address,
00189                      const std::string& options,
00190                      QDaqCommonDefs::ProcessStatus_t    status);
00191 
00192    bool KillProcess(const std::string& process,
00193                     const std::string& host,
00194                     const std::string& signal);
00195 
00196    bool KillProcess(const std::string& process,
00197                     const std::string& host,
00198                     const std::string& signal,
00199                     const std::string& killOpts);
00200 
00201    QDaqCommonDefs::ProcessStatus_t AskStatus(const std::string& process);
00202 
00213    bool CheckStatus(const std::string& process,
00214                     QDaqCommonDefs::ProcessStatus_t    status,
00215                     float              timeout);
00216 
00226    bool Unregistered(const std::string& process, float timeout);
00227 
00228 
00234    QDaqCommonDefs::ProcessStatus_t GetStatusCode(const std::string& message);
00235 
00236    // clear all internal variables
00237    void Clear();
00238 
00239    // get formatted date string
00240    const char* GetDateString() const;
00241 };
00242 
00243 #endif

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