QEleChannel.hh
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef QELE_CHANNEL_HH
00014 #define QELE_CHANNEL_HH
00015 
00016 
00017 #include <string>
00018 
00019 
00020 #include "QCuore.hh"
00021 #include "QError.hh"
00022 #include "QSlowTypes.hh"
00023 
00024 
00025 
00026 namespace QEleLib 
00027 {
00028 
00029    
00030    struct QEleAddress 
00031    {
00032       size_t Controller; 
00033       size_t Board;      
00034       size_t Channel;    
00035       size_t Slot;       
00036       
00037       std::string Name;  
00038    };
00039   
00040 };
00041 
00042 
00043 
00044 class QEleChannel 
00045 {
00046 public:
00047 
00048   
00049    
00050    
00051    QEleChannel(size_t Ctrl, size_t Slot, size_t Board, size_t Channel, QSlowTypes::QSlowDevice_t Type);
00052 
00053    
00054    QEleChannel(QEleLib::QEleAddress& Add, QSlowTypes::QSlowDevice_t Type);
00055 
00056    
00057    virtual ~QEleChannel() {}
00058   
00059    
00060    inline const std::string& GetLabel() const {return fLabel;}
00061 
00062    
00063    inline void SetLabel(const std::string& Label) {fLabel=Label;return;}
00064 
00065    
00066    inline const size_t GetController() const {return fAdd.Controller;}
00067    inline const size_t GetSlot()       const {return fAdd.Slot;}
00068    inline const size_t GetBoard()      const {return fAdd.Board;}
00069    inline const size_t GetChannel()    const {return fAdd.Channel;}
00070 
00071    
00072    const std::string GetControllerLabel();
00073    const std::string GetSlotLabel();
00074    const std::string GetBoardLabel();
00075    const std::string GetChannelLabel();
00076   
00077    
00078    inline const QSlowTypes::QSlowDevice_t GetType() const {return fType;}
00079 
00080     
00081 protected:
00082   
00083 
00084    
00085    virtual const std::string BuildName(size_t LgChannel);
00086 
00087    
00088    inline const QEleLib::QEleAddress& GetPhysAddress() const {return fAdd;}
00089 
00090 
00091    
00092    virtual bool WriteRegister(size_t Reg, char  Value)=0;
00093 
00094 
00095    
00096    virtual bool ReWriteRegister(size_t Reg)=0;
00097 
00098    
00099    virtual bool ReadRegister (size_t Reg, char& Value)=0;
00100   
00101 
00102    
00103    inline void SetFunctionName(const std::string& Name) {fFuncName=Name;return;}
00104 
00105    
00106    inline const std::string GetFunctionName() const {return fFuncName;}
00107 
00108 private:
00109   
00110    
00111    QSlowTypes::QSlowDevice_t fType;              
00112     
00113    
00114    QEleLib::QEleAddress fAdd;
00115 
00116 
00117    
00118    std::string fLabel;
00119 
00120 
00121    
00122    std::string fFuncName;
00123 
00124 };
00125 
00126 #endif
00127