QBaseEleDevice.hh

Go to the documentation of this file.
00001 
00010 #ifndef _QBASE_ELE_DEVICE_HH_
00011 #define _QBASE_ELE_DEVICE_HH_
00012 
00013 // C/C++ Includes
00014 #include <map>
00015 #include <vector>
00016 #include <string>
00017 #include <sstream>
00018 
00019 
00020 // Apollo Includs
00021 #include "QCuore.hh"
00022 #include "QCommand.hh"
00023 #include "QError.hh"
00024 #include "QApolloError.hh"
00025 #include "QSlowTypes.hh"
00026 #include "QApolloDbSlow.hh"
00027 #include "QEleBaseInterface.hh"
00028 
00029  
00030 class QEleChannel;
00031 
00032 class QBaseEleDevice {
00033 public:
00034 
00036    enum QAddressing_t
00037    {
00038       QSLOW_LG  =0, 
00039       QSLOW_ID  =1, 
00040    };
00041    
00050    QBaseEleDevice(QEleBaseInterface* IFace, QSlowTypes::QSlowDevice_t Device, 
00051                   QSlowTypes::QSlowMode_t Mode, std::map<unsigned int,QDaqChannel>& Channels);
00052               
00054    virtual ~QBaseEleDevice();
00055  
00056    // Set Value
00057    virtual const QError& SetInt(int Id, size_t Value, const std::string& What, QAddressing_t Add)=0;
00058    virtual const QError& SetInt(int Crate, int Board, int Ch, 
00059                                 size_t Value, const std::string& What)=0;
00060  
00061    // Get Value
00062    virtual const QError& GetInt(int Id, size_t& Value, const std::string& What, QAddressing_t Add)=0;
00063    virtual const QError& GetInt(int Crate, int Board, int Channel, 
00064                                 size_t& Value, const std::string& What)=0;
00065   
00066    // Get Info (name, addressing and so on)
00067    virtual const QError& GetString(int Id, std::string& Text, const std::string& What, QAddressing_t Add)=0;
00068 
00069    // Start Command
00070    virtual const QError& Start(int Id, const std::string& What, QAddressing_t Add)=0;
00071   
00072    virtual const QError& Start(int Crate, int Board, int Channel, const std::string& What)=0;
00073 
00074    // Get QError
00075    inline const QError& GetQError() {return fErr->GetQError();} 
00076 
00081    virtual void Dump();
00082 
00086    inline QEleBaseInterface& GetInterface() {return *fFace;} 
00087 
00088    
00089 protected:
00090 
00091    // String for compone msg
00092    std::ostringstream fMsgString;
00093    
00094    QEleBaseInterface* fFace;                 
00095    QApolloError*      fErr;                  
00096    std::map<int,QEleChannel*> fPhyChannels;  
00097    std::map<int,QEleChannel*> fIdChannels;   
00099    const std::map<unsigned int,QDaqChannel>* const fChannels; 
00107    inline const QSlowTypes::QSlowDevice_t GetDeviceType() const {return fDevice;}
00108 
00109    
00115    inline const QSlowTypes::QSlowMode_t GetMode() const {return fMode;}
00116    
00121    const QError& CreateLgChannels();
00122 
00123    
00128    const QError& CreateIdChannels();
00129 
00130   
00140    QEleChannel* GetEleChannel(int who, QAddressing_t Add);
00141 
00142 
00143    // Apply DB Setting
00144    //void ApplyDBSetting(const std::map<unsigned int,QDaqChannel>& Channels);
00145   
00146 private:
00147 
00148    // From name to board address
00149    size_t GetPulserBoard(const std::string& BoardName);
00150 
00151 
00152    QSlowTypes::QSlowDevice_t fDevice; 
00153    QSlowTypes::QSlowMode_t   fMode;   
00154 };
00155 
00156 #endif // _QBASE_ELE_DEVICE_HH_

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