QEleChannel.hh

00001 /*
00002  * APOLLO: A complete DAQ and Online Data Analysis Framework for Cuore
00003  * 
00004  * A.G. created 28/6/6
00005  *
00006  * $Id: QEleChannel.hh 404 2006-11-10 23:40:40Z giacher $
00007  * $Revision: 404 $
00008  *
00009  * Class QEleChannel: class used by front end, bessel and pulser classes
00010  *
00011  */
00012 
00013 #ifndef QELE_CHANNEL_HH
00014 #define QELE_CHANNEL_HH
00015 
00016 // C/C++ Includes
00017 #include <string>
00018 
00019 // Apollo Includes
00020 #include "QCuore.hh"
00021 #include "QError.hh"
00022 #include "QSlowTypes.hh"
00023 
00024 
00025 
00026 namespace QEleLib 
00027 {
00028 
00029    // Structure for Front-Ends & Bessels addressing
00030    struct QEleAddress 
00031    {
00032       size_t Controller; // Controller (crate) Address
00033       size_t Board;      // Board Address (12bit)
00034       size_t Channel;    // Channel Address: 1) Front-End --> Channel = 0,1  2) Bessel --> Channel = 1,2,3;
00035       size_t Slot;       // Slot Number, Front-End --> Slot = 0,1,..,11
00036       //              Bessel    --> Slot = 0,1,..,15
00037       std::string Name;  // Name
00038    };
00039   
00040 };
00041 
00042 
00043 
00044 class QEleChannel 
00045 {
00046 public:
00047 
00048   
00049    // ctor as function of logic channel and 4 variables for phys. addr.
00050    // last parameter is channel type
00051    QEleChannel(size_t Ctrl, size_t Slot, size_t Board, size_t Channel, QSlowTypes::QSlowDevice_t Type);
00052 
00053    // Same as before using structure
00054    QEleChannel(QEleLib::QEleAddress& Add, QSlowTypes::QSlowDevice_t Type);
00055 
00056    // dtor
00057    virtual ~QEleChannel() {}
00058   
00059    // Get Label
00060    inline const std::string& GetLabel() const {return fLabel;}
00061 
00062    // Set Label
00063    inline void SetLabel(const std::string& Label) {fLabel=Label;return;}
00064 
00065    // Return physical addressing
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    // Return physical addressing (to string)
00072    const std::string GetControllerLabel();
00073    const std::string GetSlotLabel();
00074    const std::string GetBoardLabel();
00075    const std::string GetChannelLabel();
00076   
00077    // Return Channel Type
00078    inline const QSlowTypes::QSlowDevice_t GetType() const {return fType;}
00079 
00080     
00081 protected:
00082   
00083 
00084    // Build Channel Name
00085    virtual const std::string BuildName(size_t LgChannel);
00086 
00087    // Get Physical Addres by struct
00088    inline const QEleLib::QEleAddress& GetPhysAddress() const {return fAdd;}
00089 
00090 
00091    // Write Register
00092    virtual bool WriteRegister(size_t Reg, char  Value)=0;
00093 
00094 
00095    // ReWrite Register
00096    virtual bool ReWriteRegister(size_t Reg)=0;
00097 
00098    // Read Register
00099    virtual bool ReadRegister (size_t Reg, char& Value)=0;
00100   
00101 
00102    // Set Function Name for Error Handling
00103    inline void SetFunctionName(const std::string& Name) {fFuncName=Name;return;}
00104 
00105    // Get Function Name for Error Handling
00106    inline const std::string GetFunctionName() const {return fFuncName;}
00107 
00108 private:
00109   
00110    // Channel Type, can be Front-End, Pulser, Bessel
00111    QSlowTypes::QSlowDevice_t fType;              
00112     
00113    // Physical address
00114    QEleLib::QEleAddress fAdd;
00115 
00116 
00117    // Pulser Label
00118    std::string fLabel;
00119 
00120 
00121    // Function Name for Error Handling
00122    std::string fFuncName;
00123 
00124 };
00125 
00126 #endif
00127 

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